summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-19 16:08:43 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-19 16:39:11 +0300
commit623a64f2c96b71f8609eccb81cb04886ae390c7b (patch)
tree1d9c782f26e3e4a4dba2dfc53de5729f8c2684ff /src
parentb7c9e3c0fd5b17c6964c81bb742c2cef1630d50e (diff)
downloadmanaplus-623a64f2c96b71f8609eccb81cb04886ae390c7b.tar.gz
manaplus-623a64f2c96b71f8609eccb81cb04886ae390c7b.tar.bz2
manaplus-623a64f2c96b71f8609eccb81cb04886ae390c7b.tar.xz
manaplus-623a64f2c96b71f8609eccb81cb04886ae390c7b.zip
Dump on startup linked and loaded lib versions.
For now only zlib supported. Also detect zlib by pkgconfig in configure.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/client.cpp2
-rw-r--r--src/localconsts.h2
-rw-r--r--src/net/download.cpp4
-rw-r--r--src/resources/mapreader.cpp6
-rw-r--r--src/utils/dumplibs.cpp35
-rw-r--r--src/utils/dumplibs.h28
8 files changed, 74 insertions, 7 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f67fb94b3..4432d86e9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -853,6 +853,8 @@ SET(SRCS
utils/cpu.h
utils/delete2.h
utils/dtor.h
+ utils/dumplibs.cpp
+ utils/dumplibs.h
utils/env.cpp
utils/env.h
utils/files.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index a1726b768..d3c664606 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -499,6 +499,8 @@ SRC += events/actionevent.h \
utils/cpu.h \
utils/delete2.h \
utils/dtor.h \
+ utils/dumplibs.cpp \
+ utils/dumplibs.h \
utils/env.cpp \
utils/env.h \
utils/files.cpp \
diff --git a/src/client.cpp b/src/client.cpp
index be9143062..344d5d7a4 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -134,6 +134,7 @@
#include "utils/cpu.h"
#include "utils/delete2.h"
+#include "utils/dumplibs.h"
#include "utils/env.h"
#include "utils/fuzzer.h"
#include "utils/gettext.h"
@@ -351,6 +352,7 @@ void Client::gameInit()
Dirs::initScreenshotDir();
updateEnv();
+ dumpLibs();
// Initialize SDL
logger->log1("Initializing SDL...");
diff --git a/src/localconsts.h b/src/localconsts.h
index d5bd0ebc1..08623b2b5 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -87,8 +87,6 @@
#endif // GCC_VERSION < 40900
#endif // GCC_VERSION < 40700
-#undef Z_NULL
-#define Z_NULL nullptr
#define M_TCPOK
#define A_DELETE(func) func = delete
#define A_DELETE_COPY(name) name(const name &) = delete; \
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 7d7869001..ad66fa121 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -143,7 +143,7 @@ unsigned long Download::fadler32(FILE *const file)
// Calculate Adler-32 checksum
char *const buffer = new char[CAST_SIZE(fileSize)];
const uInt read = static_cast<uInt>(fread(buffer, 1, fileSize, file));
- unsigned long adler = adler32(0L, Z_NULL, 0);
+ unsigned long adler = adler32(0L, nullptr, 0);
adler = adler32(static_cast<uInt>(adler),
reinterpret_cast<Bytef*>(buffer), read);
delete [] buffer;
@@ -153,7 +153,7 @@ unsigned long Download::fadler32(FILE *const file)
unsigned long Download::adlerBuffer(const char *const buffer, int size)
{
FUNC_BLOCK("Download::adlerBuffer", 1)
- unsigned long adler = adler32(0L, Z_NULL, 0);
+ unsigned long adler = adler32(0L, nullptr, 0);
return adler32(static_cast<uInt>(adler),
reinterpret_cast<const Bytef*>(buffer), size);
}
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 9156f334d..cfce7c397 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -128,9 +128,9 @@ int inflateMemory(unsigned char *restrict const in,
out = static_cast<unsigned char*>(calloc(bufferSize, 1));
z_stream strm;
- strm.zalloc = Z_NULL;
- strm.zfree = Z_NULL;
- strm.opaque = Z_NULL;
+ strm.zalloc = nullptr;
+ strm.zfree = nullptr;
+ strm.opaque = nullptr;
strm.next_in = in;
strm.avail_in = inLength;
strm.next_out = out;
diff --git a/src/utils/dumplibs.cpp b/src/utils/dumplibs.cpp
new file mode 100644
index 000000000..6a6e378ba
--- /dev/null
+++ b/src/utils/dumplibs.cpp
@@ -0,0 +1,35 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2017 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "utils/dumplibs.h"
+
+#include "logger.h"
+
+#include <zlib.h>
+
+#include "debug.h"
+
+void dumpLibs()
+{
+ logger->log("Compiled with zLib: %s", ZLIB_VERSION);
+#if ZLIB_VERNUM >= 0x1020
+ logger->log("Linked with zLib: %s", zlibVersion());
+#endif // ZLIB_VERNUM >= 0x1020
+}
diff --git a/src/utils/dumplibs.h b/src/utils/dumplibs.h
new file mode 100644
index 000000000..1013026f1
--- /dev/null
+++ b/src/utils/dumplibs.h
@@ -0,0 +1,28 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2017 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef UTILS_DUMPLIBS_H
+#define UTILS_DUMPLIBS_H
+
+#include "localconsts.h"
+
+void dumpLibs();
+
+#endif // UTILS_DUMPLIBS_H