diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-07-06 11:32:54 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-07-08 06:43:02 +0000 |
commit | 2788fccd29fba84bca7581778f5bc683736f1d0e (patch) | |
tree | 09ea03b66e8eb97d8bcc56395aadb53018f40a1f /src/corelib | |
parent | 145d8462e3daa96b49a921fd4a34cf4dc84071d4 (diff) |
Use QStringLiteral more judiciously
Replace it with QL1S in QStringBuilder expressions
and in overloaded functions.
Replace patterns 'QString::number() + QStringLiteral'
and 'QStringLiteral + QString::number()' with
QString::asprintf.
Saves some text size.
Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 10 | ||||
-rw-r--r-- | src/corelib/io/qfileselector.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qurl.cpp | 4 | ||||
-rw-r--r-- | src/corelib/io/qurlidna.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 2 |
5 files changed, 10 insertions, 10 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index f2e293c45b..49a8aa0df1 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1123,7 +1123,7 @@ void QMessagePattern::setPattern(const QString &pattern) if (m.hasMatch()) { int depth = m.capturedRef(1).toInt(); if (depth <= 0) - error += QStringLiteral("QT_MESSAGE_PATTERN: %{backtrace} depth must be a number greater than 0\n"); + error += QLatin1String("QT_MESSAGE_PATTERN: %{backtrace} depth must be a number greater than 0\n"); else backtraceDepth = depth; } @@ -1135,7 +1135,7 @@ void QMessagePattern::setPattern(const QString &pattern) backtraceParams.backtraceSeparator = backtraceSeparator; backtraceArgs.append(backtraceParams); #else - error += QStringLiteral("QT_MESSAGE_PATTERN: %{backtrace} is not supported by this Qt build\n"); + error += QLatin1String("QT_MESSAGE_PATTERN: %{backtrace} is not supported by this Qt build\n"); #endif } @@ -1156,7 +1156,7 @@ void QMessagePattern::setPattern(const QString &pattern) else if (lexeme == QLatin1String(endifTokenC)) { tokens[i] = endifTokenC; if (!inIf && !nestedIfError) - error += QStringLiteral("QT_MESSAGE_PATTERN: %{endif} without an %{if-*}\n"); + error += QLatin1String("QT_MESSAGE_PATTERN: %{endif} without an %{if-*}\n"); inIf = false; } else { tokens[i] = emptyTokenC; @@ -1172,9 +1172,9 @@ void QMessagePattern::setPattern(const QString &pattern) } } if (nestedIfError) - error += QStringLiteral("QT_MESSAGE_PATTERN: %{if-*} cannot be nested\n"); + error += QLatin1String("QT_MESSAGE_PATTERN: %{if-*} cannot be nested\n"); else if (inIf) - error += QStringLiteral("QT_MESSAGE_PATTERN: missing %{endif}\n"); + error += QLatin1String("QT_MESSAGE_PATTERN: missing %{endif}\n"); if (!error.isEmpty()) { #if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16())); diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index 29ef0f937e..b2f4b6931f 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -387,7 +387,7 @@ QStringList QFileSelectorPrivate::platformSelectors() # endif QString productName = QSysInfo::productType(); # ifdef Q_OS_MACOS - if (productName != QStringLiteral("osx")) + if (productName != QLatin1String("osx")) ret << QStringLiteral("osx"); // compatibility # endif if (productName != QLatin1String("unknown")) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index bd2f9de66c..fd2127bce3 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -819,7 +819,7 @@ static const ushort * const fragmentInUrl = userNameInUrl + 6; static inline void parseDecodedComponent(QString &data) { - data.replace(QLatin1Char('%'), QStringLiteral("%25")); + data.replace(QLatin1Char('%'), QLatin1String("%25")); } static inline QString @@ -1477,7 +1477,7 @@ QString QUrlPrivate::toLocalFile(QUrl::FormattingOptions options) const // magic for shared drive on windows if (!host.isEmpty()) { - tmp = QStringLiteral("//") + host; + tmp = QLatin1String("//") + host; #ifdef Q_OS_WIN // QTBUG-42346, WebDAV is visible as local file on Windows only. if (scheme == webDavScheme()) tmp += webDavSslTag(); diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index 11b2280cd1..16bb924b17 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -2269,7 +2269,7 @@ Q_AUTOTEST_EXPORT void qt_punycodeEncoder(const QChar *s, int ucLength, QString } // prepend ACE prefix - output->insert(outLen, QStringLiteral("xn--")); + output->insert(outLen, QLatin1String("xn--")); return; } diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index b296361146..a8010af74c 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3581,7 +3581,7 @@ QString QDateTime::toString(Qt::DateFormat format) const .arg(tm.toString(Qt::TextDate)) .arg(dt.year()); if (timeSpec() != Qt::LocalTime) { - buf += QStringLiteral(" GMT"); + buf += QLatin1String(" GMT"); if (d->m_spec == Qt::OffsetFromUTC) buf += toOffsetString(Qt::TextDate, d->m_offsetFromUtc); } |