diff options
author | Kai Koehne <kai.koehne@digia.com> | 2013-08-07 11:07:40 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-09 11:31:42 +0200 |
commit | 306292db8eb1a647f13b91f8ebe18fc5bebf073e (patch) | |
tree | 8ef0921962a5449aece020e45a6f5c701e7a2f07 /src/qml/qml/qqmlfile.cpp | |
parent | a6d50d15f8b46ec8f4f22cbf61b76969de9d4f0b (diff) |
Fix needless conversion from char * to QString
Converting the strings to UTF-16 unconditionally whenever the library is
loaded is overkill. Anyhow, the literals are only passed to methods also
accepting a QLatin1String, so we don't have to convert at all.
Change-Id: I84e813ac989344bc2e359f340696423766392c93
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/qml/qml/qqmlfile.cpp')
-rw-r--r-- | src/qml/qml/qqmlfile.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/qml/qml/qqmlfile.cpp b/src/qml/qml/qqmlfile.cpp index aaf23626cf..be9b011dda 100644 --- a/src/qml/qml/qqmlfile.cpp +++ b/src/qml/qml/qqmlfile.cpp @@ -60,12 +60,12 @@ Supports file://, qrc:/, bundle:// uris and whatever QNetworkAccessManager suppo QT_BEGIN_NAMESPACE -static QString qrc_string(QLatin1String("qrc")); -static QString file_string(QLatin1String("file")); -static QString bundle_string(QLatin1String("bundle")); +static char qrc_string[] = "qrc"; +static char file_string[] = "file"; +static char bundle_string[] = "bundle"; #if defined(Q_OS_ANDROID) -static QString assets_string(QLatin1String("assets")); +static char assets_string[] = "assets"; #endif class QQmlFilePrivate; @@ -493,13 +493,13 @@ bool QQmlFile::isSynchronous(const QUrl &url) { QString scheme = url.scheme(); - if ((scheme.length() == 4 && 0 == scheme.compare(file_string, Qt::CaseInsensitive)) || - (scheme.length() == 6 && 0 == scheme.compare(bundle_string, Qt::CaseInsensitive)) || - (scheme.length() == 3 && 0 == scheme.compare(qrc_string, Qt::CaseInsensitive))) { + if ((scheme.length() == 4 && 0 == scheme.compare(QLatin1String(file_string), Qt::CaseInsensitive)) || + (scheme.length() == 6 && 0 == scheme.compare(QLatin1String(bundle_string), Qt::CaseInsensitive)) || + (scheme.length() == 3 && 0 == scheme.compare(QLatin1String(qrc_string), Qt::CaseInsensitive))) { return true; #if defined(Q_OS_ANDROID) - } else if (scheme.length() == 6 && 0 == scheme.compare(assets_string, Qt::CaseInsensitive)) { + } else if (scheme.length() == 6 && 0 == scheme.compare(QLatin1String(assets_string), Qt::CaseInsensitive)) { return true; #endif @@ -525,19 +525,19 @@ bool QQmlFile::isSynchronous(const QString &url) if (f == QLatin1Char('f') || f == QLatin1Char('F')) { return url.length() >= 7 /* file:// */ && - url.startsWith(file_string, Qt::CaseInsensitive) && + url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) && url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/'); } else if (f == QLatin1Char('b') || f == QLatin1Char('B')) { return url.length() >= 9 /* bundle:// */ && - url.startsWith(bundle_string, Qt::CaseInsensitive) && + url.startsWith(QLatin1String(bundle_string), Qt::CaseInsensitive) && url[6] == QLatin1Char(':') && url[7] == QLatin1Char('/') && url[8] == QLatin1Char('/'); } else if (f == QLatin1Char('q') || f == QLatin1Char('Q')) { return url.length() >= 5 /* qrc:/ */ && - url.startsWith(qrc_string, Qt::CaseInsensitive) && + url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) && url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/'); } @@ -545,7 +545,7 @@ bool QQmlFile::isSynchronous(const QString &url) #if defined(Q_OS_ANDROID) else if (f == QLatin1Char('a') || f == QLatin1Char('A')) { return url.length() >= 8 /* assets:/ */ && - url.startsWith(assets_string, Qt::CaseInsensitive) && + url.startsWith(QLatin1String(assets_string), Qt::CaseInsensitive) && url[6] == QLatin1Char(':') && url[7] == QLatin1Char('/'); } @@ -561,7 +561,7 @@ Bundle urls have a bundle:// scheme. */ bool QQmlFile::isBundle(const QString &url) { - return url.length() >= 9 && url.startsWith(bundle_string, Qt::CaseInsensitive) && + return url.length() >= 9 && url.startsWith(QLatin1String(bundle_string), Qt::CaseInsensitive) && url[6] == QLatin1Char(':') && url[7] == QLatin1Char('/') && url[8] == QLatin1Char('/'); } @@ -574,7 +574,7 @@ bool QQmlFile::isBundle(const QUrl &url) { QString scheme = url.scheme(); - return scheme.length() == 6 && 0 == scheme.compare(bundle_string, Qt::CaseInsensitive); + return scheme.length() == 6 && 0 == scheme.compare(QLatin1String(bundle_string), Qt::CaseInsensitive); } /*! @@ -588,12 +588,12 @@ bool QQmlFile::isLocalFile(const QUrl &url) { QString scheme = url.scheme(); - if ((scheme.length() == 4 && 0 == scheme.compare(file_string, Qt::CaseInsensitive)) || - (scheme.length() == 3 && 0 == scheme.compare(qrc_string, Qt::CaseInsensitive))) { + if ((scheme.length() == 4 && 0 == scheme.compare(QLatin1String(file_string), Qt::CaseInsensitive)) || + (scheme.length() == 3 && 0 == scheme.compare(QLatin1String(qrc_string), Qt::CaseInsensitive))) { return true; #if defined(Q_OS_ANDROID) - } else if (scheme.length() == 6 && 0 == scheme.compare(assets_string, Qt::CaseInsensitive)) { + } else if (scheme.length() == 6 && 0 == scheme.compare(QLatin1String(assets_string), Qt::CaseInsensitive)) { return true; #endif @@ -619,20 +619,20 @@ bool QQmlFile::isLocalFile(const QString &url) if (f == QLatin1Char('f') || f == QLatin1Char('F')) { return url.length() >= 7 /* file:// */ && - url.startsWith(file_string, Qt::CaseInsensitive) && + url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) && url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/'); } else if (f == QLatin1Char('q') || f == QLatin1Char('Q')) { return url.length() >= 5 /* qrc:/ */ && - url.startsWith(qrc_string, Qt::CaseInsensitive) && + url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) && url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/'); } #if defined(Q_OS_ANDROID) else if (f == QLatin1Char('a') || f == QLatin1Char('A')) { return url.length() >= 8 /* assets:/ */ && - url.startsWith(assets_string, Qt::CaseInsensitive) && + url.startsWith(QLatin1String(assets_string), Qt::CaseInsensitive) && url[6] == QLatin1Char(':') && url[7] == QLatin1Char('/'); } |