diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-11-25 11:23:07 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-11-25 11:23:07 +0000 |
| commit | 6b8fdf76aa221f037140bbf0ee1aa835df60778f (patch) | |
| tree | 7798c30001a4fea8af5ba9e19c9ad5fd62d6ce17 /src/subtitle_asset.cc | |
| parent | 331045156161a30ee74e734c7c14dd602ebbbbc9 (diff) | |
Remove a possibly dodgy use of fstream.
Diffstat (limited to 'src/subtitle_asset.cc')
| -rw-r--r-- | src/subtitle_asset.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index d48d4ac0..97c48978 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -302,12 +302,14 @@ struct SubtitleSorter { void SubtitleAsset::write_xml () const { - ofstream s (path().string().c_str()); - write_xml (s); + FILE* f = fopen_boost (path (), "r"); + Glib::ustring const s = xml_as_string (); + fwrite (s.c_str(), 1, s.length(), f); + fclose (f); } -void -SubtitleAsset::write_xml (ostream& s) const +Glib::ustring +SubtitleAsset::xml_as_string () const { xmlpp::Document doc; xmlpp::Element* root = doc.create_root_node ("DCSubtitle"); @@ -415,6 +417,6 @@ SubtitleAsset::write_xml (ostream& s) const text->add_child_text ((*i)->text()); } - doc.write_to_stream_formatted (s, "UTF-8"); + return doc.write_to_string_formatted ("UTF-8"); } |
