QMimeDatabase/zlib: fix build with z_const macro empty

The next_in pointer in z_stream is defined as "z_const Bytef *" but
z_const is actually an empty macro in most builds. Since our data is
read-only constexpr, we need this const_cast to compile.

Fixes: QTBUG-84457
Pick-to: 5.15
Change-Id: Ied637aece2a7427b8a2dfffd1612a01ae46f7c1a
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Thiago Macieira 2020-05-26 09:14:15 -07:00
parent 04b120bc3c
commit cdcb75c46b

View File

@ -647,7 +647,7 @@ QMimeXMLProvider::QMimeXMLProvider(QMimeDatabasePrivate *db, InternalDatabaseEnu
#elif defined(MIME_DATABASE_IS_GZIP)
std::unique_ptr<char []> uncompressed(new char[size]);
z_stream zs = {};
zs.next_in = mimetype_database;
zs.next_in = const_cast<Bytef *>(mimetype_database);
zs.avail_in = sizeof(mimetype_database);
zs.next_out = reinterpret_cast<Bytef *>(uncompressed.get());
zs.avail_out = size;