summaryrefslogtreecommitdiff
path: root/methods/mirror.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2019-07-08 15:48:59 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2019-07-08 15:51:17 +0200
commit2b734a7ec429825c7007c1093883229e069d36c7 (patch)
treeb67360f3201634c82f5a9e7dd84f47b28fa63acb /methods/mirror.cc
parentcbe90ee516d7f747f981e423f164f99eb767240b (diff)
Apply various suggestions by cppcheck
Reported-By: cppcheck
Diffstat (limited to 'methods/mirror.cc')
-rw-r--r--methods/mirror.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/methods/mirror.cc b/methods/mirror.cc
index dcf4cbd13..3e382e497 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -56,7 +56,7 @@ class MirrorMethod : public aptMethod /*{{{*/
unsigned long priority = std::numeric_limits<decltype(priority)>::max();
decltype(genrng)::result_type seed = 0;
std::unordered_map<std::string, std::vector<std::string>> tags;
- MirrorInfo(std::string const &u, std::vector<std::string> &&ptags = {}) : uri(u)
+ explicit MirrorInfo(std::string const &u, std::vector<std::string> &&ptags = {}) : uri(u)
{
for (auto &&tag : ptags)
{
@@ -222,8 +222,7 @@ bool MirrorMethod::MirrorListFileRecieved(MirrorListInfo &info, FetchItem *const
[&access](char const *const a) { return APT::String::Endswith(access, std::string("+") + a); }) ||
access == "mirror")
{
- for (auto const &a : disallowLocal)
- limitAccess.emplace_back(a);
+ std::copy(std::begin(disallowLocal), std::end(disallowLocal), std::back_inserter(limitAccess));
}
std::string line;
while (mirrorlist.ReadLine(line))
@@ -323,12 +322,9 @@ std::string MirrorMethod::GetMirrorFileURI(std::string const &Message, FetchItem
if (plus < colon)
{
// started as tor+mirror+http we want to get the file via tor+http
- auto access = uristr.substr(0, colon);
- std::string prefixAccess;
+ auto const access = uristr.substr(0, colon);
if (APT::String::Startswith(access, "mirror") == false)
{
- prefixAccess = uristr.substr(0, plus);
- access.erase(0, plus + 1);
uristr.erase(plus, strlen("mirror") + 1);
return uristr;
}