Skip to content
Snippets Groups Projects
Commit 6545b2ce authored by Adrien Béraud's avatar Adrien Béraud
Browse files

archiver: resize compressed data to actual size

archiver::compress used to rely on compressBound, but the actual
compressed size might be smaller, leading to larger output (with
trailing zeroes).

Change-Id: Ic33614f2d6bc648e59a76dec7275e71466ecaff1
Tuleap: #888
parent 5a09b307
No related branches found
No related tags found
No related merge requests found
......@@ -224,6 +224,7 @@ Archiver::compress(const std::string& str, int compressionlevel)
auto destSize = compressBound(str.size());
std::vector<uint8_t> outbuffer(destSize);
int ret = ::compress(reinterpret_cast<Bytef*>(outbuffer.data()), &destSize, (Bytef*)str.data(), str.size());
outbuffer.resize(destSize);
if (ret != Z_OK) {
std::ostringstream oss;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment