From 79a8749249c61799ff894695431376f997c25781 Mon Sep 17 00:00:00 2001 From: Jan Sucan Date: Wed, 22 Jan 2025 15:01:36 +0100 Subject: Move multi-buffering to BufferedStream::Reader --- src/restore.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/restore.cpp') 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) { -- cgit v1.2.3