X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_kdm.cc;h=ae7d97f4f08a46d4d939aca9647c3920cfed39c7;hb=5f2a8e5892db9c0f578be0be29b9e157482cfed6;hp=2ad07cce7a38bae73c62f2b1824def725e9ada34;hpb=40b654453c2ce0b266f43c36f1b9a5d1705f983c;p=dcpomatic.git diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 2ad07cce7..ae7d97f4f 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -17,6 +17,10 @@ */ +/** @file src/tools/dcpomatic_kdm.cc + * @brief Command-line program to generate KDMs. + */ + #include #include #include "lib/film.h" @@ -24,17 +28,15 @@ #include "lib/kdm.h" #include "lib/config.h" #include "lib/exceptions.h" +#include "lib/safe_stringstream.h" using std::string; -using std::stringstream; using std::cout; using std::cerr; using std::list; using std::vector; using boost::shared_ptr; -static string program_name; - static void help () { @@ -76,7 +78,7 @@ time_from_string (string t) static boost::posix_time::time_duration duration_from_string (string d) { - stringstream s (d); + SafeStringStream s (d); int N; string unit; s >> N >> unit; @@ -177,7 +179,7 @@ int main (int argc, char* argv[]) } else if (string (optarg) == "dci-specific") { formulation = dcp::DCI_SPECIFIC; } else { - error ("unrecognised KDM formulation " + formulation); + error ("unrecognised KDM formulation " + string (optarg)); } } } @@ -248,7 +250,7 @@ int main (int argc, char* argv[]) error ("you must specify --output"); } - shared_ptr certificate (new dcp::Certificate (boost::filesystem::path (certificate_file))); + dcp::Certificate certificate (dcp::file_to_string (certificate_file)); dcp::EncryptedKDM kdm = film->make_kdm (certificate, cpl, valid_from.get(), valid_to.get(), formulation); kdm.as_xml (output); if (verbose) {