Fix stringish::simplified() for strings > 2Gi characters

If, after simplification, the result string would have been >2Gi
characters in length, the code returned a shorter string, truncated
mod INT_MAX, because the algorithm had not been ported to qsizetype.

Task-number: QTBUG-103531
Change-Id: I57cfed34e5c69406f8d3f2913962d006b4bc6bd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ec35efd7f2cea4dcbe0188f0d44cde541803f53e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-07-20 22:43:20 +02:00 committed by Qt Cherry-pick Bot
parent 971e382bed
commit 431d508216

View File

@ -101,7 +101,7 @@ template <typename StringType> struct QStringAlgorithms
if (ptr != dst && ptr[-1] == QChar::Space)
--ptr;
int newlen = ptr - dst;
qsizetype newlen = ptr - dst;
if (isConst && newlen == str.size() && unmodified) {
// nothing happened, return the original
return str;