diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-03 23:27:45 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-01-03 23:28:09 +0000 |
| commit | a91bea661cc505211d97e3905b30fd1f629f2a06 (patch) | |
| tree | 1848e6b5fe8e62c71d457085b36d95e71df3d509 /src | |
| parent | 57b4063573a6a4272a4283617dc6a6e2aba29303 (diff) | |
Simplify the implementation of DCP::add.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dcp.cc | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -363,13 +363,10 @@ DCP::all_encrypted () const void DCP::add (DecryptedKDM const & kdm) { - auto keys = kdm.keys (); - - for (auto i: cpls()) { - for (auto const& j: kdm.keys()) { - if (j.cpl_id() == i->id()) { - i->add (kdm); - } + auto keys = kdm.keys(); + for (auto cpl: cpls()) { + if (std::any_of(keys.begin(), keys.end(), [cpl](DecryptedKDMKey const& key) { return key.cpl_id() == cpl->id(); })) { + cpl->add (kdm); } } } |
