summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/GZipFile.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-18 21:49:08 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-18 21:49:08 +0100
commitb8fe024f9de9988b8aa2fc86a1d52b8dbf5712df (patch)
tree93afcc6d60f697fe59a12b4e67a780a0c7a3907e /src/OSSupport/GZipFile.cpp
parentAdded levels of shrapnel (diff)
parentFixed chunkmap tree block replacing. (diff)
downloadcuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.gz
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.bz2
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.lz
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.xz
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.tar.zst
cuberite-b8fe024f9de9988b8aa2fc86a1d52b8dbf5712df.zip
Diffstat (limited to 'src/OSSupport/GZipFile.cpp')
-rw-r--r--src/OSSupport/GZipFile.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/OSSupport/GZipFile.cpp b/src/OSSupport/GZipFile.cpp
index cbf6be6c4..b13e519e0 100644
--- a/src/OSSupport/GZipFile.cpp
+++ b/src/OSSupport/GZipFile.cpp
@@ -73,12 +73,15 @@ int cGZipFile::ReadRestOfFile(AString & a_Contents)
// Since the gzip format doesn't really support getting the uncompressed length, we need to read incrementally. Yuck!
int NumBytesRead = 0;
+ int TotalBytes = 0;
char Buffer[64 KiB];
while ((NumBytesRead = gzread(m_File, Buffer, sizeof(Buffer))) > 0)
{
+ TotalBytes += NumBytesRead;
a_Contents.append(Buffer, NumBytesRead);
}
- return NumBytesRead;
+ // NumBytesRead is < 0 on error
+ return (NumBytesRead >= 0) ? TotalBytes : NumBytesRead;
}