summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-12-20 12:27:49 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-12-23 20:27:44 +0000
commit2ca4077753698a9ff14b84165b7195d6d0a4a52a (patch)
tree7b1d261a3e1a2c440b4d973b742f515124a03f69
parente500e5af6886f7679ee4090c7459a107d20508ac (diff)
Port from <cctype> toupper() to QtMiscUtils::toAsciiUpper()
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 use-cases at hand. Task-number: QTBUG-109235 Change-Id: Ia9726f0079c5f2625d97a341836b3d4505db6be1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> (cherry picked from commit 09b4615abcdbef7087bb9862a3e73f3bb7930768) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/activeqt/container/qaxbase.cpp5
-rw-r--r--src/activeqt/container/qaxdump.cpp5
-rw-r--r--tools/dumpcpp/moc.cpp4
3 files changed, 9 insertions, 5 deletions
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index d035d00..4ef6b34 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -78,6 +78,7 @@
#include <private/qobject_p.h>
#include <private/qmetaobject_p.h>
#include <private/qmetaobjectbuilder_p.h>
+#include <private/qtools_p.h>
#include <qt_windows.h>
#include <ocidl.h>
@@ -2288,7 +2289,7 @@ void MetaObjectGenerator::addSetterSlot(const QByteArray &property)
if (isupper(prototype.at(0))) {
prototype.insert(0, "Set");
} else {
- prototype[0] = char(toupper(prototype[0]));
+ prototype[0] = QtMiscUtils::toAsciiUpper(prototype[0]);
prototype.insert(0, "set");
}
const QByteArray type = propertyType(property);
@@ -2486,7 +2487,7 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs)
set = "Set";
} else {
set = "set";
- prototype[0] = char(toupper(prototype[0]));
+ prototype[0] = QtMiscUtils::toAsciiUpper(prototype[0]);
}
prototype = set + prototype;
diff --git a/src/activeqt/container/qaxdump.cpp b/src/activeqt/container/qaxdump.cpp
index 1265fe1..9aa2371 100644
--- a/src/activeqt/container/qaxdump.cpp
+++ b/src/activeqt/container/qaxdump.cpp
@@ -57,6 +57,7 @@
#include <qt_windows.h>
#include <qtextstream.h>
#include <qiodevicebase.h>
+#include <private/qtools_p.h>
#include <ctype.h>
@@ -125,7 +126,7 @@ static QByteArray toType(const QByteArray &t)
if (type.at(0) == 'Q')
type.remove(0, 1);
- type[0] = toupper(type.at(0));
+ type[0] = QtMiscUtils::toAsciiLower(type.at(0));
if (type == "VariantList")
type = "List";
else if (type == "Map<QVariant,QVariant>")
@@ -363,7 +364,7 @@ QString qax_generateDocumentation(QAxBase *that)
setterSlot = "Set" + name;
} else {
QByteArray nameUp = name;
- nameUp[0] = char(toupper(nameUp.at(0)));
+ nameUp[0] = QtMiscUtils::toAsciiUpper(nameUp.at(0));
setterSlot = "set" + nameUp;
}
detail += QLatin1String("<a href=\"#") + QString::fromLatin1(setterSlot) + QLatin1String("\">") +
diff --git a/tools/dumpcpp/moc.cpp b/tools/dumpcpp/moc.cpp
index 6760089..4cc9074 100644
--- a/tools/dumpcpp/moc.cpp
+++ b/tools/dumpcpp/moc.cpp
@@ -35,6 +35,8 @@
#include <QTemporaryFile>
#include <QTextStream>
+#include <private/qtools_p.h>
+
QT_BEGIN_NAMESPACE
QByteArray setterName(const QByteArray &propertyName)
@@ -43,7 +45,7 @@ QByteArray setterName(const QByteArray &propertyName)
if (isupper(setter.at(0))) {
setter = "Set" + setter;
} else {
- setter[0] = char(toupper(setter[0]));
+ setter[0] = QtMiscUtils::toAsciiUpper(setter[0]);
setter = "set" + setter;
}
return setter;