aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-04-20 22:54:49 +0200
committerEelco Dolstra <edolstra@gmail.com>2021-04-20 22:54:49 +0200
commit8d651a1f68c018b8a10dd37da81e9d3612073656 (patch)
treef817a6d3783e9d3c8278ba0e3772da00ae9a19c8
parentb60b0d62d6a65ad8051a24cf4d4e6c50d27abf6a (diff)
Fix brotli compression of files > 128 KiB
This has been broken since faa31f40846f7a4dbc2487d000b112a6aef69d1b.
-rw-r--r--src/libutil/compression.cc5
1 files changed, 3 insertions, 2 deletions
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<Source> makeDecompressionSource(Source & prev) {
+std::unique_ptr<Source> makeDecompressionSource(Source & prev)
+{
return std::unique_ptr<Source>(new ArchiveDecompressionSource(prev));
}