X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fsubtitle_analysis.cc;h=9b3ae86c065656ad71394e0b01575ed30f2af4e1;hp=49041151f6260ab44a2ad02d7ee2ae162587ddd4;hb=HEAD;hpb=dd9be86db6cde0afa5da0d1d1ac43b42e05dca26 diff --git a/src/lib/subtitle_analysis.cc b/src/lib/subtitle_analysis.cc index 49041151f..ff1969a3a 100644 --- a/src/lib/subtitle_analysis.cc +++ b/src/lib/subtitle_analysis.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2020 Carl Hetherington + Copyright (C) 2020-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,18 +18,23 @@ */ + #include "subtitle_analysis.h" #include "exceptions.h" -#include "warnings.h" #include +#include #include -DCPOMATIC_DISABLE_WARNINGS +#include +LIBDCP_DISABLE_WARNINGS #include -DCPOMATIC_ENABLE_WARNINGS +LIBDCP_ENABLE_WARNINGS + +using std::make_shared; +using std::shared_ptr; using std::string; using dcp::raw_convert; -using std::shared_ptr; + int const SubtitleAnalysis::_current_state_version = 1; @@ -38,7 +43,7 @@ SubtitleAnalysis::SubtitleAnalysis (boost::filesystem::path path) { cxml::Document f ("SubtitleAnalysis"); - f.read_file (path); + f.read_file(dcp::filesystem::fix_long_path(path)); if (f.optional_number_child("Version").get_value_or(1) < _current_state_version) { /* Too old. Throw an exception so that this analysis is re-run. */ @@ -62,13 +67,13 @@ SubtitleAnalysis::SubtitleAnalysis (boost::filesystem::path path) void SubtitleAnalysis::write (boost::filesystem::path path) const { - shared_ptr doc (new xmlpp::Document); + auto doc = make_shared(); xmlpp::Element* root = doc->create_root_node ("SubtitleAnalysis"); root->add_child("Version")->add_child_text (raw_convert(_current_state_version)); if (_bounding_box) { - xmlpp::Element* bounding_box = root->add_child("BoundingBox"); + auto bounding_box = root->add_child("BoundingBox"); bounding_box->add_child("X")->add_child_text(raw_convert(_bounding_box->x)); bounding_box->add_child("Y")->add_child_text(raw_convert(_bounding_box->y)); bounding_box->add_child("Width")->add_child_text(raw_convert(_bounding_box->width)); @@ -81,4 +86,3 @@ SubtitleAnalysis::write (boost::filesystem::path path) const doc->write_to_file_formatted (path.string()); } -