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 <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Mårten Nordheim 2022-10-28 13:43:13 +02:00
parent 703ac911f9
commit c4cb464d74

View File

@ -620,7 +620,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);