summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-05-28 02:12:03 +0200
committerCarl Hetherington <cth@carlh.net>2023-05-28 20:55:25 +0200
commitaf8a3bcc86e89afac79ee6bda3fea811f25f3cc8 (patch)
tree1d2a5e93e1ed6d74c75249eff8bba999d678bb11 /src
parent1e010ab5f1b05cb3ae8ee7ea61f5c011ffe430c5 (diff)
Cleanup: use find_if().
Diffstat (limited to 'src')
-rw-r--r--src/interop_subtitle_asset.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc
index 8fb115a7..0116c11c 100644
--- a/src/interop_subtitle_asset.cc
+++ b/src/interop_subtitle_asset.cc
@@ -214,13 +214,10 @@ InteropSubtitleAsset::write (boost::filesystem::path p) const
/* Fonts */
for (auto i: _load_font_nodes) {
auto file = p.parent_path() / i->uri;
- auto j = _fonts.begin();
- while (j != _fonts.end() && j->load_id != i->id) {
- ++j;
- }
- if (j != _fonts.end ()) {
- j->data.write (file);
- j->file = file;
+ auto font_with_id = std::find_if(_fonts.begin(), _fonts.end(), [i](Font const& font) { return font.load_id == i->id; });
+ if (font_with_id != _fonts.end()) {
+ font_with_id->data.write(file);
+ font_with_id->file = file;
}
}
}