Avoid temporary QString allocations

This fixes clazy warning: Use multi-arg instead [-Wclazy-qstring-arg]
This commit is contained in:
Chocobo1
2018-03-06 23:49:12 +08:00
parent c60b7b213e
commit 0457fd260e
29 changed files with 137 additions and 123 deletions

View File

@@ -726,7 +726,7 @@ void TorrentsController::setLocationAction()
applyToTorrents(hashes, [newLocation](BitTorrent::TorrentHandle *torrent)
{
LogMsg(tr("WebUI Set location: moving \"%1\", from \"%2\" to \"%3\"")
.arg(torrent->name()).arg(torrent->savePath()).arg(newLocation));
.arg(torrent->name(), torrent->savePath(), newLocation));
torrent->move(Utils::Fs::expandPathAbs(newLocation));
});
}

View File

@@ -456,7 +456,7 @@ void WebApplication::sendFile(const QString &path)
qDebug("File %s was not found!", qUtf8Printable(path));
throw NotFoundHTTPError();
}
if (file.size() > MAX_ALLOWED_FILESIZE) {
qWarning("%s: exceeded the maximum allowed file size!", qUtf8Printable(path));
throw InternalServerErrorHTTPError(tr("Exceeded the maximum allowed file size (%1)!")
@@ -579,7 +579,7 @@ bool WebApplication::isAuthNeeded()
bool WebApplication::isPublicAPI(const QString &scope, const QString &action) const
{
return m_publicAPIs.contains(QString::fromLatin1("%1/%2").arg(scope).arg(action));
return m_publicAPIs.contains(QString::fromLatin1("%1/%2").arg(scope, action));
}
void WebApplication::sessionStart()
@@ -643,7 +643,7 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const
const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), originValue);
if (isInvalid)
LogMsg(tr("WebUI: Origin header & Target origin mismatch! Source IP: '%1'. Origin header: '%2'. Target origin: '%3'")
.arg(m_env.clientAddress.toString()).arg(originValue).arg(targetOrigin)
.arg(m_env.clientAddress.toString(), originValue, targetOrigin)
, Log::WARNING);
return isInvalid;
}
@@ -652,7 +652,7 @@ bool WebApplication::isCrossSiteRequest(const Http::Request &request) const
const bool isInvalid = !isSameOrigin(urlFromHostHeader(targetOrigin), refererValue);
if (isInvalid)
LogMsg(tr("WebUI: Referer header & Target origin mismatch! Source IP: '%1'. Referer header: '%2'. Target origin: '%3'")
.arg(m_env.clientAddress.toString()).arg(refererValue).arg(targetOrigin)
.arg(m_env.clientAddress.toString(), refererValue, targetOrigin)
, Log::WARNING);
return isInvalid;
}
@@ -701,7 +701,7 @@ bool WebApplication::validateHostHeader(const QStringList &domains) const
}
LogMsg(tr("WebUI: Invalid Host header. Request source IP: '%1'. Received Host header: '%2'")
.arg(m_env.clientAddress.toString()).arg(m_request.headers[Http::HEADER_HOST])
.arg(m_env.clientAddress.toString(), m_request.headers[Http::HEADER_HOST])
, Log::WARNING);
return false;
}