corelib/tools: use qUtf16Printable() and %ls

... instead of qPrintable() and %s. Saves temporary QByteArray creation.

Change-Id: Idd46c99a5da731e29c6d237dc914e256ac7b3fbd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
 
 
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Marc Mutz 2019-05-29 18:06:50 +02:00
parent 41fa84c0d8
commit 090085e104
4 changed files with 9 additions and 9 deletions

View File

@ -132,7 +132,7 @@ QStringList QCommandLineParserPrivate::aliases(const QString &optionName) const
{
const NameHash_t::const_iterator it = nameHash.constFind(optionName);
if (it == nameHash.cend()) {
qWarning("QCommandLineParser: option not defined: \"%s\"", qPrintable(optionName));
qWarning("QCommandLineParser: option not defined: \"%ls\"", qUtf16Printable(optionName));
return QStringList();
}
return commandLineOptionList.at(*it).names();
@ -560,9 +560,9 @@ static void showParserMessage(const QString &message, MessageType type)
{
#if defined(Q_OS_WINRT)
if (type == UsageMessage)
qInfo(qPrintable(message));
qInfo("%ls", qUtf16Printable(message));
else
qCritical(qPrintable(message));
qCritical("%ls", qUtf16Printable(message));
return;
#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
if (displayMessageBox()) {
@ -898,7 +898,7 @@ QStringList QCommandLineParser::values(const QString &optionName) const
return values;
}
qWarning("QCommandLineParser: option not defined: \"%s\"", qPrintable(optionName));
qWarning("QCommandLineParser: option not defined: \"%ls\"", qUtf16Printable(optionName));
return QStringList();
}

View File

@ -709,7 +709,7 @@ void QHashData::dump()
}
n = n->next;
}
qDebug("%s", qPrintable(line));
qDebug("%ls", qUtf16Printable(line));
}
}
}

View File

@ -489,8 +489,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
} else if (typeId == CFStringGetTypeID()) {
result = QStringList(QString::fromCFString(languages.as<CFStringRef>()));
} else {
qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt.io",
qPrintable(QString::fromCFString(CFCopyTypeIDDescription(typeId))));
qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%ls\"; please report to http://bugreports.qt.io",
qUtf16Printable(QString::fromCFString(CFCopyTypeIDDescription(typeId))));
}
return QVariant(result);
}

View File

@ -1048,8 +1048,8 @@ void QRegularExpressionPrivate::getPatternInfo()
unsigned int hasJOptionChanged;
pcre2_pattern_info_16(compiledPattern, PCRE2_INFO_JCHANGED, &hasJOptionChanged);
if (Q_UNLIKELY(hasJOptionChanged)) {
qWarning("QRegularExpressionPrivate::getPatternInfo(): the pattern '%s'\n is using the (?J) option; duplicate capturing group names are not supported by Qt",
qPrintable(pattern));
qWarning("QRegularExpressionPrivate::getPatternInfo(): the pattern '%ls'\n is using the (?J) option; duplicate capturing group names are not supported by Qt",
qUtf16Printable(pattern));
}
}