diff options
author | madmaxoft <github@xoft.cz> | 2014-03-18 13:54:17 +0100 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-03-18 13:54:17 +0100 |
commit | 4dc5650023c234a9e82c97c795d8c39016063c51 (patch) | |
tree | 1870bd16f401a4f130e2aec7c8c3fe1bfbb96335 /src | |
parent | Fixed a crash in firework rockets. (diff) | |
download | cuberite-4dc5650023c234a9e82c97c795d8c39016063c51.tar cuberite-4dc5650023c234a9e82c97c795d8c39016063c51.tar.gz cuberite-4dc5650023c234a9e82c97c795d8c39016063c51.tar.bz2 cuberite-4dc5650023c234a9e82c97c795d8c39016063c51.tar.lz cuberite-4dc5650023c234a9e82c97c795d8c39016063c51.tar.xz cuberite-4dc5650023c234a9e82c97c795d8c39016063c51.tar.zst cuberite-4dc5650023c234a9e82c97c795d8c39016063c51.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/OSSupport/GZipFile.cpp | 5 |
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; } |