summaryrefslogtreecommitdiffstats
path: root/src/tools/rcc
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2017-01-06 22:02:50 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2017-01-12 17:54:28 +0000
commitdcec1420ea9d7e90bbd7f37be15d8e61eaf35d23 (patch)
tree950020aadfc183963a5668263ef302d8d6b0e6de /src/tools/rcc
parent8f469e4a19feb77758fb5d3c7120ba93cf32cd7d (diff)
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>
Diffstat (limited to 'src/tools/rcc')
-rw-r--r--src/tools/rcc/main.cpp5
-rw-r--r--src/tools/rcc/rcc.cpp5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp
index 423b566896..f749b90019 100644
--- a/src/tools/rcc/main.cpp
+++ b/src/tools/rcc/main.cpp
@@ -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;
}
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index c8ac554cd4..24dc1092ef 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -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;