diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-08-11 15:32:23 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-08-12 07:53:58 +0200 |
commit | 48c8072bb8862b442170687a9a5f8780332c39b5 (patch) | |
tree | 0c2f3ba3ff9682f923cdea537351b4e1129048ef /src/corelib | |
parent | eb55e2980efc435f8728838910272e32287a841d (diff) |
Finish porting cross-platform parts of QStringConverter to qsizetype/size_t
There are still problems with platforms-specific APIs that are 32-bit
only (cf. QTBUG-105105), but this patch finishes the port of the
cross-platform parts of QStringConverter.
None of these changes have a user-visible effect. They just avoid the
Code Smell that int has become since Qt 6.0.
Pick-to: 6.4
Task-number: QTBUG-103531
Change-Id: I267e2e1268a18c130892fa2fd80d1b5dabb3d9b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/text/qstringconverter.cpp | 4 | ||||
-rw-r--r-- | src/corelib/text/qstringconverter_base.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp index 80523bd809..443dc8fce9 100644 --- a/src/corelib/text/qstringconverter.cpp +++ b/src/corelib/text/qstringconverter.cpp @@ -1990,7 +1990,7 @@ const char *QStringConverter::name() const noexcept */ std::optional<QStringConverter::Encoding> QStringConverter::encodingForName(const char *name) noexcept { - for (int i = 0; i < LastEncoding + 1; ++i) { + for (qsizetype i = 0; i < LastEncoding + 1; ++i) { if (nameMatch(encodingInterfaces[i].name, name)) return QStringConverter::Encoding(i); } @@ -2058,7 +2058,7 @@ static QByteArray parseHtmlMetaForEncoding(QByteArrayView data) if (pos != -1) { pos = charsetSearcher.indexIn(header, pos); if (pos != -1) { - pos += int(qstrlen("charset=")); + pos += qstrlen("charset="); if (pos < header.size() && (header.at(pos) == '\"' || header.at(pos) == '\'')) ++pos; diff --git a/src/corelib/text/qstringconverter_base.h b/src/corelib/text/qstringconverter_base.h index 68900da8f0..bf464cbb6f 100644 --- a/src/corelib/text/qstringconverter_base.h +++ b/src/corelib/text/qstringconverter_base.h @@ -129,7 +129,7 @@ protected: : iface(nullptr) {} constexpr explicit QStringConverter(Encoding encoding, Flags f) - : iface(&encodingInterfaces[int(encoding)]), state(f) + : iface(&encodingInterfaces[qsizetype(encoding)]), state(f) {} constexpr explicit QStringConverter(const Interface *i) noexcept : iface(i) |