diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 536c5c3be5..85df96c7d8 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -668,7 +668,7 @@ QString qt_readEscapedFormatString(QStringView format, int *idx) qt_repeatCount(u"aab"); // == 2 \endcode */ -int qt_repeatCount(QStringView s) +qsizetype qt_repeatCount(QStringView s) { if (s.isEmpty()) return 0; @@ -676,7 +676,7 @@ int qt_repeatCount(QStringView s) qsizetype j = 1; while (j < s.size() && s.at(j) == c) ++j; - return int(j); + return j; } Q_CONSTINIT static const QLocaleData *default_data = nullptr; @@ -3333,7 +3333,7 @@ QString QCalendarBackend::dateTimeToString(QStringView format, const QDateTime & } const QChar c = format.at(i); - int repeat = qt_repeatCount(format.mid(i)); + qsizetype repeat = qt_repeatCount(format.mid(i)); bool used = false; if (formatDate) { switch (c.unicode()) { diff --git a/src/corelib/text/qlocale_mac.mm b/src/corelib/text/qlocale_mac.mm index 67f8039309..7ed7c34f3b 100644 --- a/src/corelib/text/qlocale_mac.mm +++ b/src/corelib/text/qlocale_mac.mm @@ -267,7 +267,7 @@ static QVariant macToQtFormat(QStringView sys_fmt) } QChar c = sys_fmt.at(i); - int repeat = qt_repeatCount(sys_fmt.mid(i)); + qsizetype repeat = qt_repeatCount(sys_fmt.mid(i)); switch (c.unicode()) { // Qt does not support the following options diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index e00b3c78bd..a2a48b9290 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -479,7 +479,7 @@ inline char QLocaleData::numericToCLocale(QStringView in) const QString qt_readEscapedFormatString(QStringView format, int *idx); [[nodiscard]] bool qt_splitLocaleName(QStringView name, QStringView *lang = nullptr, QStringView *script = nullptr, QStringView *cntry = nullptr); -[[nodiscard]] int qt_repeatCount(QStringView s); +[[nodiscard]] qsizetype qt_repeatCount(QStringView s); enum { AsciiSpaceMask = (1u << (' ' - 1)) | (1u << ('\t' - 1)) | // 9: HT - horizontal tab diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index f97d910451..f67965539b 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -729,7 +729,7 @@ QString QSystemLocalePrivate::winToQtFormat(QStringView sys_fmt) } QChar c = sys_fmt.at(i); - int repeat = qt_repeatCount(sys_fmt.mid(i)); + qsizetype repeat = qt_repeatCount(sys_fmt.mid(i)); switch (c.unicode()) { // Date