From e009569060c50fc52f6a84594ef5edf490633ee6 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 4 Apr 2012 14:36:52 +0000 Subject: [PATCH] Compression error -5 fix git-svn-id: http://mc-server.googlecode.com/svn/trunk@452 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/StringCompression.cpp | 5 +++-- 1 file 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; }