summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-09-14 02:36:03 +0200
committerPetr Mrázek <peterix@gmail.com>2015-09-14 02:36:03 +0200
commitdd8eacee1b28ca40f8dc770587d111656d92d5fb (patch)
tree152e671cbb9ad23ce8966a23e752423ace7d8b82
parente38cc1d480fdcf3ad08829688fe1a61961612e36 (diff)
downloadMultiMC-dd8eacee1b28ca40f8dc770587d111656d92d5fb.tar
MultiMC-dd8eacee1b28ca40f8dc770587d111656d92d5fb.tar.gz
MultiMC-dd8eacee1b28ca40f8dc770587d111656d92d5fb.tar.lz
MultiMC-dd8eacee1b28ca40f8dc770587d111656d92d5fb.tar.xz
MultiMC-dd8eacee1b28ca40f8dc770587d111656d92d5fb.zip
GH-1227 renam GZip functions to not collide with zlib macros
-rw-r--r--application/pages/OtherLogsPage.cpp2
-rw-r--r--logic/GZip.cpp4
-rw-r--r--logic/GZip.h4
-rw-r--r--logic/minecraft/World.cpp2
-rw-r--r--tests/tst_GZip.cpp6
5 files changed, 10 insertions, 8 deletions
diff --git a/application/pages/OtherLogsPage.cpp b/application/pages/OtherLogsPage.cpp
index b3481bfb..74257a83 100644
--- a/application/pages/OtherLogsPage.cpp
+++ b/application/pages/OtherLogsPage.cpp
@@ -130,7 +130,7 @@ void OtherLogsPage::on_btnReload_clicked()
if(file.fileName().endsWith(".gz"))
{
QByteArray temp;
- if(!GZip::decompress(file.readAll(), temp))
+ if(!GZip::unzip(file.readAll(), temp))
{
ui->text->setPlainText(
tr("The file (%1) is not readable.").arg(file.fileName()));
diff --git a/logic/GZip.cpp b/logic/GZip.cpp
index d38d06e2..38605df6 100644
--- a/logic/GZip.cpp
+++ b/logic/GZip.cpp
@@ -2,7 +2,7 @@
#include <zlib.h>
#include <QByteArray>
-bool GZip::decompress(const QByteArray &compressedBytes, QByteArray &uncompressedBytes)
+bool GZip::unzip(const QByteArray &compressedBytes, QByteArray &uncompressedBytes)
{
if (compressedBytes.size() == 0)
{
@@ -59,7 +59,7 @@ bool GZip::decompress(const QByteArray &compressedBytes, QByteArray &uncompresse
return true;
}
-bool GZip::compress(const QByteArray &uncompressedBytes, QByteArray &compressedBytes)
+bool GZip::zip(const QByteArray &uncompressedBytes, QByteArray &compressedBytes)
{
if (uncompressedBytes.size() == 0)
{
diff --git a/logic/GZip.h b/logic/GZip.h
index 51be5ca1..6993a222 100644
--- a/logic/GZip.h
+++ b/logic/GZip.h
@@ -6,7 +6,7 @@
class MULTIMC_LOGIC_EXPORT GZip
{
public:
- static bool decompress(const QByteArray &compressedBytes, QByteArray &uncompressedBytes);
- static bool compress(const QByteArray &uncompressedBytes, QByteArray &compressedBytes);
+ static bool unzip(const QByteArray &compressedBytes, QByteArray &uncompressedBytes);
+ static bool zip(const QByteArray &uncompressedBytes, QByteArray &compressedBytes);
};
diff --git a/logic/minecraft/World.cpp b/logic/minecraft/World.cpp
index bb99aa96..cda81309 100644
--- a/logic/minecraft/World.cpp
+++ b/logic/minecraft/World.cpp
@@ -187,7 +187,7 @@ static int64_t read_long (nbt::value& parent, const char * name, const int64_t &
void World::parseLevelDat(QByteArray data)
{
QByteArray output;
- is_valid = GZip::decompress(data, output);
+ is_valid = GZip::unzip(data, output);
if(!is_valid)
{
return;
diff --git a/tests/tst_GZip.cpp b/tests/tst_GZip.cpp
index 23c749ef..67707a4b 100644
--- a/tests/tst_GZip.cpp
+++ b/tests/tst_GZip.cpp
@@ -42,8 +42,10 @@ slots:
{
QByteArray copy = random;
copy.resize(cur);
- QVERIFY(GZip::compress(copy, compressed));
- QVERIFY(GZip::decompress(compressed, decompressed));
+ compressed.clear();
+ decompressed.clear();
+ QVERIFY(GZip::zip(copy, compressed));
+ QVERIFY(GZip::unzip(compressed, decompressed));
QCOMPARE(decompressed, copy);
fib(prev, cur);
} while (cur < size);