Use QString::asprintf(), QStringBuilder, and the multi-arg overload of QString::arg()
... instead of sequential .arg(const QString &) callings. It saves memory allocations and prevents unexpected results if replacing strings contain place markers. Found with clazy's qstring-arg check. Change-Id: I3912275a6e11c6fb7559ff5623f2e8cde9b7f07a Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
8f469e4a19
commit
dcec1420ea
@ -569,12 +569,10 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver)
|
||||
QThread *thr = receiver->thread();
|
||||
Q_ASSERT_X(currentThread == thr || !thr,
|
||||
"QCoreApplication::sendEvent",
|
||||
QString::fromLatin1("Cannot send events to objects owned by a different thread. "
|
||||
"Current thread %1. Receiver '%2' (of type '%3') was created in thread %4")
|
||||
.arg(QString::number((quintptr) currentThread, 16))
|
||||
.arg(receiver->objectName())
|
||||
.arg(QLatin1String(receiver->metaObject()->className()))
|
||||
.arg(QString::number((quintptr) thr, 16))
|
||||
QString::asprintf("Cannot send events to objects owned by a different thread. "
|
||||
"Current thread 0x%p. Receiver '%ls' (of type '%s') was created in thread 0x%p",
|
||||
currentThread, qUtf16Printable(receiver->objectName()),
|
||||
receiver->metaObject()->className(), thr)
|
||||
.toLocal8Bit().data());
|
||||
Q_UNUSED(currentThread);
|
||||
Q_UNUSED(thr);
|
||||
|
@ -72,7 +72,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
|
||||
if (fdlen < 64){
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is not an ELF object (%2)").arg(library).arg(QLatin1String("file too small"));
|
||||
lib->errorString = QLibrary::tr("'%1' is not an ELF object (%2)").arg(library, QLibrary::tr("file too small"));
|
||||
return NotElf;
|
||||
}
|
||||
const char *data = dataStart;
|
||||
@ -84,7 +84,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
// 32 or 64 bit
|
||||
if (data[4] != 1 && data[4] != 2) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library).arg(QLatin1String("odd cpu architecture"));
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("odd cpu architecture"));
|
||||
return Corrupt;
|
||||
}
|
||||
m_bits = (data[4] << 5);
|
||||
@ -94,13 +94,13 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
*/
|
||||
if ((sizeof(void*) == 4 && m_bits != 32) || (sizeof(void*) == 8 && m_bits != 64)) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library).arg(QLatin1String("wrong cpu architecture"));
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("wrong cpu architecture"));
|
||||
return Corrupt;
|
||||
}
|
||||
// endian
|
||||
if (data[5] == 0) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library).arg(QLatin1String("odd endianness"));
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("odd endianness"));
|
||||
return Corrupt;
|
||||
}
|
||||
m_endian = (data[5] == 1 ? ElfLittleEndian : ElfBigEndian);
|
||||
@ -120,7 +120,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
|
||||
if (e_shsize > fdlen) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library).arg(QLatin1String("unexpected e_shsize"));
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("unexpected e_shsize"));
|
||||
return Corrupt;
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
|
||||
if (e_shentsize % 4){
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library).arg(QLatin1String("unexpected e_shentsize"));
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("unexpected e_shentsize"));
|
||||
return Corrupt;
|
||||
}
|
||||
data += sizeof(qelfhalf_t); // e_shentsize
|
||||
@ -143,9 +143,9 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
|
||||
if ((quint32)(e_shnum * e_shentsize) > fdlen) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library)
|
||||
.arg(QLatin1String("announced %2 sections, each %3 bytes, exceed file size"))
|
||||
.arg(e_shnum).arg(e_shentsize);
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)")
|
||||
.arg(library, QLibrary::tr("announced %1 section(s), each %2 byte(s), exceed file size")
|
||||
.arg(e_shnum).arg(e_shentsize));
|
||||
return Corrupt;
|
||||
}
|
||||
|
||||
@ -158,9 +158,9 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
|
||||
if ((soff + e_shentsize) > fdlen || soff % 4 || soff == 0) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library)
|
||||
.arg(QLatin1String("shstrtab section header seems to be at %1"))
|
||||
.arg(QString::number(soff, 16));
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)")
|
||||
.arg(library, QLibrary::tr("shstrtab section header seems to be at %1")
|
||||
.arg(QString::number(soff, 16)));
|
||||
return Corrupt;
|
||||
}
|
||||
|
||||
@ -169,9 +169,9 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
|
||||
if ((quint32)(m_stringTableFileOffset + e_shentsize) >= fdlen || m_stringTableFileOffset == 0) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library)
|
||||
.arg(QLatin1String("string table seems to be at %1"))
|
||||
.arg(QString::number(soff, 16));
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)")
|
||||
.arg(library, QLibrary::tr("string table seems to be at %1")
|
||||
.arg(QString::number(soff, 16)));
|
||||
return Corrupt;
|
||||
}
|
||||
|
||||
@ -191,9 +191,9 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
|
||||
if (m_stringTableFileOffset + sh.name > fdlen) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library)
|
||||
.arg(QLatin1String("section name %2 of %3 behind end of file"))
|
||||
.arg(i).arg(e_shnum);
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)")
|
||||
.arg(library, QLibrary::tr("section name %1 of %2 behind end of file")
|
||||
.arg(i).arg(e_shnum));
|
||||
return Corrupt;
|
||||
}
|
||||
|
||||
@ -205,8 +205,8 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
if (!(sh.type & 0x1)) {
|
||||
if (shnam[1] == 'r') {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library)
|
||||
.arg(QLatin1String("empty .rodata. not a library."));
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)")
|
||||
.arg(library, QLibrary::tr("empty .rodata. not a library."));
|
||||
return Corrupt;
|
||||
}
|
||||
#if defined(QELFPARSER_DEBUG)
|
||||
@ -218,8 +218,8 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
|
||||
if (sh.offset == 0 || (sh.offset + sh.size) > fdlen || sh.size < 1) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library)
|
||||
.arg(QLatin1String("missing section data. This is not a library."));
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)")
|
||||
.arg(library, QLibrary::tr("missing section data. This is not a library."));
|
||||
return Corrupt;
|
||||
}
|
||||
*pos = sh.offset;
|
||||
|
@ -252,7 +252,7 @@ bool QLibraryPrivate::load_sys()
|
||||
#endif
|
||||
#endif // QT_NO_DYNAMIC_LIBRARY
|
||||
if (!pHnd) {
|
||||
errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName).arg(qdlerror());
|
||||
errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, qdlerror());
|
||||
}
|
||||
if (pHnd) {
|
||||
qualifiedFileName = attempt;
|
||||
@ -273,10 +273,10 @@ bool QLibraryPrivate::unload_sys()
|
||||
char *error = dlerror(); // QtDeclarative auto test "qqmlenginecleanup" for instance
|
||||
if (!qstrcmp(error, "Shared objects still referenced")) // On QNX that's only "informative"
|
||||
return true;
|
||||
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName)
|
||||
.arg(QLatin1String(error));
|
||||
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName,
|
||||
QLatin1String(error));
|
||||
# else
|
||||
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName).arg(qdlerror());
|
||||
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName, qdlerror());
|
||||
# endif
|
||||
return false;
|
||||
}
|
||||
@ -312,7 +312,7 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
|
||||
#endif
|
||||
if (!address) {
|
||||
errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg(
|
||||
QString::fromLatin1(symbol)).arg(fileName).arg(qdlerror());
|
||||
QString::fromLatin1(symbol), fileName, qdlerror());
|
||||
} else {
|
||||
errorString.clear();
|
||||
}
|
||||
|
@ -204,8 +204,7 @@ static inline QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const
|
||||
{
|
||||
return msg.createErrorReply(QDBusError::UnknownInterface,
|
||||
QString::fromLatin1("Interface %1 was not found in object %2")
|
||||
.arg(interface_name)
|
||||
.arg(msg.path()));
|
||||
.arg(interface_name, msg.path()));
|
||||
}
|
||||
|
||||
static inline QDBusMessage
|
||||
|
@ -149,9 +149,8 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
if (!isScriptable && !(flags & (isSignal ? QDBusConnection::ExportNonScriptableSignals : QDBusConnection::ExportNonScriptableInvokables | QDBusConnection::ExportNonScriptableSlots)))
|
||||
continue;
|
||||
|
||||
QString xml = QString::fromLatin1(" <%1 name=\"%2\">\n")
|
||||
.arg(isSignal ? QLatin1String("signal") : QLatin1String("method"))
|
||||
.arg(QString::fromLatin1(mm.name()));
|
||||
QString xml = QString::asprintf(" <%s name=\"%s\">\n",
|
||||
isSignal ? "signal" : "method", mm.name().constData());
|
||||
|
||||
// check the return type first
|
||||
int typeId = mm.returnType();
|
||||
@ -205,10 +204,8 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
bool isOutput = isSignal || j > inputCount;
|
||||
|
||||
const char *signature = QDBusMetaType::typeToSignature(types.at(j));
|
||||
xml += QString::fromLatin1(" <arg %1type=\"%2\" direction=\"%3\"/>\n")
|
||||
.arg(name)
|
||||
.arg(QLatin1String(signature))
|
||||
.arg(isOutput ? QLatin1String("out") : QLatin1String("in"));
|
||||
xml += QString::asprintf(" <arg %lstype=\"%s\" direction=\"%s\"/>\n",
|
||||
qUtf16Printable(name), signature, isOutput ? "out" : "in");
|
||||
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
|
@ -670,7 +670,7 @@ bool QPSQLResult::exec()
|
||||
if (params.isEmpty())
|
||||
stmt = QString::fromLatin1("EXECUTE %1").arg(d->preparedStmtId);
|
||||
else
|
||||
stmt = QString::fromLatin1("EXECUTE %1 (%2)").arg(d->preparedStmtId).arg(params);
|
||||
stmt = QString::fromLatin1("EXECUTE %1 (%2)").arg(d->preparedStmtId, params);
|
||||
|
||||
d->result = d->drv_d_func()->exec(stmt);
|
||||
|
||||
|
@ -259,10 +259,9 @@ static int CS_PUBLIC qTdsErrHandler(DBPROCESS* dbproc,
|
||||
return INT_CANCEL;
|
||||
}
|
||||
|
||||
|
||||
QString errMsg = QString::fromLatin1("%1 %2\n").arg(QLatin1String(dberrstr)).arg(
|
||||
QLatin1String(oserrstr));
|
||||
errMsg += p->getErrorMsgs();
|
||||
const QString errMsg = QLatin1String(dberrstr) + QLatin1Char(' ')
|
||||
+ QLatin1String(oserrstr) + QLatin1Char('\n')
|
||||
+ p->getErrorMsgs();
|
||||
p->lastError = qMakeError(errMsg, QSqlError::UnknownError, dberr);
|
||||
p->clearErrorMsgs();
|
||||
|
||||
|
@ -584,7 +584,8 @@ QString QSqlRelationalTableModel::selectStatement() const
|
||||
QString displayColumn = relation.displayColumn();
|
||||
if (d->db.driver()->isIdentifierEscaped(displayColumn, QSqlDriver::FieldName))
|
||||
displayColumn = d->db.driver()->stripDelimiters(displayColumn, QSqlDriver::FieldName);
|
||||
const QString alias = QString::fromLatin1("%1_%2_%3").arg(relTableName).arg(displayColumn).arg(fieldNames.value(fieldList[i]));
|
||||
const QString alias = QString::fromLatin1("%1_%2_%3")
|
||||
.arg(relTableName, displayColumn, QString::number(fieldNames.value(fieldList[i])));
|
||||
displayTableField = Sql::as(displayTableField, alias);
|
||||
--fieldNames[fieldList[i]];
|
||||
}
|
||||
|
@ -91,8 +91,8 @@ struct QBenchmarkContext
|
||||
|
||||
QString toString() const
|
||||
{
|
||||
QString s = QString::fromLatin1("%1,%2,%3").arg(slotName).arg(tag).arg(checkpointIndex);
|
||||
return s;
|
||||
return QString::fromLatin1("%1,%2,%3")
|
||||
.arg(slotName, tag, QString::number(checkpointIndex));
|
||||
}
|
||||
|
||||
QBenchmarkContext() : checkpointIndex(-1) {}
|
||||
|
@ -167,17 +167,16 @@ void QTeamCityLogger::addIncident(IncidentTypes type, const char *description,
|
||||
messageText += QString(QLatin1String(" |[Loc: %1(%2)|]")).arg(QString::fromUtf8(file)).arg(line);
|
||||
|
||||
buf = QString(QLatin1String("##teamcity[testFailed name='%1' message='%2' details='%3']\n"))
|
||||
.arg(tmpFuncName)
|
||||
.arg(messageText)
|
||||
.arg(detailedText);
|
||||
.arg(tmpFuncName,
|
||||
messageText,
|
||||
detailedText);
|
||||
|
||||
outputString(qPrintable(buf));
|
||||
}
|
||||
|
||||
if (!pendingMessages.isEmpty()) {
|
||||
buf = QString(QLatin1String("##teamcity[testStdOut name='%1' out='%2']\n"))
|
||||
.arg(tmpFuncName)
|
||||
.arg(pendingMessages);
|
||||
.arg(tmpFuncName, pendingMessages);
|
||||
|
||||
outputString(qPrintable(buf));
|
||||
|
||||
@ -209,8 +208,7 @@ void QTeamCityLogger::addMessage(MessageTypes type, const QString &message,
|
||||
escapedMessage.append(QString(QLatin1String(" |[Loc: %1(%2)|]")).arg(QString::fromUtf8(file)).arg(line));
|
||||
|
||||
buf = QString(QLatin1String("##teamcity[testIgnored name='%1' message='%2']\n"))
|
||||
.arg(escapedTestFuncName())
|
||||
.arg(escapedMessage);
|
||||
.arg(escapedTestFuncName(), escapedMessage);
|
||||
|
||||
outputString(qPrintable(buf));
|
||||
}
|
||||
@ -259,10 +257,7 @@ QString QTeamCityLogger::escapedTestFuncName() const
|
||||
: "UnknownTestFunc";
|
||||
const char *tag = QTestResult::currentDataTag() ? QTestResult::currentDataTag() : "";
|
||||
|
||||
QString str = QString(QLatin1String("%1(%2)")).arg(QString::fromUtf8(fn)).arg(QString::fromUtf8(tag));
|
||||
str = tcEscapedString(str);
|
||||
|
||||
return str;
|
||||
return tcEscapedString(QString::asprintf("%s(%s)", fn, tag));
|
||||
}
|
||||
|
||||
void QTeamCityLogger::addPendingMessage(const char *type, const QString &msg, const char *file, int line)
|
||||
@ -274,16 +269,14 @@ void QTeamCityLogger::addPendingMessage(const char *type, const QString &msg, co
|
||||
|
||||
if (file) {
|
||||
pendMessage += QString(QLatin1String("%1 |[Loc: %2(%3)|]: %4"))
|
||||
.arg(QString::fromUtf8(type))
|
||||
.arg(QString::fromUtf8(file))
|
||||
.arg(QString::fromUtf8(type), QString::fromUtf8(file))
|
||||
.arg(line)
|
||||
.arg(msg);
|
||||
|
||||
}
|
||||
else {
|
||||
pendMessage += QString(QLatin1String("%1: %2"))
|
||||
.arg(QString::fromUtf8(type))
|
||||
.arg(msg);
|
||||
.arg(QString::fromUtf8(type), msg);
|
||||
}
|
||||
|
||||
pendingMessages.append(pendMessage);
|
||||
|
@ -2096,7 +2096,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
|
||||
|
||||
// 5. Try current directory
|
||||
if (found.isEmpty()) {
|
||||
QString candidate = QString::fromLatin1("%1/%2").arg(QDir::currentPath()).arg(base);
|
||||
const QString candidate = QDir::currentPath() + QLatin1Char('/') + base;
|
||||
if (QFileInfo::exists(candidate))
|
||||
found = candidate;
|
||||
}
|
||||
|
@ -103,9 +103,8 @@ static inline QString typeNameToXml(const char *typeName)
|
||||
|
||||
static QString addFunction(const FunctionDef &mm, bool isSignal = false) {
|
||||
|
||||
QString xml = QString::fromLatin1(" <%1 name=\"%2\">\n")
|
||||
.arg(isSignal ? QLatin1String("signal") : QLatin1String("method"))
|
||||
.arg(QLatin1String(mm.name));
|
||||
QString xml = QString::asprintf(" <%s name=\"%s\">\n",
|
||||
isSignal ? "signal" : "method", mm.name.constData());
|
||||
|
||||
// check the return type first
|
||||
int typeId = QMetaType::type(mm.normalizedType.constData());
|
||||
@ -156,9 +155,9 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) {
|
||||
|
||||
const char *signature = QDBusMetaType::typeToSignature(types.at(j));
|
||||
xml += QString::fromLatin1(" <arg %1type=\"%2\" direction=\"%3\"/>\n")
|
||||
.arg(name)
|
||||
.arg(QLatin1String(signature))
|
||||
.arg(isOutput ? QLatin1String("out") : QLatin1String("in"));
|
||||
.arg(name,
|
||||
QLatin1String(signature),
|
||||
isOutput ? QLatin1String("out") : QLatin1String("in"));
|
||||
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
@ -220,9 +219,9 @@ static QString generateInterfaceXml(const ClassDef *mo)
|
||||
continue;
|
||||
|
||||
retval += QString::fromLatin1(" <property name=\"%1\" type=\"%2\" access=\"%3\"")
|
||||
.arg(QLatin1String(mp.name))
|
||||
.arg(QLatin1String(signature))
|
||||
.arg(QLatin1String(accessvalues[access]));
|
||||
.arg(QLatin1String(mp.name),
|
||||
QLatin1String(signature),
|
||||
QLatin1String(accessvalues[access]));
|
||||
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
retval += QString::fromLatin1(">\n <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"%3\"/>\n </property>\n")
|
||||
|
@ -261,7 +261,8 @@ int runRcc(int argc, char *argv[])
|
||||
} else {
|
||||
out.setFileName(outFilename);
|
||||
if (!out.open(mode)) {
|
||||
const QString msg = QString::fromLatin1("Unable to open %1 for writing: %2\n").arg(outFilename).arg(out.errorString());
|
||||
const QString msg = QString::fromLatin1("Unable to open %1 for writing: %2\n")
|
||||
.arg(outFilename, out.errorString());
|
||||
errorDevice.write(msg.toUtf8());
|
||||
return 1;
|
||||
}
|
||||
@ -282,7 +283,7 @@ int runRcc(int argc, char *argv[])
|
||||
temp.setFileName(tempFilename);
|
||||
if (!temp.open(QIODevice::ReadOnly)) {
|
||||
const QString msg = QString::fromUtf8("Unable to open temporary file %1 for reading: %2\n")
|
||||
.arg(outFilename).arg(out.errorString());
|
||||
.arg(outFilename, out.errorString());
|
||||
errorDevice.write(msg.toUtf8());
|
||||
return 1;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ void RCCResourceLibrary::writeByteArray(const QByteArray &other)
|
||||
|
||||
static inline QString msgOpenReadFailed(const QString &fname, const QString &why)
|
||||
{
|
||||
return QString::fromLatin1("Unable to open %1 for reading: %2\n").arg(fname).arg(why);
|
||||
return QString::fromLatin1("Unable to open %1 for reading: %2\n").arg(fname, why);
|
||||
}
|
||||
|
||||
|
||||
@ -499,7 +499,8 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
|
||||
QFileInfo file(absFileName);
|
||||
if (!file.exists()) {
|
||||
m_failedResources.push_back(absFileName);
|
||||
const QString msg = QString::fromLatin1("RCC: Error in '%1': Cannot find file '%2'\n").arg(fname).arg(fileName);
|
||||
const QString msg = QString::fromLatin1("RCC: Error in '%1': Cannot find file '%2'\n")
|
||||
.arg(fname, fileName);
|
||||
m_errorDevice->write(msg.toUtf8());
|
||||
if (ignoreErrors)
|
||||
continue;
|
||||
|
@ -152,7 +152,8 @@ namespace {
|
||||
if (const DomResourceIcon *dri = p->elementIconSet()) {
|
||||
if (!isIconFormat44(dri)) {
|
||||
if (dri->text().isEmpty()) {
|
||||
const QString msg = QString::fromUtf8("%1: Warning: An invalid icon property '%2' was encountered.").arg(fileName).arg(p->attributeName());
|
||||
const QString msg = QString::fromLatin1("%1: Warning: An invalid icon property '%2' was encountered.")
|
||||
.arg(fileName, p->attributeName());
|
||||
qWarning("%s", qPrintable(msg));
|
||||
return false;
|
||||
}
|
||||
@ -162,7 +163,8 @@ namespace {
|
||||
case DomProperty::Pixmap:
|
||||
if (const DomResourcePixmap *drp = p->elementPixmap())
|
||||
if (drp->text().isEmpty()) {
|
||||
const QString msg = QString::fromUtf8("%1: Warning: An invalid pixmap property '%2' was encountered.").arg(fileName).arg(p->attributeName());
|
||||
const QString msg = QString::fromUtf8("%1: Warning: An invalid pixmap property '%2' was encountered.")
|
||||
.arg(fileName, p->attributeName());
|
||||
qWarning("%s", qPrintable(msg));
|
||||
return false;
|
||||
}
|
||||
@ -1029,7 +1031,7 @@ void WriteInitialization::acceptLayoutItem(DomLayoutItem *node)
|
||||
const int row = node->attributeRow();
|
||||
const int colSpan = node->hasAttributeColSpan() ? node->attributeColSpan() : 1;
|
||||
const QString role = formLayoutRole(node->attributeColumn(), colSpan);
|
||||
addArgs = QString::fromLatin1("%1, %2, %3").arg(row).arg(role).arg(itemName);
|
||||
addArgs = QString::fromLatin1("%1, %2, %3").arg(row).arg(role, itemName);
|
||||
} else {
|
||||
addArgs = itemName;
|
||||
if (layout->attributeClass().contains(QLatin1String("Box")) && !node->attributeAlignment().isEmpty())
|
||||
@ -1364,7 +1366,7 @@ void WriteInitialization::writeProperties(const QString &varName,
|
||||
case DomProperty::Locale: {
|
||||
const DomLocale *locale = p->elementLocale();
|
||||
propertyValue = QString::fromLatin1("QLocale(QLocale::%1, QLocale::%2)")
|
||||
.arg(locale->attributeLanguage()).arg(locale->attributeCountry());
|
||||
.arg(locale->attributeLanguage(), locale->attributeCountry());
|
||||
break;
|
||||
}
|
||||
case DomProperty::SizePolicy: {
|
||||
|
@ -250,7 +250,7 @@ public:
|
||||
}
|
||||
strVertices += QString::fromLatin1("\"%1\" [label=\"%2\"]\n").arg(v->toString()).arg(v->toString());
|
||||
}
|
||||
return QString::fromLatin1("%1\n%2\n").arg(strVertices).arg(edges);
|
||||
return QString::fromLatin1("%1\n%2\n").arg(strVertices, edges);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -892,7 +892,7 @@ bool QGraphicsAnchorLayoutPrivate::replaceVertex(Orientation orientation, Anchor
|
||||
AnchorVertex *otherV = replaceVertex_helper(ad, oldV, newV);
|
||||
|
||||
#if defined(QT_DEBUG)
|
||||
ad->name = QString::fromLatin1("%1 --to--> %2").arg(ad->from->toString()).arg(ad->to->toString());
|
||||
ad->name = QString::fromLatin1("%1 --to--> %2").arg(ad->from->toString(), ad->to->toString());
|
||||
#endif
|
||||
|
||||
bool newFeasible;
|
||||
@ -1755,7 +1755,7 @@ void QGraphicsAnchorLayoutPrivate::addAnchor_helper(QGraphicsLayoutItem *firstIt
|
||||
data->from = v1;
|
||||
data->to = v2;
|
||||
#ifdef QT_DEBUG
|
||||
data->name = QString::fromLatin1("%1 --to--> %2").arg(v1->toString()).arg(v2->toString());
|
||||
data->name = QString::fromLatin1("%1 --to--> %2").arg(v1->toString(), v2->toString());
|
||||
#endif
|
||||
// ### bit to track internal anchors, since inside AnchorData methods
|
||||
// we don't have access to the 'q' pointer.
|
||||
|
@ -260,7 +260,7 @@ inline QString AnchorVertex::toString() const
|
||||
{
|
||||
if (m_type == Pair) {
|
||||
const AnchorVertexPair *vp = static_cast<const AnchorVertexPair *>(this);
|
||||
return QString::fromLatin1("(%1, %2)").arg(vp->m_first->toString()).arg(vp->m_second->toString());
|
||||
return QString::fromLatin1("(%1, %2)").arg(vp->m_first->toString(), vp->m_second->toString());
|
||||
} else if (!m_item) {
|
||||
return QString::fromLatin1("NULL_%1").arg(quintptr(this));
|
||||
}
|
||||
|
@ -2116,8 +2116,8 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant
|
||||
default:
|
||||
Q_ASSERT_X(0, "QAbstractSpinBoxPrivate::variantCompare",
|
||||
qPrintable(QString::fromLatin1("Internal error 3 (%1 %2)").
|
||||
arg(QString::fromLatin1(arg1.typeName())).
|
||||
arg(QString::fromLatin1(arg2.typeName()))));
|
||||
arg(QString::fromLatin1(arg1.typeName()),
|
||||
QString::fromLatin1(arg2.typeName()))));
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user