summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-22 23:29:58 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-22 23:29:58 +0100
commite3d8790ae7c9f8dbbcc9cd8a1fa5c0fede26b872 (patch)
treeeb06f636fcea85567db3ba3a5d06879b44034959 /src
parent0901a200ef4fedf0e78a2fb38bcf70944bfb1f8e (diff)
Small C++11 tweaks.
Diffstat (limited to 'src')
-rw-r--r--src/dcp_reader.cc12
-rw-r--r--src/effect.cc2
-rw-r--r--src/subrip_reader.cc2
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 <dcp/smpte_subtitle_asset.h>
#include <boost/filesystem.hpp>
-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<dcp::InteropSubtitleAsset>(file);
} catch (exception& e) {
interop_error = e.what ();
}
if (!sc) {
try {
- sc.reset (new dcp::SMPTESubtitleAsset (file));
+ sc = make_shared<dcp::SMPTESubtitleAsset>(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<Effect>
sub::string_to_effect (string s)
{
if (s == "none") {
- return optional<Effect> ();
+ 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<optional<string> ()> get_line)
rs.vertical_position.reference = TOP_OF_SUBTITLE;
while (true) {
- optional<string> line = get_line ();
+ auto line = get_line ();
if (!line) {
break;
}