From e3d8790ae7c9f8dbbcc9cd8a1fa5c0fede26b872 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 22 Jan 2021 23:29:58 +0100 Subject: [PATCH] Small C++11 tweaks. --- src/dcp_reader.cc | 12 ++++++------ src/effect.cc | 2 +- src/subrip_reader.cc | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dcp_reader.cc b/src/dcp_reader.cc index 663ddf8..0c7a29a 100644 --- a/src/dcp_reader.cc +++ b/src/dcp_reader.cc @@ -25,12 +25,12 @@ #include #include -using std::cout; -using std::string; +using std::dynamic_pointer_cast; using std::exception; +using std::make_shared; using std::shared_ptr; +using std::string; using boost::optional; -using std::dynamic_pointer_cast; using namespace sub; static Time @@ -52,21 +52,21 @@ DCPReader::DCPReader (boost::filesystem::path file) string smpte_error; try { - sc.reset (new dcp::InteropSubtitleAsset (file)); + sc = make_shared(file); } catch (exception& e) { interop_error = e.what (); } if (!sc) { try { - sc.reset (new dcp::SMPTESubtitleAsset (file)); + sc = make_shared(file); } catch (exception& e) { smpte_error = e.what(); } } if (!sc) { - throw DCPError (String::compose ("Could not read subtitles (%1 / %2)", interop_error, smpte_error)); + throw DCPError(String::compose("Could not read subtitles (%1 / %2)", interop_error, smpte_error)); } diff --git a/src/effect.cc b/src/effect.cc index 57eb863..dfdb40b 100644 --- a/src/effect.cc +++ b/src/effect.cc @@ -29,7 +29,7 @@ optional sub::string_to_effect (string s) { if (s == "none") { - return optional (); + return {}; } else if (s == "border") { return BORDER; } else if (s == "shadow") { diff --git a/src/subrip_reader.cc b/src/subrip_reader.cc index ab10f68..8ba7c7d 100644 --- a/src/subrip_reader.cc +++ b/src/subrip_reader.cc @@ -73,7 +73,7 @@ SubripReader::read (function ()> get_line) rs.vertical_position.reference = TOP_OF_SUBTITLE; while (true) { - optional line = get_line (); + auto line = get_line (); if (!line) { break; } -- 2.30.2