From cd0f6968916739795b47597b1e00ea87d577fa15 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 20 Jul 2022 22:40:29 +0200 Subject: [PATCH] QString: finish migration to qsizetype These don't look like they could cause bugs, because their range of values is physically limited, but port them to qsizetype nonetheless, for consistency, and to save the next reader the task of proving that they're, indeed, ok. Pick-to: 6.4 Task-number: QTBUG-103531 Change-Id: I337ea327b54bcf5960928f5d1d72c6fc80dcda31 Reviewed-by: Sona Kurazyan Reviewed-by: Thiago Macieira --- src/corelib/text/qstring.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index f8d38c5876..20de51def5 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -493,8 +493,8 @@ const char16_t *QtPrivate::qustrchr(QStringView str, char16_t c) noexcept } return UnrollTailLoop<3>::exec(e - n, e, - [=](int i) { return n[i] == c; }, - [=](int i) { return n + i; }); + [=](qsizetype i) { return n[i] == c; }, + [=](qsizetype i) { return n + i; }); # endif #elif defined(__ARM_NEON__) const uint16x8_t vmask = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7 }; @@ -812,7 +812,7 @@ Q_CORE_EXPORT void qt_from_latin1(char16_t *dst, const char *str, size_t size) n dst += offset; str += offset; # if !defined(__OPTIMIZE_SIZE__) - return UnrollTailLoop<7>::exec(int(size), [=](int i) { dst[i] = (uchar)str[i]; }); + return UnrollTailLoop<7>::exec(qsizetype(size), [=](qsizetype i) { dst[i] = (uchar)str[i]; }); # endif #endif #if defined(__mips_dsp) @@ -939,7 +939,7 @@ static void qt_to_latin1_internal(uchar *dst, const char16_t *src, qsizetype len src += offset; # if !defined(__OPTIMIZE_SIZE__) - return UnrollTailLoop<3>::exec(length, [=](int i) { + return UnrollTailLoop<3>::exec(length, [=](qsizetype i) { if (Checked) dst[i] = (src[i]>0xff) ? '?' : (uchar) src[i]; else