QtCore: use new QLatin1String::arg()
Saves ~600B in text size on optimized GCC 9.1 Linux AMD64 builds. Change-Id: I12f4e7c8d28af9549b481859bc96a155aeb6f15c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
ed02ab78ea
commit
9c357d64db
@ -810,7 +810,7 @@ QFile::copy(const QString &newName)
|
||||
error = true;
|
||||
d->setError(QFile::CopyError, tr("Cannot open %1 for input").arg(d->fileName));
|
||||
} else {
|
||||
QString fileTemplate = QLatin1String("%1/qt_temp.XXXXXX");
|
||||
const auto fileTemplate = QLatin1String("%1/qt_temp.XXXXXX");
|
||||
#ifdef QT_NO_TEMPORARYFILE
|
||||
QFile out(fileTemplate.arg(QFileInfo(newName).path()));
|
||||
if (!out.open(QIODevice::ReadWrite))
|
||||
|
@ -136,7 +136,7 @@ static QString getExternalStoragePublicDirectory(const char *directoryField)
|
||||
*/
|
||||
static QString getExternalFilesDir(const char *directoryField = 0)
|
||||
{
|
||||
QString &path = (*androidDirCache)[QString(QLatin1String("APPNAME_%1")).arg(QLatin1String(directoryField))];
|
||||
QString &path = (*androidDirCache)[QLatin1String("APPNAME_%1").arg(QLatin1String(directoryField))];
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
|
||||
|
@ -3991,21 +3991,21 @@ static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &err
|
||||
return QString();
|
||||
|
||||
case QUrlPrivate::InvalidSchemeError: {
|
||||
QString msg = QStringLiteral("Invalid scheme (character '%1' not permitted)");
|
||||
auto msg = QLatin1String("Invalid scheme (character '%1' not permitted)");
|
||||
return msg.arg(c);
|
||||
}
|
||||
|
||||
case QUrlPrivate::InvalidUserNameError:
|
||||
return QString(QStringLiteral("Invalid user name (character '%1' not permitted)"))
|
||||
return QLatin1String("Invalid user name (character '%1' not permitted)")
|
||||
.arg(c);
|
||||
|
||||
case QUrlPrivate::InvalidPasswordError:
|
||||
return QString(QStringLiteral("Invalid password (character '%1' not permitted)"))
|
||||
return QLatin1String("Invalid password (character '%1' not permitted)")
|
||||
.arg(c);
|
||||
|
||||
case QUrlPrivate::InvalidRegNameError:
|
||||
if (errorPosition != -1)
|
||||
return QString(QStringLiteral("Invalid hostname (character '%1' not permitted)"))
|
||||
return QLatin1String("Invalid hostname (character '%1' not permitted)")
|
||||
.arg(c);
|
||||
else
|
||||
return QStringLiteral("Invalid hostname (contains invalid characters)");
|
||||
@ -4014,9 +4014,9 @@ static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &err
|
||||
case QUrlPrivate::InvalidIPv6AddressError:
|
||||
return QStringLiteral("Invalid IPv6 address");
|
||||
case QUrlPrivate::InvalidCharacterInIPv6Error:
|
||||
return QStringLiteral("Invalid IPv6 address (character '%1' not permitted)").arg(c);
|
||||
return QLatin1String("Invalid IPv6 address (character '%1' not permitted)").arg(c);
|
||||
case QUrlPrivate::InvalidIPvFutureError:
|
||||
return QStringLiteral("Invalid IPvFuture address (character '%1' not permitted)").arg(c);
|
||||
return QLatin1String("Invalid IPvFuture address (character '%1' not permitted)").arg(c);
|
||||
case QUrlPrivate::HostMissingEndBracket:
|
||||
return QStringLiteral("Expected ']' to match '[' in hostname");
|
||||
|
||||
@ -4026,15 +4026,15 @@ static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &err
|
||||
return QStringLiteral("Port field was empty");
|
||||
|
||||
case QUrlPrivate::InvalidPathError:
|
||||
return QString(QStringLiteral("Invalid path (character '%1' not permitted)"))
|
||||
return QLatin1String("Invalid path (character '%1' not permitted)")
|
||||
.arg(c);
|
||||
|
||||
case QUrlPrivate::InvalidQueryError:
|
||||
return QString(QStringLiteral("Invalid query (character '%1' not permitted)"))
|
||||
return QLatin1String("Invalid query (character '%1' not permitted)")
|
||||
.arg(c);
|
||||
|
||||
case QUrlPrivate::InvalidFragmentError:
|
||||
return QString(QStringLiteral("Invalid fragment (character '%1' not permitted)"))
|
||||
return QLatin1String("Invalid fragment (character '%1' not permitted)")
|
||||
.arg(c);
|
||||
|
||||
case QUrlPrivate::AuthorityPresentAndPathIsRelative:
|
||||
|
@ -47,9 +47,9 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static inline QString keyBase()
|
||||
static inline QLatin1String keyBase()
|
||||
{
|
||||
return QStringLiteral("%1%2:%3");
|
||||
return QLatin1String("%1%2:%3");
|
||||
}
|
||||
|
||||
static QString qt_convertJString(jstring string)
|
||||
@ -154,7 +154,7 @@ static jmethodID getCachedMethodID(JNIEnv *env,
|
||||
if (className.isEmpty())
|
||||
return getMethodID(env, clazz, name, sig, isStatic);
|
||||
|
||||
const QString key = keyBase().arg(QLatin1String(className)).arg(QLatin1String(name)).arg(QLatin1String(sig));
|
||||
const QString key = keyBase().arg(QLatin1String(className), QLatin1String(name), QLatin1String(sig));
|
||||
QHash<QString, jmethodID>::const_iterator it;
|
||||
|
||||
{
|
||||
@ -206,7 +206,7 @@ static jfieldID getCachedFieldID(JNIEnv *env,
|
||||
if (className.isNull())
|
||||
return getFieldID(env, clazz, name, sig, isStatic);
|
||||
|
||||
const QString key = keyBase().arg(QLatin1String(className)).arg(QLatin1String(name)).arg(QLatin1String(sig));
|
||||
const QString key = keyBase().arg(QLatin1String(className), QLatin1String(name), QLatin1String(sig));
|
||||
QHash<QString, jfieldID>::const_iterator it;
|
||||
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode)
|
||||
#if QT_CONFIG(translation)
|
||||
QCoreApplication::tr("%1: key is empty", "QSystemSemaphore")
|
||||
#else
|
||||
QString::fromLatin1("%1: key is empty")
|
||||
QLatin1String("%1: key is empty")
|
||||
#endif
|
||||
.arg(QLatin1String("QSystemSemaphore::handle:"));
|
||||
error = QSystemSemaphore::KeyError;
|
||||
@ -94,7 +94,7 @@ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode)
|
||||
#if QT_CONFIG(translation)
|
||||
QCoreApplication::tr("%1: unable to make key", "QSystemSemaphore")
|
||||
#else
|
||||
QString::fromLatin1("%1: unable to make key")
|
||||
QLatin1String("%1: unable to make key")
|
||||
#endif
|
||||
.arg(QLatin1String("QSystemSemaphore::handle:"));
|
||||
error = QSystemSemaphore::KeyError;
|
||||
@ -111,7 +111,7 @@ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode)
|
||||
#if QT_CONFIG(translation)
|
||||
QCoreApplication::tr("%1: ftok failed", "QSystemSemaphore")
|
||||
#else
|
||||
QString::fromLatin1("%1: ftok failed")
|
||||
QLatin1String("%1: ftok failed")
|
||||
#endif
|
||||
.arg(QLatin1String("QSystemSemaphore::handle:"));
|
||||
error = QSystemSemaphore::KeyError;
|
||||
|
@ -77,14 +77,14 @@ QStringList QLibraryPrivate::suffixes_sys(const QString& fullVersion)
|
||||
// .so is preferred.
|
||||
# if defined(__ia64)
|
||||
if (!fullVersion.isEmpty()) {
|
||||
suffixes << QString::fromLatin1(".so.%1").arg(fullVersion);
|
||||
suffixes << QLatin1String(".so.%1").arg(fullVersion);
|
||||
} else {
|
||||
suffixes << QLatin1String(".so");
|
||||
}
|
||||
# endif
|
||||
if (!fullVersion.isEmpty()) {
|
||||
suffixes << QString::fromLatin1(".sl.%1").arg(fullVersion);
|
||||
suffixes << QString::fromLatin1(".%1").arg(fullVersion);
|
||||
suffixes << QLatin1String(".sl.%1").arg(fullVersion);
|
||||
suffixes << QLatin1String(".%1").arg(fullVersion);
|
||||
} else {
|
||||
suffixes << QLatin1String(".sl");
|
||||
}
|
||||
@ -93,15 +93,15 @@ QStringList QLibraryPrivate::suffixes_sys(const QString& fullVersion)
|
||||
|
||||
#else
|
||||
if (!fullVersion.isEmpty()) {
|
||||
suffixes << QString::fromLatin1(".so.%1").arg(fullVersion);
|
||||
suffixes << QLatin1String(".so.%1").arg(fullVersion);
|
||||
} else {
|
||||
suffixes << QLatin1String(".so");
|
||||
}
|
||||
#endif
|
||||
# ifdef Q_OS_MAC
|
||||
if (!fullVersion.isEmpty()) {
|
||||
suffixes << QString::fromLatin1(".%1.bundle").arg(fullVersion);
|
||||
suffixes << QString::fromLatin1(".%1.dylib").arg(fullVersion);
|
||||
suffixes << QLatin1String(".%1.bundle").arg(fullVersion);
|
||||
suffixes << QLatin1String(".%1.dylib").arg(fullVersion);
|
||||
} else {
|
||||
suffixes << QLatin1String(".bundle") << QLatin1String(".dylib");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user