path: root/src/3rdparty/zlib
diff options
authoraavit <>2012-06-06 15:16:49 +0200
committerQt by Nokia <>2012-06-08 00:53:10 +0200
commit1f461ac45bfa8887261510a95fb33a346d68eaba (patch)
tree031911dd37be3545f1243e84b5dbc101c7294f79 /src/3rdparty/zlib
parent02191b6e4b03fe05b1b953b3e5d5e456cc5817c9 (diff)
Namespace the bundled zlib symbols, to avoid clash with user zlib
When Qt is being compiled and is using the bundled zlib, QtCore needs to export the zlib symbols, since zlib is needed in other Qt libraries as well. That gives a danger of a potentially disastrous symbol clash if the user later on links with both Qt and an external zlib (ref. e.g. QTBUG-15071). This commit enables a zlib compilation flag that causes all zlib symbols to be redefined with a prefix. Hence, they will not clash with a standard zlib. A minor drawback is that zlib.h will now have #defines for a few semi-normal identifiers. Hence, a couple of more changes are done: In the private qzip code, the identifer crc32 had to be renamed. QHttpNetworkReplyPrivate needed no change, but as a defensive measure the #include <zlib.h> is moved from the _p.h file to the .cpp file, to avoid surprising compilation errors later in code that include that header. This commit does not in itself solve the issue of how to let Qt libraries outside of qtbase use the same bundled zlib, but it is a prerequisite for that. Change-Id: If84105901a8c90d35009faffe660c85a6bd2fee5 Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/3rdparty/zlib')
1 files changed, 3 insertions, 0 deletions
diff --git a/src/3rdparty/zlib/zconf.h b/src/3rdparty/zlib/zconf.h
index 806a51e28c..06e7786cdf 100644
--- a/src/3rdparty/zlib/zconf.h
+++ b/src/3rdparty/zlib/zconf.h
@@ -8,6 +8,9 @@
#ifndef ZCONF_H
#define ZCONF_H
+/* Since QtCore must export these symbols, define Z_PREFIX to avoid clashes system zlib */
+#define Z_PREFIX
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.