summaryrefslogtreecommitdiffstats
path: root/src/StringCompression.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-04-02 15:37:24 +0200
committerTycho <work.tycho+git@gmail.com>2014-04-02 15:37:24 +0200
commit741a64c250a1085108f24f351e9d9dacd085cc82 (patch)
treea69b5aba676473e5f75822a02e14e2acc542b263 /src/StringCompression.cpp
parentFixed All signedness warnings in HTTPServer.cpp (diff)
parentMerge branch 'master' into globals (diff)
downloadcuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.gz
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.bz2
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.lz
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.xz
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.zst
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.zip
Diffstat (limited to 'src/StringCompression.cpp')
-rw-r--r--src/StringCompression.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/StringCompression.cpp b/src/StringCompression.cpp
index 5b9a3bb0a..2a85649a1 100644
--- a/src/StringCompression.cpp
+++ b/src/StringCompression.cpp
@@ -53,7 +53,7 @@ int UncompressString(const char * a_Data, int a_Length, AString & a_Uncompressed
-int CompressStringGZIP(const char * a_Data, int a_Length, AString & a_Compressed)
+int CompressStringGZIP(const char * a_Data, size_t a_Length, AString & a_Compressed)
{
// Compress a_Data into a_Compressed using GZIP; return Z_XXX error constants same as zlib's compress2()
@@ -83,6 +83,7 @@ int CompressStringGZIP(const char * a_Data, int a_Length, AString & a_Compressed
{
// Some data has been compressed. Consume the buffer and continue compressing
a_Compressed.append(Buffer, sizeof(Buffer) - strm.avail_out);
+ strm.next_out = (Bytef *)Buffer;
strm.avail_out = sizeof(Buffer);
if (strm.avail_in == 0)
{
@@ -116,7 +117,7 @@ int CompressStringGZIP(const char * a_Data, int a_Length, AString & a_Compressed
-extern int UncompressStringGZIP(const char * a_Data, int a_Length, AString & a_Uncompressed)
+extern int UncompressStringGZIP(const char * a_Data, size_t a_Length, AString & a_Uncompressed)
{
// Uncompresses a_Data into a_Uncompressed using GZIP; returns Z_OK for success or Z_XXX error constants same as zlib
@@ -139,13 +140,14 @@ extern int UncompressStringGZIP(const char * a_Data, int a_Length, AString & a_U
for (;;)
{
- res = inflate(&strm, Z_FINISH);
+ res = inflate(&strm, Z_NO_FLUSH);
switch (res)
{
case Z_OK:
{
// Some data has been uncompressed. Consume the buffer and continue uncompressing
a_Uncompressed.append(Buffer, sizeof(Buffer) - strm.avail_out);
+ strm.next_out = (Bytef *)Buffer;
strm.avail_out = sizeof(Buffer);
if (strm.avail_in == 0)
{