Consider assets outside the DCP as referenced assets (i.e.
[libdcp.git] / src / interop_subtitle_asset.cc
index a3850f0408b7b02137336b61449e8d86c16fdee6..c64796126724609cd403dbbb088a6325f7d5faba 100644 (file)
@@ -84,7 +84,7 @@ InteropSubtitleAsset::xml_as_string () const
                load_font->set_attribute ("URI", (*i)->uri);
        }
 
-       subtitles_as_xml (root, 250, "");
+       subtitles_as_xml (root, 250, INTEROP);
 
        return doc.write_to_string_formatted ("UTF-8");
 }
@@ -159,12 +159,12 @@ InteropSubtitleAsset::write (boost::filesystem::path p) const
 
        BOOST_FOREACH (shared_ptr<InteropLoadFontNode> i, _load_font_nodes) {
                boost::filesystem::path file = p.parent_path() / i->uri;
-               FILE* f = fopen_boost (file, "w");
+               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->load_id != i->id) {
+               while (j != _fonts.end() && j->load_id != i->id) {
                        ++j;
                }
                if (j != _fonts.end ()) {