summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2019-09-13 12:01:47 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2019-11-26 12:36:46 +0100
commit35012abf30ec1cfc9b5ee29647d4b1e25d98e99f (patch)
treeef2db5018db5878c4fc467bbcaabaac911831c3f /methods
parentfe3627d769006a223ff65afff52a21d9ba479cdf (diff)
Fix some style warnings from cppcheck
Unused variable, std::algorithms instead of raw for-loops. There should be no observeable difference in behaviour. Reported-By: cppcheck Gbp-Dch: Ignore
Diffstat (limited to 'methods')
-rw-r--r--methods/gpgv.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 04a4f6a83..660041764 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -309,18 +309,16 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
auto const master = SubKeyMapping.find(l);
if (master == SubKeyMapping.end())
continue;
- for (auto const &sub : master->second)
- if (IsTheSameKey(sub, good))
- {
- if (std::find(Signers.Valid.cbegin(), Signers.Valid.cend(), sub) == Signers.Valid.cend())
- continue;
- found = true;
- Signers.SignedBy.push_back(l);
- Signers.SignedBy.push_back(sub + "!");
- break;
- }
- if (found)
+ auto const validsubkeysig = std::find_if(master->second.cbegin(), master->second.cend(), [&](auto const subkey) {
+ return IsTheSameKey(subkey, good) && std::find(Signers.Valid.cbegin(), Signers.Valid.cend(), subkey) != Signers.Valid.cend();
+ });
+ if (validsubkeysig != master->second.cend())
+ {
+ found = true;
+ Signers.SignedBy.push_back(l);
+ Signers.SignedBy.push_back(*validsubkeysig + "!");
break;
+ }
}
}
if (Debug)