From 776c1f1546c9defa0384ec1b853302d95e59a85d Mon Sep 17 00:00:00 2001 From: FranciscoPombal Date: Tue, 22 Sep 2020 14:38:11 +0100 Subject: [PATCH 1/2] Always use multi-arg arg() overload when possible Fixed clazy-qstring-arg Clazy warnings --- src/app/cmdoptions.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/cmdoptions.cpp b/src/app/cmdoptions.cpp index ffb7b8c7c..90c1fcd6a 100644 --- a/src/app/cmdoptions.cpp +++ b/src/app/cmdoptions.cpp @@ -160,7 +160,7 @@ namespace return Utils::String::unquote(parts[1], QLatin1String("'\"")); throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'", "e.g. Parameter '--webui-port' must follow syntax '--webui-port=value'") - .arg(fullParameter()).arg(QLatin1String(""))); + .arg(fullParameter(), QLatin1String(""))); } QString value(const QProcessEnvironment &env, const QString &defaultValue = {}) const @@ -206,7 +206,7 @@ namespace if (!ok) throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'", "e.g. Parameter '--webui-port' must follow syntax '--webui-port='") - .arg(fullParameter()).arg(QLatin1String(""))); + .arg(fullParameter(), QLatin1String(""))); return res; } @@ -274,8 +274,7 @@ namespace throw CommandLineParameterError(QObject::tr("Parameter '%1' must follow syntax '%1=%2'", "e.g. Parameter '--add-paused' must follow syntax " "'--add-paused='") - .arg(fullParameter()) - .arg(QLatin1String(""))); + .arg(fullParameter(), QLatin1String(""))); } TriStateBool value(const QProcessEnvironment &env) const From f502f60f7cb8d4f472f1485efbe2301e4f396322 Mon Sep 17 00:00:00 2001 From: FranciscoPombal Date: Tue, 22 Sep 2020 17:12:01 +0100 Subject: [PATCH 2/2] Avoid unessary QString allocation --- src/base/bittorrent/tracker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/bittorrent/tracker.cpp b/src/base/bittorrent/tracker.cpp index 06cc4f8d5..bbf059e0c 100644 --- a/src/base/bittorrent/tracker.cpp +++ b/src/base/bittorrent/tracker.cpp @@ -238,7 +238,7 @@ Http::Response Tracker::processRequest(const Http::Request &request, const Http: if (request.method != Http::HEADER_REQUEST_METHOD_GET) throw MethodNotAllowedHTTPError(); - if (request.path.toLower().startsWith(ANNOUNCE_REQUEST_PATH)) + if (request.path.startsWith(ANNOUNCE_REQUEST_PATH, Qt::CaseInsensitive)) processAnnounceRequest(); else throw NotFoundHTTPError();