tst_QByteArray: fix custom QCOMPARE for QBAs > 2GiB

The tst_QByteArray test redefines the QCOMPARE macro to check the LHS
to be NUL-terminated. Because the code was never ported from int to
qsizetype, it fails for QByteArrays of size > 2GiB.

Fix by porting to qsizetype.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104985
Change-Id: Ib3951b0efed5f734ae1324ea2d455bb7762fb9c4
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2022-07-14 18:01:42 +02:00
parent 638893bea0
commit cb9715557c

View File

@ -150,7 +150,7 @@ QByteArray verifyZeroTermination(const QByteArray &ba)
if (!baDataPtr->isMutable())
return ba;
int baSize = ba.size();
qsizetype baSize = ba.size();
char baTerminator = ba.constData()[baSize];
if ('\0' != baTerminator)
return QString::fromUtf8(