From: Remi Gacogne Date: Mon, 20 Nov 2023 11:07:35 +0000 (+0100) Subject: YaHTTP: Fix a few 'copy instead of move' warnings from Coverity X-Git-Tag: rec-5.0.0-rc1~28^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df8eed78a5b761af6ad33c8ab922ab3e39ed67f1;p=thirdparty%2Fpdns.git YaHTTP: Fix a few 'copy instead of move' warnings from Coverity --- diff --git a/ext/yahttp/yahttp/cookie.hpp b/ext/yahttp/yahttp/cookie.hpp index aa5359b1a7..9e50d8bb39 100644 --- a/ext/yahttp/yahttp/cookie.hpp +++ b/ext/yahttp/yahttp/cookie.hpp @@ -118,7 +118,7 @@ namespace YaHTTP { if (s.find("=") != std::string::npos) keyValuePair(s, k, v); else - k = s; + k = std::move(s); if (k == "expires") { DateTime dt; dt.parseCookie(v); diff --git a/ext/yahttp/yahttp/reqresp.cpp b/ext/yahttp/yahttp/reqresp.cpp index e5f9c95ecc..a96def6e0d 100644 --- a/ext/yahttp/yahttp/reqresp.cpp +++ b/ext/yahttp/yahttp/reqresp.cpp @@ -136,7 +136,7 @@ namespace YaHTTP { if (target->headers.find(key) != target->headers.end()) { target->headers[key] = target->headers[key] + ";" + value; } else { - target->headers[key] = value; + target->headers[key] = std::move(value); } } } diff --git a/ext/yahttp/yahttp/router.cpp b/ext/yahttp/yahttp/router.cpp index 18ea9b6fcf..90612ad8ec 100644 --- a/ext/yahttp/yahttp/router.cpp +++ b/ext/yahttp/yahttp/router.cpp @@ -88,10 +88,10 @@ namespace YaHTTP { funcptr::tie(p1,p2) = i->second; std::string value(req->url.path.begin() + p1, req->url.path.begin() + p2); value = Utility::decodeURL(value); - req->parameters[i->first] = value; + req->parameters[i->first] = std::move(value); } - req->routeName = rname; + req->routeName = std::move(rname); return true; }; diff --git a/ext/yahttp/yahttp/utility.hpp b/ext/yahttp/yahttp/utility.hpp index 23e6b8a59d..1d5e41efea 100644 --- a/ext/yahttp/yahttp/utility.hpp +++ b/ext/yahttp/yahttp/utility.hpp @@ -392,7 +392,7 @@ namespace YaHTTP { } key = decodeURL(key); value = decodeURL(value); - parameter_map[key] = value; + parameter_map[key] = std::move(value); if (nextpos == std::string::npos) { // no more parameters left break;