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.

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>
(cherry picked from commit cb9715557c414d5b3c90165cc8fc710fbdcdba77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-07-14 18:01:42 +02:00 committed by Qt Cherry-pick Bot
parent 8107ff3971
commit bf53992d82

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(