summaryrefslogtreecommitdiffstats
path: root/src/StringCompression.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-08-24 21:45:03 +0200
committerMattes D <github@xoft.cz>2016-08-24 22:26:53 +0200
commitd2e8643607424cd74616e2e863f5609e7b8458a5 (patch)
treed5afab6035ca6bb0b58fd03ad5cfe3b3f8e1da55 /src/StringCompression.cpp
parentMerge pull request #3342 from cuberite/FixEmptyHeader (diff)
downloadcuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.gz
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.bz2
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.lz
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.xz
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.tar.zst
cuberite-d2e8643607424cd74616e2e863f5609e7b8458a5.zip
Diffstat (limited to '')
-rw-r--r--src/StringCompression.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/StringCompression.cpp b/src/StringCompression.cpp
index 8be6d0026..ff434bbb1 100644
--- a/src/StringCompression.cpp
+++ b/src/StringCompression.cpp
@@ -16,7 +16,7 @@ int CompressString(const char * a_Data, size_t a_Length, AString & a_Compressed,
// HACK: We're assuming that AString returns its internal buffer in its data() call and we're overwriting that buffer!
// 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)
+ // It may not work on some STL implementations! (Confirmed working on all currently used MSVC, GCC and Clang versions)
a_Compressed.resize(CompressedSize);
int errorcode = compress2(reinterpret_cast<Bytef *>(const_cast<char *>(a_Compressed.data())), &CompressedSize, reinterpret_cast<const Bytef *>(a_Data), static_cast<uLong>(a_Length), a_Factor);
if (errorcode != Z_OK)
@@ -35,7 +35,7 @@ int UncompressString(const char * a_Data, size_t a_Length, AString & a_Uncompres
{
// HACK: We're assuming that AString returns its internal buffer in its data() call and we're overwriting that buffer!
// 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)
+ // It may not work on some STL implementations! (Confirmed working on all currently used MSVC, GCC and Clang versions)
a_Uncompressed.resize(a_UncompressedSize);
uLongf UncompressedSize = static_cast<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(reinterpret_cast<Bytef *>(const_cast<char *>(a_Uncompressed.data())), &UncompressedSize, reinterpret_cast<const Bytef *>(a_Data), static_cast<uLong>(a_Length));