72 z_stream zstream = {0};
73 int ret = inflateInit(&zstream);
76 size_t ungzip_buff_size = target.size() * 0x30;
77 std::string current_decode_buff(ungzip_buff_size,
'X');
83 zstream.next_out = (Bytef*)current_decode_buff.data();
84 zstream.avail_out = (uInt)ungzip_buff_size;
86 int flag = Z_SYNC_FLUSH;
88 static char dummy_head[2] =
91 (((0x8 + 0x7 * 0x10) * 0x100 + 30) / 31 * 31) & 0xFF,
93 zstream.next_in = (Bytef*) dummy_head;
94 zstream.avail_in =
sizeof(dummy_head);
95 ret = inflate(&zstream, Z_NO_FLUSH);
102 zstream.next_in = (Bytef*)target.data();
103 zstream.avail_in = (uInt)target.size();
105 ret = inflate(&zstream, Z_SYNC_FLUSH);
106 if (ret != Z_OK && ret != Z_STREAM_END)
113 target.erase(0, target.size()-zstream.avail_in);
116 if(ungzip_buff_size == zstream.avail_out)
123 current_decode_buff.resize(ungzip_buff_size - zstream.avail_out);
124 if(decode_summary_buff.size())
125 decode_summary_buff += current_decode_buff;
127 current_decode_buff.swap(decode_summary_buff);
129 current_decode_buff.resize(ungzip_buff_size);
132 inflateEnd(&zstream );
134 decode_summary_buff.swap(target);
#define LOCAL_ASSERT(expr)