From 8d651a1f68c018b8a10dd37da81e9d3612073656 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 20 Apr 2021 22:54:49 +0200 Subject: Fix brotli compression of files > 128 KiB This has been broken since faa31f40846f7a4dbc2487d000b112a6aef69d1b. --- src/libutil/compression.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/libutil/compression.cc') diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc index 8b50776b3..08812ef57 100644 --- a/src/libutil/compression.cc +++ b/src/libutil/compression.cc @@ -28,7 +28,7 @@ struct ChunkedCompressionSink : CompressionSink const size_t CHUNK_SIZE = sizeof(outbuf) << 2; while (!data.empty()) { size_t n = std::min(CHUNK_SIZE, data.size()); - writeInternal(data); + writeInternal(data.substr(0, n)); data.remove_prefix(n); } } @@ -265,7 +265,8 @@ struct BrotliCompressionSink : ChunkedCompressionSink } }; -std::unique_ptr makeDecompressionSource(Source & prev) { +std::unique_ptr makeDecompressionSource(Source & prev) +{ return std::unique_ptr(new ArchiveDecompressionSource(prev)); } -- cgit v1.2.3