diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-12-17 15:12:45 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-12-18 12:45:30 +0100 |
commit | b8c2a0c18a0676595946b5543ff88492a5fc7876 (patch) | |
tree | 9ef037cf2bfa7ae1346f4c3b512105ea3d9bc808 /src/tools/moc | |
parent | 5a0dcda171772e75eeb22f719cec36ef8efe355d (diff) |
QtMiscUtils: add missing toAsciiUpper(), use it in moc
... to make moc code locale-independent.
The C toupper function is 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.
Fix by adding QtMiscTools::toAsciiUpper(), complementing existing
toAsciiLower(), and using that. It's private API, but moc.h, despite
the name, is not a public header.
Pick-to: 6.5 6.4 6.2 5.15
Task-number: QTBUG-109235
Change-Id: Iaf071ba2113b672aa0aed3da6a4e1d47fb659365
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/tools/moc')
-rw-r--r-- | src/tools/moc/moc.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 843a684bda..af2a95c391 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -13,7 +13,8 @@ #include <qjsonobject.h> #include <qversionnumber.h> #include <stdio.h> -#include <ctype.h> + +#include <private/qtools_p.h> QT_BEGIN_NAMESPACE @@ -102,7 +103,7 @@ struct PropertyDef { bool stdCppSet() const { QByteArray s("set"); - s += toupper(name[0]); + s += QtMiscUtils::toAsciiUpper(name[0]); s += name.mid(1); return (s == write); } |