Use Data::write() to clean things up slightly.
authorCarl Hetherington <cth@carlh.net>
Thu, 10 Sep 2020 20:16:43 +0000 (22:16 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 10 Sep 2020 23:03:42 +0000 (01:03 +0200)
src/interop_subtitle_asset.cc

index 39521ed75edf87836ac60d7e50dab23f79fe07c4..6c9c6b42a3be235eb817a183a8f59452badbbe59 100644 (file)
@@ -198,19 +198,14 @@ InteropSubtitleAsset::write (boost::filesystem::path p) const
        /* Fonts */
        BOOST_FOREACH (shared_ptr<InteropLoadFontNode> i, _load_font_nodes) {
                boost::filesystem::path file = p.parent_path() / i->uri;
-               FILE* f = fopen_boost (file, "wb");
-               if (!f) {
-                       throw FileError ("could not open font file for writing", file, errno);
-               }
                list<Font>::const_iterator j = _fonts.begin ();
                while (j != _fonts.end() && j->load_id != i->id) {
                        ++j;
                }
                if (j != _fonts.end ()) {
-                       fwrite (j->data.data().get(), 1, j->data.size(), f);
+                       j->data.write (file);
                        j->file = file;
                }
-               fclose (f);
        }
 }