diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-03 23:27:45 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-20 20:06:50 +0200 |
| commit | 3da5ba894243cb65c489f6acbcf4a37095130563 (patch) | |
| tree | 44416ed64b8059fb5b72ae3cbaec17ad5f0707b9 /src | |
| parent | fbf4e083ac834a94167d5d0e3d715206cb736a23 (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); } } } |
