From 74f6c55dc1804d26fb2da2aa30c64fd8d79dfb20 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 6 Nov 2013 15:13:59 +0100 Subject: Replace QString::fromUtf8() with QString::fromLatin1() for literals The literals are all latin1 strings, and fromLatin1() is much faster. Change-Id: I25af0358a0a4aa2e973349c027cfac50b7589429 Reviewed-by: Fawzi Mohamed --- src/qml/jsruntime/qv4objectproto.cpp | 2 +- src/qml/qml/qqmldirparser.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index c8202a5bad..2f14d8b148 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -405,7 +405,7 @@ ReturnedValue ObjectPrototype::method_toString(SimpleCallContext *ctx) } else { ScopedObject obj(scope, __qmljs_to_object(ctx, ValueRef(&ctx->callData->thisObject))); QString className = obj->className(); - return ctx->engine->newString(QString::fromUtf8("[object %1]").arg(className))->asReturnedValue(); + return ctx->engine->newString(QString::fromLatin1("[object %1]").arg(className))->asReturnedValue(); } } diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp index b23b760b78..c1d0132c61 100644 --- a/src/qml/qml/qqmldirparser.cpp +++ b/src/qml/qml/qqmldirparser.cpp @@ -142,7 +142,7 @@ bool QQmlDirParser::parse(const QString &source) if (invalidLine) { reportError(lineNumber, 0, - QString::fromUtf8("invalid qmldir directive contains too many tokens")); + QString::fromLatin1("invalid qmldir directive contains too many tokens")); continue; } else if (sectionCount == 0) { continue; // no sections, no party. @@ -150,17 +150,17 @@ bool QQmlDirParser::parse(const QString &source) } else if (sections[0] == QLatin1String("module")) { if (sectionCount != 2) { reportError(lineNumber, 0, - QString::fromUtf8("module identifier directive requires one argument, but %1 were provided").arg(sectionCount - 1)); + QString::fromLatin1("module identifier directive requires one argument, but %1 were provided").arg(sectionCount - 1)); continue; } if (!_typeNamespace.isEmpty()) { reportError(lineNumber, 0, - QString::fromUtf8("only one module identifier directive may be defined in a qmldir file")); + QString::fromLatin1("only one module identifier directive may be defined in a qmldir file")); continue; } if (!firstLine) { reportError(lineNumber, 0, - QString::fromUtf8("module identifier directive must be the first directive in a qmldir file")); + QString::fromLatin1("module identifier directive must be the first directive in a qmldir file")); continue; } @@ -169,7 +169,7 @@ bool QQmlDirParser::parse(const QString &source) } else if (sections[0] == QLatin1String("plugin")) { if (sectionCount < 2 || sectionCount > 3) { reportError(lineNumber, 0, - QString::fromUtf8("plugin directive requires one or two arguments, but %1 were provided").arg(sectionCount - 1)); + QString::fromLatin1("plugin directive requires one or two arguments, but %1 were provided").arg(sectionCount - 1)); continue; } @@ -181,7 +181,7 @@ bool QQmlDirParser::parse(const QString &source) } else if (sections[0] == QLatin1String("internal")) { if (sectionCount != 3) { reportError(lineNumber, 0, - QString::fromUtf8("internal types require 2 arguments, but %1 were provided").arg(sectionCount - 1)); + QString::fromLatin1("internal types require 2 arguments, but %1 were provided").arg(sectionCount - 1)); continue; } Component entry(sections[1], sections[2], -1, -1); @@ -190,7 +190,7 @@ bool QQmlDirParser::parse(const QString &source) } else if (sections[0] == QLatin1String("singleton")) { if (sectionCount < 3 || sectionCount > 4) { reportError(lineNumber, 0, - QString::fromUtf8("singleton types require 2 or 3 arguments, but %1 were provided").arg(sectionCount - 1)); + QString::fromLatin1("singleton types require 2 or 3 arguments, but %1 were provided").arg(sectionCount - 1)); continue; } else if (sectionCount == 3) { // handle qmldir directory listing case where singleton is defined in the following pattern: @@ -227,7 +227,7 @@ bool QQmlDirParser::parse(const QString &source) } else if (sections[0] == QLatin1String("typeinfo")) { if (sectionCount != 2) { reportError(lineNumber, 0, - QString::fromUtf8("typeinfo requires 1 argument, but %1 were provided").arg(sectionCount - 1)); + QString::fromLatin1("typeinfo requires 1 argument, but %1 were provided").arg(sectionCount - 1)); continue; } #ifdef QT_CREATOR @@ -270,7 +270,7 @@ bool QQmlDirParser::parse(const QString &source) } } else { reportError(lineNumber, 0, - QString::fromUtf8("a component declaration requires two or three arguments, but %1 were provided").arg(sectionCount)); + QString::fromLatin1("a component declaration requires two or three arguments, but %1 were provided").arg(sectionCount)); } firstLine = false; -- cgit v1.2.3