diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-12-17 17:45:41 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-01-03 15:09:53 +0000 |
commit | 7fab0c0feeb3360b14c984f16061b69495179fc6 (patch) | |
tree | dd0e2556c68d01be9b8c374d5770ef14c3e10865 | |
parent | f3a153c361c1c5ac0ade8a84bd513f5dbe0eac50 (diff) |
QQmlPropertyCache: don't depend on locale for toupper
The C toupper/tolower functions are locale-dependent. Given the right
locale (Türkiye, e.g.), toupper(i) is either
- İ (LATIN CAPITAL LETTER I WITH DOT ABOVE; if representable) or
- i (unchanged; if it isn't)
Both results are wrong for the present use-case. Use the new
QtMiscUtils::toAsciiUpper() function instead.
Amends d481f2ff518df1e44103d1850e7d52bd69260c34.
Task-number: QTBUG-109235
Change-Id: Ib66593fc7eff3edc0cc16291ca3eae8bdf0dd8ed
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 179200d2a3fa0df28fbf3790f8ff1ee47d0926c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 6c725eb2dc..231c2f9ae8 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -51,8 +51,8 @@ #include <QtCore/qdebug.h> #include <QtCore/QCryptographicHash> +#include <QtCore/private/qtools_p.h> -#include <ctype.h> // for toupper #include <limits.h> #include <algorithm> @@ -527,7 +527,7 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, QVarLengthArray<char, 128> str(length+3); str[0] = 'o'; str[1] = 'n'; - str[2] = toupper(rawName[0]); + str[2] = QtMiscUtils::toAsciiUpper(rawName[0]); if (length > 1) memcpy(&str[3], &rawName[1], length - 1); str[length + 2] = '\0'; |