QString: fix arg() for >2Gi repeated lowest-escape-sequence-numbers

Building on 15a80cf8a9d59203f8e2b436a5c804197c044807, this patch fixes
the case where there are more than INT_MAX occurrences of the
lowest-escape-sequence number, as in

   QString("%0").repeated(qsizetype(INT_MAX) + 1).arg(42);

by replacing the corresponding int variables with qsizetype ones.

Task-number: QTBUG-103531
Change-Id: I6f4593a86d8d605031bc1d6520a247676091b2c2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 32c0d32a4fef615a717d4950361dce361fc1e08b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-08-11 14:50:46 +02:00 committed by Qt Cherry-pick Bot
parent d0d845644b
commit d902a16454

View File

@ -7947,9 +7947,9 @@ static void checkArgEscape(QStringView s)
struct ArgEscapeData
{
int min_escape; // lowest escape sequence number
int occurrences; // number of occurrences of the lowest escape sequence number
int locale_occurrences; // number of occurrences of the lowest escape sequence number that
// contain 'L'
qsizetype occurrences; // number of occurrences of the lowest escape sequence number
qsizetype locale_occurrences; // number of occurrences of the lowest escape sequence number that
// contain 'L'
qsizetype escape_len; // total length of escape sequences which will be replaced
};
@ -8042,7 +8042,7 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, qsizetyp
QString result(result_len, Qt::Uninitialized);
QChar *rc = const_cast<QChar *>(result.unicode());
QChar *const result_end = rc + result_len;
int repl_cnt = 0;
qsizetype repl_cnt = 0;
const QChar *c = s.begin();
const QChar *const uc_end = s.end();