summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstring.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-08-11 14:50:46 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-08-12 02:42:27 +0200
commit32c0d32a4fef615a717d4950361dce361fc1e08b (patch)
tree326c9a3e24683b901eddd4280d64b604a7a520b5 /src/corelib/text/qstring.cpp
parent1f9c1f032c5d8af2c6758081eb8de076fe678b53 (diff)
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 Pick-to: 6.4 6.3 Change-Id: I6f4593a86d8d605031bc1d6520a247676091b2c2 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/text/qstring.cpp')
-rw-r--r--src/corelib/text/qstring.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 029e3b8325..f8d38c5876 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -8012,9 +8012,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
};
@@ -8107,7 +8107,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();