diff options
author | MÃ¥rten Nordheim <marten.nordheim@qt.io> | 2022-10-28 13:43:13 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-10-31 18:32:47 +0000 |
commit | 7484585ffa862b2b97d7f59a191b239f9c26ac80 (patch) | |
tree | daefb75f4b63c296a3c8f977767a90ee7d37dfcf | |
parent | 9c533df1e0aae420fa6439e7a64a4480e9f62ef1 (diff) | |
download | qtbase-7484585ffa862b2b97d7f59a191b239f9c26ac80.tar.gz |
QByteArray: in/deflate: compare different types as size_t
Compiling for android a certain configuration warns about comparisons
between types of different signedness.
On 32-bit we cannot cast the unsigned type to qsizetype and on x64
we cannot cast the qsizetype to Zlib's type (both potentially truncating).
So, cast both to size_t before comparing
Change-Id: I0dd40c875b1a61a64f0574f0209a8549fc73164a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c4cb464d74fb703d20b1bf53b3738531f92feae4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 7aae6973b4..d99cdd0aed 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -621,7 +621,8 @@ static QByteArray xxflate(ZLibOp op, QArrayDataPointer<char> out, QByteArrayView avail_out = capacity - out.size; } zs.next_out = reinterpret_cast<uchar *>(out.data()) + out.size; - zs.avail_out = avail_out > MaxChunkSize ? MaxChunkSize : ZlibChunkSize_t(avail_out); + zs.avail_out = size_t(avail_out) > size_t(MaxChunkSize) ? MaxChunkSize + : ZlibChunkSize_t(avail_out); out.size += zs.avail_out; Q_ASSERT(zs.avail_out > 0); |