X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Finterop_subtitle_asset.cc;h=0116c11c539a1a2d0390a6ac1003a6af9f8427b5;hb=af8a3bcc86e89afac79ee6bda3fea811f25f3cc8;hp=8fb115a73ee8a6eef4a6294dc3409f511ff45a57;hpb=1e010ab5f1b05cb3ae8ee7ea61f5c011ffe430c5;p=libdcp.git 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; } } }