summaryrefslogtreecommitdiff
path: root/src/interop_subtitle_asset.cc
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 02:12:03 +0200
commitf2ef41cd8c3aff05d34473c6255622a6babe3afd (patch)
treead11f162a3cfa0b28af2ca5b59655f95fa1dd467 /src/interop_subtitle_asset.cc
parentb584c2943634894357891eab6c34efdfa8cfc7c1 (diff)
Cleanup: use find_if().
Diffstat (limited to 'src/interop_subtitle_asset.cc')
-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;
}
}
}