mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07:00
Fix #196
This commit is contained in:
parent
7231f6fe00
commit
f40de531ab
1 changed files with 2 additions and 10 deletions
12
httplib.h
12
httplib.h
|
@ -1018,10 +1018,7 @@ public:
|
|||
template <typename T>
|
||||
bool decompress(const char *data, size_t data_len, T callback) {
|
||||
int ret = Z_OK;
|
||||
std::string decompressed;
|
||||
|
||||
// strm.avail_in = content.size();
|
||||
// strm.next_in = (Bytef *)content.data();
|
||||
strm.avail_in = data_len;
|
||||
strm.next_in = (Bytef *)data;
|
||||
|
||||
|
@ -1039,15 +1036,10 @@ public:
|
|||
case Z_MEM_ERROR: inflateEnd(&strm); return false;
|
||||
}
|
||||
|
||||
decompressed.append(buff, bufsiz - strm.avail_out);
|
||||
callback(buff, bufsiz - strm.avail_out);
|
||||
} while (strm.avail_out == 0);
|
||||
|
||||
if (ret == Z_STREAM_END) {
|
||||
callback(decompressed.data(), decompressed.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return ret == Z_STREAM_END;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue