diff options
| author | Marc Mutz <[email protected]> | 2025-10-16 11:17:20 +0200 |
|---|---|---|
| committer | Marc Mutz <[email protected]> | 2025-10-19 18:25:11 +0200 |
| commit | 3eab7aca75fc44677e6b3f0e050b8f3ea174d0bd (patch) | |
| tree | c5ef7f18e1864886ae43e6f6ba808af996c38444 /src | |
| parent | 59259fdc7362035889c075b5071c355ae41672f1 (diff) | |
QChar: remove confusing foldCase(ch, ch&) overload
For years, I've been confused by the various foldCase() overloads,
until Clang 21 -Wcharacter-conversion now forced me down the rabbit
hole.
Turns out that there's just one user of the ch,ch& overload and it's
readily ported to the ch*,ch* overload, so do that and remove the
now-unused overload.
Amends the start of the public history.
Pick-to: 6.10 6.8 6.5
Change-Id: I8ddd22b08423540f58c1a5fe0ef36c93c8b337f1
Reviewed-by: Ahmad Samir <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/corelib/text/qchar.cpp | 9 | ||||
| -rw-r--r-- | src/corelib/text/qstring.cpp | 4 |
2 files changed, 1 insertions, 12 deletions
diff --git a/src/corelib/text/qchar.cpp b/src/corelib/text/qchar.cpp index f2bc22c421a..4b89f67d276 100644 --- a/src/corelib/text/qchar.cpp +++ b/src/corelib/text/qchar.cpp @@ -1688,15 +1688,6 @@ static inline char32_t foldCase(const char16_t *cur, const char16_t *start) return convertCase_helper(ucs4, QUnicodeTables::CaseFold); } -static inline char32_t foldCase(char16_t ch, char16_t &last) noexcept -{ - char32_t ucs4 = ch; - if (QChar::isLowSurrogate(ch) && QChar::isHighSurrogate(last)) - ucs4 = QChar::surrogateToUcs4(last, ch); - last = ch; - return convertCase_helper(ucs4, QUnicodeTables::CaseFold); -} - static inline char16_t foldCase(char16_t ch) noexcept { return convertCase_helper(ch, QUnicodeTables::CaseFold); diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 615cf3e6752..46c01bf232a 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -1197,15 +1197,13 @@ Q_NEVER_INLINE static int ucstricmp(qsizetype alen, const char16_t *a, qsizetype if (a == b) return qt_lencmp(alen, blen); - char16_t alast = 0; - char16_t blast = 0; qsizetype l = qMin(alen, blen); qsizetype i; for (i = 0; i < l; ++i) { // qDebug() << Qt::hex << alast << blast; // qDebug() << Qt::hex << "*a=" << *a << "alast=" << alast << "folded=" << foldCase (*a, alast); // qDebug() << Qt::hex << "*b=" << *b << "blast=" << blast << "folded=" << foldCase (*b, blast); - int diff = foldCase(a[i], alast) - foldCase(b[i], blast); + int diff = foldCase(a + i, a) - foldCase(b + i, b); if ((diff)) return diff; } |
