diff --git a/src/libs/advanceddockingsystem/dockcontainerwidget.cpp b/src/libs/advanceddockingsystem/dockcontainerwidget.cpp index 1b0af0dcf88..3b75ece3197 100644 --- a/src/libs/advanceddockingsystem/dockcontainerwidget.cpp +++ b/src/libs/advanceddockingsystem/dockcontainerwidget.cpp @@ -728,11 +728,11 @@ namespace ADS while (stateReader.readNextStartElement()) { QWidget *childNode = nullptr; bool result = true; - if (stateReader.name() == "splitter") { + if (stateReader.name() == QLatin1String("splitter")) { result = restoreSplitter(stateReader, childNode, testing); - } else if (stateReader.name() == "area") { + } else if (stateReader.name() == QLatin1String("area")) { result = restoreDockArea(stateReader, childNode, testing); - } else if (stateReader.name() == "sizes") { + } else if (stateReader.name() == QLatin1String("sizes")) { QString size = stateReader.readElementText().trimmed(); qCInfo(adsLog) << "Size: " << size; QTextStream textStream(&size); @@ -797,7 +797,7 @@ namespace ADS dockArea = new DockAreaWidget(m_dockManager, q); while (stateReader.readNextStartElement()) { - if (stateReader.name() != "widget") + if (stateReader.name() != QLatin1String("widget")) continue; auto objectName = stateReader.attributes().value("name"); @@ -849,10 +849,10 @@ namespace ADS { bool result = true; while (stateReader.readNextStartElement()) { - if (stateReader.name() == "splitter") { + if (stateReader.name() == QLatin1String("splitter")) { result = restoreSplitter(stateReader, createdWidget, testing); qCInfo(adsLog) << "Splitter"; - } else if (stateReader.name() == "area") { + } else if (stateReader.name() == QLatin1String("area")) { result = restoreDockArea(stateReader, createdWidget, testing); qCInfo(adsLog) << "DockAreaWidget"; } else { @@ -1302,7 +1302,7 @@ namespace ADS if (isFloating) { qCInfo(adsLog) << "Restore floating widget"; - if (!stateReader.readNextStartElement() || stateReader.name() != "geometry") + if (!stateReader.readNextStartElement() || stateReader.name() != QLatin1String("geometry")) return false; QByteArray geometryString = stateReader diff --git a/src/libs/advanceddockingsystem/dockmanager.cpp b/src/libs/advanceddockingsystem/dockmanager.cpp index a7d0653863a..eee95049f20 100644 --- a/src/libs/advanceddockingsystem/dockmanager.cpp +++ b/src/libs/advanceddockingsystem/dockmanager.cpp @@ -191,7 +191,7 @@ namespace ADS if (!stateReader.readNextStartElement()) return false; - if (stateReader.name() != "QtAdvancedDockingSystem") + if (stateReader.name() != QLatin1String("QtAdvancedDockingSystem")) return false; qCInfo(adsLog) << stateReader.attributes().value("version"); @@ -219,7 +219,7 @@ namespace ADS #endif int dockContainerCount = 0; while (stateReader.readNextStartElement()) { - if (stateReader.name() == "container") { + if (stateReader.name() == QLatin1String("container")) { result = restoreContainer(dockContainerCount, stateReader, testing); if (!result) break; diff --git a/src/plugins/autotest/catch/catchoutputreader.cpp b/src/plugins/autotest/catch/catchoutputreader.cpp index 760d5214cb2..4a46c7722ce 100644 --- a/src/plugins/autotest/catch/catchoutputreader.cpp +++ b/src/plugins/autotest/catch/catchoutputreader.cpp @@ -143,16 +143,16 @@ void CatchOutputReader::processOutputLine(const QByteArray &outputLineWithNewLin case QXmlStreamReader::EndElement: { const auto currentTag = m_xmlReader.name(); - if (currentTag == CatchXml::SectionElement) { + if (currentTag == QLatin1String(CatchXml::SectionElement)) { sendResult(ResultType::TestEnd); testOutputNodeFinished(SectionNode); - } else if (currentTag == CatchXml::TestCaseElement) { + } else if (currentTag == QLatin1String(CatchXml::TestCaseElement)) { sendResult(ResultType::TestEnd); testOutputNodeFinished(TestCaseNode); - } else if (currentTag == CatchXml::GroupElement) { + } else if (currentTag == QLatin1String(CatchXml::GroupElement)) { testOutputNodeFinished(GroupNode); - } else if (currentTag == CatchXml::ExpressionElement - || currentTag == CatchXml::BenchmarkResults) { + } else if (currentTag == QLatin1String(CatchXml::ExpressionElement) + || currentTag == QLatin1String(CatchXml::BenchmarkResults)) { sendResult(m_currentResult); m_currentExpression.clear(); m_testCaseInfo.pop(); diff --git a/src/plugins/baremetal/debugservers/uvsc/uvtargetdevicemodel.cpp b/src/plugins/baremetal/debugservers/uvsc/uvtargetdevicemodel.cpp index c8bf0fdea66..0fbf6ffdecb 100644 --- a/src/plugins/baremetal/debugservers/uvsc/uvtargetdevicemodel.cpp +++ b/src/plugins/baremetal/debugservers/uvsc/uvtargetdevicemodel.cpp @@ -249,7 +249,7 @@ void DeviceSelectionModel::parsePackage(const QString &packageFile) QXmlStreamReader in(&f); while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == "package") + if (elementName == QLatin1String("package")) parsePackage(in, packageFile); else in.skipCurrentElement(); @@ -265,18 +265,18 @@ void DeviceSelectionModel::parsePackage(QXmlStreamReader &in, const QString &pac child->version = extractPackVersion(packageFile); while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == "name") { + if (elementName == QLatin1String("name")) { fillElementProperty(in, child->name); - } else if (elementName == "description") { + } else if (elementName == QLatin1String("description")) { fillElementProperty(in, child->desc); - } else if (elementName == "vendor") { + } else if (elementName == QLatin1String("vendor")) { fillVendor(in, child->vendorName, child->vendorId); - } else if (elementName == "url") { + } else if (elementName == QLatin1String("url")) { fillElementProperty(in, child->url); - } else if (elementName == "devices") { + } else if (elementName == QLatin1String("devices")) { while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == "family") + if (elementName == QLatin1String("family")) parseFamily(in, child); else in.skipCurrentElement(); @@ -297,17 +297,17 @@ void DeviceSelectionModel::parseFamily(QXmlStreamReader &in, DeviceSelectionItem fillVendor(attrs.value("Dvendor").toString(), child->vendorName, child->vendorId); while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == "processor") { + if (elementName == QLatin1String("processor")) { fillCpu(in, child->cpu); - } else if (elementName == "algorithm") { + } else if (elementName == QLatin1String("algorithm")) { fillAlgorithms(in, child->algorithms); - } else if (elementName == "memory") { + } else if (elementName == QLatin1String("memory")) { fillMemories(in, child->memories); - } else if (elementName == "description") { + } else if (elementName == QLatin1String("description")) { fillElementProperty(in, child->desc); - } else if (elementName == "subFamily") { + } else if (elementName == QLatin1String("subFamily")) { parseSubFamily(in, child); - } else if (elementName == "device") { + } else if (elementName == QLatin1String("device")) { parseDevice(in, child); } else { in.skipCurrentElement(); @@ -324,11 +324,11 @@ void DeviceSelectionModel::parseSubFamily(QXmlStreamReader &in, DeviceSelectionI child->name = attrs.value("DsubFamily").toString(); while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == "processor") { + if (elementName == QLatin1String("processor")) { fillCpu(in, child->cpu); - } else if (elementName == "debug") { + } else if (elementName == QLatin1String("debug")) { fillSvd(in, child->svd); - } else if (elementName == "device") { + } else if (elementName == QLatin1String("device")) { parseDevice(in, child); } else { in.skipCurrentElement(); @@ -345,17 +345,17 @@ void DeviceSelectionModel::parseDevice(QXmlStreamReader &in, DeviceSelectionItem child->name = attrs.value("Dname").toString(); while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == "processor") { + if (elementName == QLatin1String("processor")) { fillCpu(in, child->cpu); - } else if (elementName == "debug") { + } else if (elementName == QLatin1String("debug")) { fillSvd(in, child->svd); - } else if (elementName == "description") { + } else if (elementName == QLatin1String("description")) { fillElementProperty(in, child->desc); - } else if (elementName == "memory") { + } else if (elementName == QLatin1String("memory")) { fillMemories(in, child->memories); - } else if (elementName == "algorithm") { + } else if (elementName == QLatin1String("algorithm")) { fillAlgorithms(in, child->algorithms); - } else if (elementName == "variant") { + } else if (elementName == QLatin1String("variant")) { parseDeviceVariant(in, child); } else { in.skipCurrentElement(); @@ -372,11 +372,11 @@ void DeviceSelectionModel::parseDeviceVariant(QXmlStreamReader &in, DeviceSelect child->name = attrs.value("Dvariant").toString(); while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == "processor") { + if (elementName == QLatin1String("processor")) { fillCpu(in, child->cpu); - } else if (elementName == "memory") { + } else if (elementName == QLatin1String("memory")) { fillMemories(in, child->memories); - } else if (elementName == "algorithm") { + } else if (elementName == QLatin1String("algorithm")) { fillAlgorithms(in, child->algorithms); } else { in.skipCurrentElement(); diff --git a/src/plugins/beautifier/abstractsettings.cpp b/src/plugins/beautifier/abstractsettings.cpp index 3c65322bc13..3d9bc75b1a5 100644 --- a/src/plugins/beautifier/abstractsettings.cpp +++ b/src/plugins/beautifier/abstractsettings.cpp @@ -319,7 +319,7 @@ void AbstractSettings::readDocumentation() QXmlStreamReader xml(&file); if (!xml.readNextStartElement()) return; - if (xml.name() != Constants::DOCUMENTATION_XMLROOT) { + if (xml.name() != QLatin1String(Constants::DOCUMENTATION_XMLROOT)) { BeautifierPlugin::showError(tr("The file \"%1\" is not a valid documentation file.") .arg(filename)); return; diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp index 8994686cace..1f46b9d6c33 100644 --- a/src/plugins/coreplugin/externaltool.cpp +++ b/src/plugins/coreplugin/externaltool.cpp @@ -352,11 +352,11 @@ static void localizedText(const QStringList &locales, QXmlStreamReader *reader, static bool parseOutputAttribute(const QString &attribute, QXmlStreamReader *reader, ExternalTool::OutputHandling *value) { const auto output = reader->attributes().value(attribute); - if (output == kOutputShowInPane) { + if (output == QLatin1String(kOutputShowInPane)) { *value = ExternalTool::ShowInPane; - } else if (output == kOutputReplaceSelection) { + } else if (output == QLatin1String(kOutputReplaceSelection)) { *value = ExternalTool::ReplaceSelection; - } else if (output == kOutputIgnore) { + } else if (output == QLatin1String(kOutputIgnore)) { *value = ExternalTool::Ignore; } else { reader->raiseError("Allowed values for output attribute are 'showinpane','replaceselection','ignore'"); @@ -374,19 +374,19 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error auto tool = new ExternalTool; QXmlStreamReader reader(xml); - if (!reader.readNextStartElement() || reader.name() != kExternalTool) + if (!reader.readNextStartElement() || reader.name() != QLatin1String(kExternalTool)) reader.raiseError("Missing start element "); tool->m_id = reader.attributes().value(kId).toString(); if (tool->m_id.isEmpty()) reader.raiseError("Missing or empty id attribute for "); while (reader.readNextStartElement()) { - if (reader.name() == kDescription) { + if (reader.name() == QLatin1String(kDescription)) { localizedText(locales, &reader, &descriptionLocale, &tool->m_description); - } else if (reader.name() == kDisplayName) { + } else if (reader.name() == QLatin1String(kDisplayName)) { localizedText(locales, &reader, &nameLocale, &tool->m_displayName); - } else if (reader.name() == kCategory) { + } else if (reader.name() == QLatin1String(kCategory)) { localizedText(locales, &reader, &categoryLocale, &tool->m_displayCategory); - } else if (reader.name() == kOrder) { + } else if (reader.name() == QLatin1String(kOrder)) { if (tool->m_order >= 0) { reader.raiseError("only one element allowed"); break; @@ -395,7 +395,7 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error tool->m_order = reader.readElementText().toInt(&ok); if (!ok || tool->m_order < 0) reader.raiseError(" element requires non-negative integer value"); - } else if (reader.name() == kExecutable) { + } else if (reader.name() == QLatin1String(kExecutable)) { if (reader.attributes().hasAttribute(kOutput)) { if (!parseOutputAttribute(kOutput, &reader, &tool->m_outputHandling)) break; @@ -406,9 +406,9 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error } if (reader.attributes().hasAttribute(kModifiesDocument)) { const auto value = reader.attributes().value(kModifiesDocument); - if (value == kYes || value == kTrue) { + if (value == QLatin1String(kYes) || value == QLatin1String(kTrue)) { tool->m_modifiesCurrentDocument = true; - } else if (value == kNo || value == kFalse) { + } else if (value == QLatin1String(kNo) || value == QLatin1String(kFalse)) { tool->m_modifiesCurrentDocument = false; } else { reader.raiseError("Allowed values for modifiesdocument attribute are 'yes','true','no','false'"); @@ -416,33 +416,33 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error } } while (reader.readNextStartElement()) { - if (reader.name() == kPath) { + if (reader.name() == QLatin1String(kPath)) { tool->m_executables.append(reader.readElementText()); - } else if (reader.name() == kArguments) { + } else if (reader.name() == QLatin1String(kArguments)) { if (!tool->m_arguments.isEmpty()) { reader.raiseError("only one element allowed"); break; } tool->m_arguments = reader.readElementText(); - } else if (reader.name() == kInput) { + } else if (reader.name() == QLatin1String(kInput)) { if (!tool->m_input.isEmpty()) { reader.raiseError("only one element allowed"); break; } tool->m_input = reader.readElementText(); - } else if (reader.name() == kWorkingDirectory) { + } else if (reader.name() == QLatin1String(kWorkingDirectory)) { if (!tool->m_workingDirectory.isEmpty()) { reader.raiseError("only one element allowed"); break; } tool->m_workingDirectory = reader.readElementText(); - } else if (reader.name() == kBaseEnvironmentId) { + } else if (reader.name() == QLatin1String(kBaseEnvironmentId)) { if (tool->m_baseEnvironmentProviderId.isValid()) { reader.raiseError("only one element allowed"); break; } tool->m_baseEnvironmentProviderId = Id::fromString(reader.readElementText()); - } else if (reader.name() == kEnvironment) { + } else if (reader.name() == QLatin1String(kEnvironment)) { if (!tool->m_environment.isEmpty()) { reader.raiseError("only one element allowed"); break; diff --git a/src/plugins/cppeditor/resourcepreviewhoverhandler.cpp b/src/plugins/cppeditor/resourcepreviewhoverhandler.cpp index 003c97e37aa..07fb181d7b7 100644 --- a/src/plugins/cppeditor/resourcepreviewhoverhandler.cpp +++ b/src/plugins/cppeditor/resourcepreviewhoverhandler.cpp @@ -96,12 +96,12 @@ static QString findResourceInFile(const QString &resName, const QString &filePat while (!xmlr.atEnd() && !xmlr.hasError()) { const QXmlStreamReader::TokenType token = xmlr.readNext(); if (token == QXmlStreamReader::StartElement) { - if (xmlr.name() == "qresource") { + if (xmlr.name() == QLatin1String("qresource")) { const QXmlStreamAttributes sa = xmlr.attributes(); const QString prefixName = sa.value("prefix").toString(); if (!prefixName.isEmpty()) prefixStack.push_back(prefixName); - } else if (xmlr.name() == "file") { + } else if (xmlr.name() == QLatin1String("file")) { const QXmlStreamAttributes sa = xmlr.attributes(); const QString aliasName = sa.value("alias").toString(); const QString fileName = xmlr.readElementText(); @@ -117,7 +117,7 @@ static QString findResourceInFile(const QString &resName, const QString &filePat return fileName; } } else if (token == QXmlStreamReader::EndElement) { - if (xmlr.name() == "qresource") { + if (xmlr.name() == QLatin1String("qresource")) { if (!prefixStack.isEmpty()) prefixStack.pop_back(); } diff --git a/src/plugins/debugger/peripheralregisterhandler.cpp b/src/plugins/debugger/peripheralregisterhandler.cpp index 2642f2dc9b2..0236697d7e0 100644 --- a/src/plugins/debugger/peripheralregisterhandler.cpp +++ b/src/plugins/debugger/peripheralregisterhandler.cpp @@ -568,13 +568,13 @@ static void handleField(QXmlStreamReader &in, PeripheralRegister ®) PeripheralRegisterField fld; while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == kName) { + if (elementName == QLatin1String(kName)) { fld.name = in.readElementText(); - } else if (elementName == kDescription) { + } else if (elementName == QLatin1String(kDescription)) { fld.description = in.readElementText(); - } else if (elementName == kAccess) { + } else if (elementName == QLatin1String(kAccess)) { fld.access = decodeAccess(in.readElementText()); - } else if (elementName == kBitRange) { + } else if (elementName == QLatin1String(kBitRange)) { const QString elementText = in.readElementText(); const int startBracket = elementText.indexOf('['); const int endBracket = elementText.indexOf(']'); @@ -589,9 +589,9 @@ static void handleField(QXmlStreamReader &in, PeripheralRegister ®) const int to = int(decodeNumeric(items.at(MaxBit))); fld.bitOffset = from; fld.bitWidth = to - from + 1; - } else if (elementName == kBitOffset) { + } else if (elementName == QLatin1String(kBitOffset)) { fld.bitOffset = int(decodeNumeric(in.readElementText())); - } else if (elementName == kBitWidth) { + } else if (elementName == QLatin1String(kBitWidth)) { fld.bitWidth = int(decodeNumeric(in.readElementText())); } else { in.skipCurrentElement(); @@ -611,24 +611,24 @@ static void handleRegister(QXmlStreamReader &in, PeripheralRegisterGroup &group) PeripheralRegister reg; while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == kName) { + if (elementName == QLatin1String(kName)) { reg.name = in.readElementText(); - } else if (elementName == kDisplayName) { + } else if (elementName == QLatin1String(kDisplayName)) { reg.displayName = in.readElementText(); - } else if (elementName == kDescription) { + } else if (elementName == QLatin1String(kDescription)) { reg.description = in.readElementText(); - } else if (elementName == kAddressOffset) { + } else if (elementName == QLatin1String(kAddressOffset)) { reg.addressOffset = decodeNumeric(in.readElementText()); - } else if (elementName == kSize) { + } else if (elementName == QLatin1String(kSize)) { reg.size = int(decodeNumeric(in.readElementText())); - } else if (elementName == kAccess) { + } else if (elementName == QLatin1String(kAccess)) { reg.access = decodeAccess(in.readElementText()); - } else if (elementName == kResetvalue) { + } else if (elementName == QLatin1String(kResetvalue)) { reg.resetValue = decodeNumeric(in.readElementText()); - } else if (elementName == kFields) { + } else if (elementName == QLatin1String(kFields)) { while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == kField) + if (elementName == QLatin1String(kField)) handleField(in, reg); else in.skipCurrentElement(); @@ -657,22 +657,22 @@ static void handleGroup(QXmlStreamReader &in, PeripheralRegisterGroups &groups) while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == kName) { + if (elementName == QLatin1String(kName)) { group.name = in.readElementText(); - } else if (elementName == kDescription) { + } else if (elementName == QLatin1String(kDescription)) { group.description = in.readElementText(); - } else if (elementName == kGroupName) { + } else if (elementName == QLatin1String(kGroupName)) { group.displayName = in.readElementText(); - } else if (elementName == kBaseAddress) { + } else if (elementName == QLatin1String(kBaseAddress)) { group.baseAddress = decodeNumeric(in.readElementText()); - } else if (elementName == kSize) { + } else if (elementName == QLatin1String(kSize)) { group.size = int(decodeNumeric(in.readElementText())); - } else if (elementName == kAccess) { + } else if (elementName == QLatin1String(kAccess)) { group.access = decodeAccess(in.readElementText()); - } else if (elementName == kRegisters) { + } else if (elementName == QLatin1String(kRegisters)) { while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == kRegister) + if (elementName == QLatin1String(kRegister)) handleRegister(in, group); else in.skipCurrentElement(); @@ -694,13 +694,13 @@ static PeripheralRegisterGroups availablePeripheralRegisterGroups(const FilePath PeripheralRegisterGroups groups; while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == kDevice) { + if (elementName == QLatin1String(kDevice)) { while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == kPeripherals) { + if (elementName == QLatin1String(kPeripherals)) { while (in.readNextStartElement()) { const auto elementName = in.name(); - if (elementName == kPeripheral) + if (elementName == QLatin1String(kPeripheral)) handleGroup(in, groups); else in.skipCurrentElement(); diff --git a/src/plugins/designer/codemodelhelpers.cpp b/src/plugins/designer/codemodelhelpers.cpp index 7beed0874ac..67adc0d5885 100644 --- a/src/plugins/designer/codemodelhelpers.cpp +++ b/src/plugins/designer/codemodelhelpers.cpp @@ -137,7 +137,9 @@ bool navigateToSlot(const QString &uiFileName, SearchFunction searchFunc(setupUiC); const SearchFunction::FunctionList funcs = searchFunc(generatedHeaderDoc); if (funcs.size() != 1) { - *errorMessage = QString::fromLatin1("Internal error: The function \"%1\" could not be found in %2").arg(setupUiC, generatedHeaderFile); + *errorMessage = QString::fromLatin1( + "Internal error: The function \"%1\" could not be found in %2") + .arg(QLatin1String(setupUiC), generatedHeaderFile); return false; } return true; diff --git a/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp b/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp index 74f288e8990..a0c677ba464 100644 --- a/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp +++ b/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp @@ -214,7 +214,7 @@ bool ScxmlDocument::load(QIODevice *io) continue; if (token == QXmlStreamReader::StartElement) { - if (xml.name() == "scxml") { + if (xml.name() == QLatin1String("scxml")) { // Get and add namespaces QXmlStreamNamespaceDeclarations ns = xml.namespaceDeclarations(); for (int i = 0; i < ns.count(); ++i) diff --git a/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp b/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp index 248eeff99a4..924f5127293 100644 --- a/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp +++ b/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp @@ -579,7 +579,7 @@ void ScxmlTag::readXml(QXmlStreamReader &xml, bool checkCopyId) // Read and set attributes QXmlStreamAttributes attributes = xml.attributes(); for (int i = 0; i < attributes.count(); ++i) { - if (m_tagType == Scxml && attributes[i].qualifiedName() == "initial") + if (m_tagType == Scxml && attributes[i].qualifiedName() == QLatin1String("initial")) scxmlInitial = attributes[i].value().toString(); else { QString key = attributes[i].qualifiedName().toString(); diff --git a/src/plugins/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/xmlprotocol/parser.cpp index e4059112470..df2fe3cd1af 100644 --- a/src/plugins/valgrind/xmlprotocol/parser.cpp +++ b/src/plugins/valgrind/xmlprotocol/parser.cpp @@ -304,13 +304,13 @@ XWhat Parser::Private::parseXWhat() if (reader.isEndElement()) break; const auto name = reader.name(); - if (name == "text") + if (name == QLatin1String("text")) what.text = blockingReadElementText(); - else if (name == "leakedbytes") + else if (name == QLatin1String("leakedbytes")) what.leakedbytes = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/leakedbytes"); - else if (name == "leakedblocks") + else if (name == QLatin1String("leakedblocks")) what.leakedblocks = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/leakedblocks"); - else if (name == "hthreadid") + else if (name == QLatin1String("hthreadid")) what.hthreadid = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/hthreadid"); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -326,15 +326,15 @@ XauxWhat Parser::Private::parseXauxWhat() if (reader.isEndElement()) break; const auto name = reader.name(); - if (name == "text") + if (name == QLatin1String("text")) what.text = blockingReadElementText(); - else if (name == "file") + else if (name == QLatin1String("file")) what.file = blockingReadElementText(); - else if (name == "dir") + else if (name == QLatin1String("dir")) what.dir = blockingReadElementText(); - else if (name == "line") + else if (name == QLatin1String("line")) what.line = parseInt64(blockingReadElementText(), "error/xauxwhat/line"); - else if (name == "hthreadid") + else if (name == QLatin1String("hthreadid")) what.hthreadid = parseInt64(blockingReadElementText(), "error/xauxwhat/hthreadid"); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -434,27 +434,27 @@ void Parser::Private::parseError() if (reader.isStartElement()) lastAuxWhat++; const auto name = reader.name(); - if (name == "unique") { + if (name == QLatin1String("unique")) { e.setUnique(parseHex(blockingReadElementText(), "unique")); - } else if (name == "tid") { + } else if (name == QLatin1String("tid")) { e.setTid(parseInt64(blockingReadElementText(), "error/tid")); - } else if (name == "kind") { //TODO this is memcheck-specific: + } else if (name == QLatin1String("kind")) { //TODO this is memcheck-specific: e.setKind(parseErrorKind(blockingReadElementText())); - } else if (name == "suppression") { + } else if (name == QLatin1String("suppression")) { e.setSuppression(parseSuppression()); - } else if (name == "xwhat") { + } else if (name == QLatin1String("xwhat")) { const XWhat xw = parseXWhat(); e.setWhat(xw.text); e.setLeakedBlocks(xw.leakedblocks); e.setLeakedBytes(xw.leakedbytes); e.setHelgrindThreadId(xw.hthreadid); - } else if (name == "what") { + } else if (name == QLatin1String("what")) { e.setWhat(blockingReadElementText()); - } else if (name == "xauxwhat") { + } else if (name == QLatin1String("xauxwhat")) { if (!currentAux.text.isEmpty()) auxs.push_back(currentAux); currentAux = parseXauxWhat(); - } else if (name == "auxwhat") { + } else if (name == QLatin1String("auxwhat")) { const QString aux = blockingReadElementText(); //concatenate multiple consecutive tags if (lastAuxWhat > 1) { @@ -468,7 +468,7 @@ void Parser::Private::parseError() currentAux.text.append(aux); } lastAuxWhat = 0; - } else if (name == "stack") { + } else if (name == QLatin1String("stack")) { frames.push_back(parseStack()); } else if (reader.isStartElement()) { reader.skipCurrentElement(); @@ -505,17 +505,17 @@ Frame Parser::Private::parseFrame() break; if (reader.isStartElement()) { const auto name = reader.name(); - if (name == "ip") + if (name == QLatin1String("ip")) frame.setInstructionPointer(parseHex(blockingReadElementText(), "error/frame/ip")); - else if (name == "obj") + else if (name == QLatin1String("obj")) frame.setObject(blockingReadElementText()); - else if (name == "fn") + else if (name == QLatin1String("fn")) frame.setFunctionName( blockingReadElementText()); - else if (name == "dir") + else if (name == QLatin1String("dir")) frame.setDirectory(blockingReadElementText()); - else if (name == "file") + else if (name == QLatin1String("file")) frame.setFileName(blockingReadElementText()); - else if (name == "line") + else if (name == QLatin1String("line")) frame.setLine(parseInt64(blockingReadElementText(), "error/frame/line")); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -535,9 +535,9 @@ void Parser::Private::parseAnnounceThread() break; if (reader.isStartElement()) { const auto name = reader.name(); - if (name == "hthreadid") + if (name == QLatin1String("hthreadid")) at.setHelgrindThreadId(parseInt64(blockingReadElementText(), "announcethread/hthreadid")); - else if (name == "stack") + else if (name == QLatin1String("stack")) at.setStack(parseStack()); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -554,7 +554,7 @@ void Parser::Private::parseErrorCounts() if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == "pair") { + if (reader.name() == QLatin1String("pair")) { qint64 unique = 0; qint64 count = 0; while (notAtEnd()) { @@ -563,17 +563,16 @@ void Parser::Private::parseErrorCounts() break; if (reader.isStartElement()) { const auto name = reader.name(); - if (name == "unique") + if (name == QLatin1String("unique")) unique = parseHex(blockingReadElementText(), "errorcounts/pair/unique"); - else if (name == "count") + else if (name == QLatin1String("count")) count = parseInt64(blockingReadElementText(), "errorcounts/pair/count"); else if (reader.isStartElement()) reader.skipCurrentElement(); } } emit q->errorCount(unique, count); - } - else if (reader.isStartElement()) + } else if (reader.isStartElement()) reader.skipCurrentElement(); } } @@ -587,7 +586,7 @@ void Parser::Private::parseSuppressionCounts() if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == "pair") { + if (reader.name() == QLatin1String("pair")) { QString pairName; qint64 count = 0; while (notAtEnd()) { @@ -596,17 +595,16 @@ void Parser::Private::parseSuppressionCounts() break; if (reader.isStartElement()) { const auto name = reader.name(); - if (name == "name") + if (name == QLatin1String("name")) pairName = blockingReadElementText(); - else if (name == "count") + else if (name == QLatin1String("count")) count = parseInt64(blockingReadElementText(), "suppcounts/pair/count"); else if (reader.isStartElement()) reader.skipCurrentElement(); } } emit q->suppressionCount(pairName, count); - } - else if (reader.isStartElement()) + } else if (reader.isStartElement()) reader.skipCurrentElement(); } } @@ -622,9 +620,9 @@ void Parser::Private::parseStatus() break; if (reader.isStartElement()) { const auto name = reader.name(); - if (name == "state") + if (name == QLatin1String("state")) s.setState(parseState(blockingReadElementText())); - else if (name == "time") + else if (name == QLatin1String("time")) s.setTime(blockingReadElementText()); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -642,7 +640,7 @@ QVector Parser::Private::parseStack() if (reader.isEndElement()) break; if (reader.isStartElement()) { - if (reader.name() == "frame") + if (reader.name() == QLatin1String("frame")) frames.append(parseFrame()); } } @@ -660,9 +658,9 @@ SuppressionFrame Parser::Private::parseSuppressionFrame() break; if (reader.isStartElement()) { const auto name = reader.name(); - if (name == "obj") + if (name == QLatin1String("obj")) frame.setObject(blockingReadElementText()); - else if (name == "fun") + else if (name == QLatin1String("fun")) frame.setFunction( blockingReadElementText()); else if (reader.isStartElement()) reader.skipCurrentElement(); @@ -682,15 +680,15 @@ Suppression Parser::Private::parseSuppression() break; if (reader.isStartElement()) { const auto name = reader.name(); - if (name == "sname") + if (name == QLatin1String("sname")) supp.setName(blockingReadElementText()); - else if (name == "skind") + else if (name == QLatin1String("skind")) supp.setKind(blockingReadElementText()); - else if (name == "skaux") + else if (name == QLatin1String("skaux")) supp.setAuxKind(blockingReadElementText()); - else if (name == "rawtext") + else if (name == QLatin1String("rawtext")) supp.setRawText(blockingReadElementText()); - else if (name == "sframe") + else if (name == QLatin1String("sframe")) frames.push_back(parseSuppressionFrame()); } } @@ -708,19 +706,19 @@ void Parser::Private::parse(QIODevice *device) while (notAtEnd()) { blockingReadNext(); const auto name = reader.name(); - if (name == "error") + if (name == QLatin1String("error")) parseError(); - else if (name == "announcethread") + else if (name == QLatin1String("announcethread")) parseAnnounceThread(); - else if (name == "status") + else if (name == QLatin1String("status")) parseStatus(); - else if (name == "errorcounts") + else if (name == QLatin1String("errorcounts")) parseErrorCounts(); - else if (name == "suppcounts") + else if (name == QLatin1String("suppcounts")) parseSuppressionCounts(); - else if (name == "protocolversion") + else if (name == QLatin1String("protocolversion")) checkProtocolVersion(blockingReadElementText()); - else if (name == "protocoltool") + else if (name == QLatin1String("protocoltool")) checkTool(blockingReadElementText()); } } catch (const ParserException &e) {