diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-04-04 16:36:52 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-04-04 16:36:52 +0200 |
commit | e009569060c50fc52f6a84594ef5edf490633ee6 (patch) | |
tree | 7a54badd1bfd6a9628c124f8e89820718b4e0bd6 | |
parent | Fixed a parsing error in NBT classes (doubles weren't parsing correctly); (diff) | |
download | cuberite-e009569060c50fc52f6a84594ef5edf490633ee6.tar cuberite-e009569060c50fc52f6a84594ef5edf490633ee6.tar.gz cuberite-e009569060c50fc52f6a84594ef5edf490633ee6.tar.bz2 cuberite-e009569060c50fc52f6a84594ef5edf490633ee6.tar.lz cuberite-e009569060c50fc52f6a84594ef5edf490633ee6.tar.xz cuberite-e009569060c50fc52f6a84594ef5edf490633ee6.tar.zst cuberite-e009569060c50fc52f6a84594ef5edf490633ee6.zip |
Diffstat (limited to '')
-rw-r--r-- | source/StringCompression.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/StringCompression.cpp b/source/StringCompression.cpp index 31506604a..96d94fe9d 100644 --- a/source/StringCompression.cpp +++ b/source/StringCompression.cpp @@ -40,12 +40,13 @@ int UncompressString(const char * a_Data, int a_Length, AString & a_Uncompressed // It saves us one allocation and one memcpy of the entire compressed data
// It may not work on some STL implementations! (Confirmed working on MSVC 2008 & 2010)
a_Uncompressed.resize(a_UncompressedSize);
- int errorcode = uncompress((Bytef*)a_Uncompressed.data(), (uLongf *)&a_UncompressedSize, (const Bytef*)a_Data, a_Length);
+ uLongf UncompressedSize = (uLongf)a_UncompressedSize; // On some architectures the uLongf is different in size to int, that may be the cause of the -5 error
+ int errorcode = uncompress((Bytef*)a_Uncompressed.data(), &UncompressedSize, (const Bytef*)a_Data, a_Length);
if (errorcode != Z_OK)
{
return errorcode;
}
- a_Uncompressed.resize(a_UncompressedSize);
+ a_Uncompressed.resize(UncompressedSize);
return Z_OK;
}
|