diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-24 14:14:02 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-24 14:14:02 +0100 |
| commit | 094117316524f12fc82adbdf721778eed04e66f6 (patch) | |
| tree | aaa2abd88a2aba64d53022554265f000c93be966 /src/subtitle_asset.cc | |
| parent | 2ae92dcc97765deb2845dd07a338858aeb375cb3 (diff) | |
Give Data a loading constructor.
Diffstat (limited to 'src/subtitle_asset.cc')
| -rw-r--r-- | src/subtitle_asset.cc | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc index 8d492727..367c3455 100644 --- a/src/subtitle_asset.cc +++ b/src/subtitle_asset.cc @@ -311,21 +311,7 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* root, int time_code_rate, strin void SubtitleAsset::add_font_data (string id, boost::filesystem::path file) { - boost::uintmax_t size = boost::filesystem::file_size (file); - FILE* f = fopen_boost (file, "rb"); - if (!f) { - throw FileError ("could not open font file for reading", file, errno); - } - - shared_array<uint8_t> data (new uint8_t[size]); - size_t const read = fread (data.get(), 1, size, f); - fclose (f); - - if (read != size) { - throw FileError ("could not read font file", file, -1); - } - - _fonts[id] = FileData (data, size); + _fonts[id] = FileData (file); } map<string, Data> |
