From c4cb464d74fb703d20b1bf53b3738531f92feae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 28 Oct 2022 13:43:13 +0200 Subject: [PATCH] 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 Pick-to: 6.4 6.2 Change-Id: I0dd40c875b1a61a64f0574f0209a8549fc73164a Reviewed-by: Thiago Macieira Reviewed-by: Marc Mutz --- src/corelib/text/qbytearray.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index fab386ba5d..a696cb8dbb 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -620,7 +620,8 @@ static QByteArray xxflate(ZLibOp op, QArrayDataPointer out, QByteArrayView avail_out = capacity - out.size; } zs.next_out = reinterpret_cast(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);