From e18f1b40b23352d09269f7451711529df1277653 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 15 Jul 2019 12:20:44 +0200 Subject: Fix compilation with explicit QChar(*int*) ctors The QChar ctors from integral non-char types are under consideration for adding explicit. Fix users of these ctors ahead of the change. Change-Id: I3f3480336ba30a368034bb15b67ada854115e374 Reviewed-by: Volker Hilsheimer --- tools/qscxmlc/scxmlcppdumper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/qscxmlc') diff --git a/tools/qscxmlc/scxmlcppdumper.cpp b/tools/qscxmlc/scxmlcppdumper.cpp index 89a403b..4f62039 100644 --- a/tools/qscxmlc/scxmlcppdumper.cpp +++ b/tools/qscxmlc/scxmlcppdumper.cpp @@ -676,11 +676,11 @@ QString CppDumper::mangleIdentifier(const QString &str) } for (int ei = str.length(); i != ei; ++i) { - auto c = str.at(i).unicode(); + auto c = str.at(i); if ((c >= QLatin1Char('0') && c <= QLatin1Char('9')) || isNonDigit(c)) { mangled += c; } else { - mangled += QLatin1String("_0x") + QString::number(c, 16) + QLatin1Char('_'); + mangled += QLatin1String("_0x") + QString::number(c.unicode(), 16) + QLatin1Char('_'); } } -- cgit v1.2.3 From 279d63c4f6632237e6a0d9c4be91b466876c260a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 15 Jul 2019 12:38:32 +0200 Subject: Eradicate the last Q_FOREACHs and mark the module clean ... of Q_FOREACH, Java-style iterators, and QLinkedList use. Change-Id: Iec6c576e8c7aba81594e3d3e6c4d1e1cc487fbdf Reviewed-by: Volker Hilsheimer --- tools/qscxmlc/generator.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tools/qscxmlc') diff --git a/tools/qscxmlc/generator.cpp b/tools/qscxmlc/generator.cpp index ea3a066..6febf09 100644 --- a/tools/qscxmlc/generator.cpp +++ b/tools/qscxmlc/generator.cpp @@ -172,7 +172,7 @@ bool Generator::registerableMetaType(const QByteArray &propertyType) #undef STREAM_SMART_POINTER ; - foreach (const QByteArray &smartPointer, smartPointers) + for (const QByteArray &smartPointer : smartPointers) if (propertyType.startsWith(smartPointer + "<") && !propertyType.endsWith("&")) return knownQObjectClasses.contains(propertyType.mid(smartPointer.size() + 1, propertyType.size() - smartPointer.size() - 1 - 1)); @@ -181,7 +181,7 @@ bool Generator::registerableMetaType(const QByteArray &propertyType) QT_FOR_EACH_AUTOMATIC_TEMPLATE_1ARG(STREAM_1ARG_TEMPLATE) #undef STREAM_1ARG_TEMPLATE ; - foreach (const QByteArray &oneArgTemplateType, oneArgTemplates) + for (const QByteArray &oneArgTemplateType : oneArgTemplates) if (propertyType.startsWith(oneArgTemplateType + "<") && propertyType.endsWith(">")) { const int argumentSize = propertyType.size() - oneArgTemplateType.size() - 1 // The closing '>' @@ -1202,8 +1202,8 @@ void Generator::generateStaticMetacall() fprintf(out, " case %d:\n", it.key()); fprintf(out, " switch (*reinterpret_cast(_a[1])) {\n"); fprintf(out, " default: *reinterpret_cast(_a[0]) = -1; break;\n"); - foreach (const QByteArray &key, it->uniqueKeys()) { - foreach (int argumentID, it->values(key)) + for (const QByteArray &key : it->uniqueKeys()) { + for (int argumentID : it->values(key)) fprintf(out, " case %d:\n", argumentID); fprintf(out, " *reinterpret_cast(_a[0]) = qRegisterMetaType< %s >(); break;\n", key.constData()); } @@ -1268,8 +1268,8 @@ void Generator::generateStaticMetacall() fprintf(out, "if (_c == QMetaObject::RegisterPropertyMetaType) {\n"); fprintf(out, " switch (_id) {\n"); fprintf(out, " default: *reinterpret_cast(_a[0]) = -1; break;\n"); - foreach (const QByteArray &key, automaticPropertyMetaTypes.uniqueKeys()) { - foreach (int propertyID, automaticPropertyMetaTypes.values(key)) + for (const QByteArray &key : automaticPropertyMetaTypes.uniqueKeys()) { + for (int propertyID : automaticPropertyMetaTypes.values(key)) fprintf(out, " case %d:\n", propertyID); fprintf(out, " *reinterpret_cast(_a[0]) = qRegisterMetaType< %s >(); break;\n", key.constData()); } @@ -1593,8 +1593,8 @@ void Generator::generatePluginMetaData() data.insert(QStringLiteral("MetaData"), cdef->pluginData.metaData.object()); // Add -M args from the command line: - foreach (const QString &key, cdef->pluginData.metaArgs.keys()) - data.insert(key, cdef->pluginData.metaArgs.value(key)); + for (auto it = cdef->pluginData.metaArgs.cbegin(), end = cdef->pluginData.metaArgs.cend(); it != end; ++it) + data.insert(it.key(), it.value()); fputs("\nQT_PLUGIN_METADATA_SECTION const uint qt_section_alignment_dummy = 42;\n\n" "#ifdef QT_NO_DEBUG\n", out); -- cgit v1.2.3