From 1f461ac45bfa8887261510a95fb33a346d68eaba Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 6 Jun 2012 15:16:49 +0200 Subject: 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 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 --- src/gui/text/qzip.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/gui/text/qzip.cpp') diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index e9ff5e8b59..e3c20f078e 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -358,7 +358,7 @@ struct FileHeader }; QZipReader::FileInfo::FileInfo() - : isDir(false), isFile(false), isSymLink(false), crc32(0), size(0) + : isDir(false), isFile(false), isSymLink(false), crc(0), size(0) { } @@ -378,7 +378,7 @@ QZipReader::FileInfo& QZipReader::FileInfo::operator=(const FileInfo &other) isFile = other.isFile; isSymLink = other.isSymLink; permissions = other.permissions; - crc32 = other.crc32; + crc = other.crc; size = other.size; lastModified = other.lastModified; return *this; @@ -424,7 +424,7 @@ void QZipPrivate::fillFileInfo(int index, QZipReader::FileInfo &fileInfo) const fileInfo.isFile = S_ISREG(mode); fileInfo.isSymLink = S_ISLNK(mode); fileInfo.permissions = modeToPermissions(mode); - fileInfo.crc32 = readUInt(header.h.crc_32); + fileInfo.crc = readUInt(header.h.crc_32); fileInfo.size = readUInt(header.h.uncompressed_size); fileInfo.lastModified = readMSDosDate(header.h.last_mod_file); } @@ -701,8 +701,8 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const */ /*! - \variable FileInfo::crc32 - The calculated checksum as a crc32 type. + \variable FileInfo::crc + The calculated checksum as a crc type. */ /*! -- cgit v1.2.3