diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-04-12 22:34:04 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-20 20:04:21 +0200 |
| commit | 05bfa3d1fe9e274ed195647c6f74cb272f00c23d (patch) | |
| tree | 1372760463b288ff4e10ef7fb6e7414e202829f5 /src/interop_subtitle_asset.cc | |
| parent | 0338e7a7c19617f9ebb64ee02fbf3cceab8cf03f (diff) | |
Add and use new File class.master
It was always a bit troubling that fopen_boost wasn't exception safe,
and this also fixes a leak where load_ratings_list would never close
the ratings file.
Diffstat (limited to 'src/interop_subtitle_asset.cc')
| -rw-r--r-- | src/interop_subtitle_asset.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc index bb0cad70..798f1cda 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_subtitle_asset.cc @@ -40,6 +40,7 @@ #include "compose.hpp" #include "dcp_assert.h" #include "font_asset.h" +#include "file.h" #include "interop_load_font_node.h" #include "interop_subtitle_asset.h" #include "raw_convert.h" @@ -191,15 +192,14 @@ InteropSubtitleAsset::load_font_nodes () const void InteropSubtitleAsset::write (boost::filesystem::path p) const { - auto f = fopen_boost (p, "w"); + File f(p, "w"); if (!f) { throw FileError ("Could not open file for writing", p, -1); } _raw_xml = xml_as_string (); /* length() here gives bytes not characters */ - fwrite (_raw_xml->c_str(), 1, _raw_xml->length(), f); - fclose (f); + f.write(_raw_xml->c_str(), 1, _raw_xml->length()); _file = p; |
