diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp index 06628fa323..528dca3ff5 100644 --- a/src/corelib/mimetypes/qmimemagicrule.cpp +++ b/src/corelib/mimetypes/qmimemagicrule.cpp @@ -234,7 +234,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type, m_matchFunction(nullptr) { if (m_type == Invalid) - *errorString = QStringLiteral("Type %s is not supported").arg(type); + *errorString = QLatin1String("Type ") + type + QLatin1String(" is not supported"); // Parse for offset as "1" or "1:10" const int colonIndex = offsets.indexOf(QLatin1Char(':')); @@ -249,7 +249,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type, if (m_value.isEmpty()) { m_type = Invalid; if (errorString) - *errorString = QLatin1String("Invalid empty magic rule value"); + *errorString = QStringLiteral("Invalid empty magic rule value"); return; } @@ -259,8 +259,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type, if (!ok) { m_type = Invalid; if (errorString) - *errorString = QString::fromLatin1("Invalid magic rule value \"%1\"").arg( - QString::fromLatin1(m_value)); + *errorString = QLatin1String("Invalid magic rule value \"") + QLatin1String(m_value) + QLatin1Char('"'); return; } m_numberMask = !m_mask.isEmpty() ? m_mask.toUInt(&ok, 0) : 0; // autodetect base @@ -274,8 +273,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type, if (m_mask.size() < 4 || !m_mask.startsWith("0x")) { m_type = Invalid; if (errorString) - *errorString = QString::fromLatin1("Invalid magic rule mask \"%1\"").arg( - QString::fromLatin1(m_mask)); + *errorString = QLatin1String("Invalid magic rule mask \"") + QLatin1String(m_mask) + QLatin1Char('"'); return; } const QByteArray &tempMask = QByteArray::fromHex(QByteArray::fromRawData( @@ -283,8 +281,7 @@ QMimeMagicRule::QMimeMagicRule(const QString &type, if (tempMask.size() != m_pattern.size()) { m_type = Invalid; if (errorString) - *errorString = QString::fromLatin1("Invalid magic rule mask size \"%1\"").arg( - QString::fromLatin1(m_mask)); + *errorString = QLatin1String("Invalid magic rule mask size \"") + QLatin1String(m_mask) + QLatin1Char('"'); return; } m_mask = tempMask; diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp index b0d599fb0e..0751c1feed 100644 --- a/src/corelib/mimetypes/qmimetypeparser.cpp +++ b/src/corelib/mimetypes/qmimetypeparser.cpp @@ -205,7 +205,7 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString case ParseMimeType: { // start parsing a MIME type name const QString name = atts.value(QLatin1String(mimeTypeAttributeC)).toString(); if (name.isEmpty()) { - reader.raiseError(QString::fromLatin1("Missing '%1'-attribute").arg(QString::fromLatin1(mimeTypeAttributeC))); + reader.raiseError(QStringLiteral("Missing 'type'-attribute")); } else { data.name = name; } @@ -282,8 +282,7 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString break; } case ParseError: - reader.raiseError(QString::fromLatin1("Unexpected element <%1>"). - arg(reader.name().toString())); + reader.raiseError(QLatin1String("Unexpected element <") + reader.name() + QLatin1Char('>')); break; default: break;