Write all the data to file, but don't release the buffers Returns true if successful
| 324 | // Write all the data to file, but don't release the buffers |
| 325 | // Returns true if successful |
| 326 | bool OutputBuffer::WriteToFile(FileData& f) const noexcept |
| 327 | { |
| 328 | bool endedInNewline = false; |
| 329 | const OutputBuffer *current = this; |
| 330 | do |
| 331 | { |
| 332 | if (current->dataLength != 0) |
| 333 | { |
| 334 | if (!f.Write(current->data, current->dataLength)) |
| 335 | { |
| 336 | return false; |
| 337 | } |
| 338 | endedInNewline = current->data[current->dataLength - 1] == '\n'; |
| 339 | } |
| 340 | current = current->Next(); |
| 341 | } while (current != nullptr); |
| 342 | |
| 343 | if (!endedInNewline) |
| 344 | { |
| 345 | return f.Write('\n'); |
| 346 | } |
| 347 | return true; |
| 348 | } |
| 349 | |
| 350 | #endif |
| 351 |
no test coverage detected