summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/tds
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/plugins/sqldrivers/tds
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/plugins/sqldrivers/tds')
-rw-r--r--src/plugins/sqldrivers/tds/qsql_tds.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/sqldrivers/tds/qsql_tds.cpp b/src/plugins/sqldrivers/tds/qsql_tds.cpp
index 940fd05c74..6ebd09a572 100644
--- a/src/plugins/sqldrivers/tds/qsql_tds.cpp
+++ b/src/plugins/sqldrivers/tds/qsql_tds.cpp
@@ -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();