30 if (inflateInit2(&zs, 15 + 32) != Z_OK) {
34 zs.next_in = (Bytef*)str.data();
35 zs.avail_in = str.size();
42 zs.next_out =
reinterpret_cast<Bytef*
>(buffer);
43 zs.avail_out =
sizeof(buffer);
47 if (out->size() < zs.total_out) {
48 out->append(buffer, zs.total_out - out->size());
54 if (
status != Z_STREAM_END) {
55 VLOG(1) <<
"Exception during zlib decompression: (" <<
status <<
") "
72 if (deflateInit(&zs, Z_BEST_COMPRESSION) != Z_OK) {
73 VLOG(1) <<
"Cannot initialize zlib compression.";
77 zs.next_in = (Bytef*)uncompressed.data();
78 zs.avail_in = uncompressed.size();
85 zs.next_out =
reinterpret_cast<Bytef*
>(buffer);
86 zs.avail_out =
sizeof(buffer);
88 status = deflate(&zs, Z_FINISH);
97 if (
status != Z_STREAM_END) {
98 VLOG(1) <<
"Exception during zlib compression: (" <<
status <<
") "