diff options
| author | Jan Sucan <jan@jansucan.com> | 2025-01-22 15:01:36 +0100 |
|---|---|---|
| committer | Ján Sučan <jan@jansucan.com> | 2025-01-22 15:41:30 +0100 |
| commit | 79a8749249c61799ff894695431376f997c25781 (patch) | |
| tree | 97c35c52bb1c0e1fee7755e9c69d6789f8e392d9 /src/restore.cpp | |
| parent | 0cccd90d07bb7a002ecd04581c2c1e18ef8314fe (diff) | |
Move multi-buffering to BufferedStream::Reader
Diffstat (limited to 'src/restore.cpp')
| -rw-r--r-- | src/restore.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/restore.cpp b/src/restore.cpp index f0c4c9e..5b490d9 100644 --- a/src/restore.cpp +++ b/src/restore.cpp @@ -63,17 +63,16 @@ restore(const OptionsRestore &opts) uint64_t size{diff_reader.readSize()}; while (size > 0) { - char *data; - const size_t r{diff_reader.readData(size, &data)}; - if (r == 0) { + const FormatV2::RecordData rd{diff_reader.readRecordData(size)}; + if (rd.size == 0) { break; } - if (!out_file.write(data, r)) { + if (!out_file.write(rd.data.get(), rd.size)) { throw RestoreError("cannot write to output file"); } - size -= r; + size -= rd.size; } if (size > 0) { |
