projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Forward-port 86a5cdbe6ddb3506515cf8585a0902937147862e from master; crash when repeati...
[dcpomatic.git]
/
src
/
tools
/
dcpomatic_kdm.cc
diff --git
a/src/tools/dcpomatic_kdm.cc
b/src/tools/dcpomatic_kdm.cc
index fa14dd141ad03f210380e76fa1245b534e6d5b96..ae7d97f4f08a46d4d939aca9647c3920cfed39c7 100644
(file)
--- 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 <getopt.h>
#include <dcp/certificates.h>
#include "lib/film.h"
#include <getopt.h>
#include <dcp/certificates.h>
#include "lib/film.h"
@@
-24,17
+28,15
@@
#include "lib/kdm.h"
#include "lib/config.h"
#include "lib/exceptions.h"
#include "lib/kdm.h"
#include "lib/config.h"
#include "lib/exceptions.h"
+#include "lib/safe_stringstream.h"
using std::string;
using std::string;
-using std::stringstream;
using std::cout;
using std::cerr;
using std::list;
using std::vector;
using boost::shared_ptr;
using std::cout;
using std::cerr;
using std::list;
using std::vector;
using boost::shared_ptr;
-static string program_name;
-
static void
help ()
{
static void
help ()
{
@@
-76,7
+78,7
@@
time_from_string (string t)
static boost::posix_time::time_duration
duration_from_string (string d)
{
static boost::posix_time::time_duration
duration_from_string (string d)
{
-
strings
tream s (d);
+
SafeStringS
tream s (d);
int N;
string unit;
s >> N >> unit;
int N;
string unit;
s >> N >> unit;
@@
-116,7
+118,7
@@
int main (int argc, char* argv[])
program_name = argv[0];
int option_index = 0;
program_name = argv[0];
int option_index = 0;
- while (
1
) {
+ while (
true
) {
static struct option long_options[] = {
{ "help", no_argument, 0, 'h'},
{ "output", required_argument, 0, 'o'},
static struct option long_options[] = {
{ "help", no_argument, 0, 'h'},
{ "output", required_argument, 0, 'o'},
@@
-177,7
+179,7
@@
int main (int argc, char* argv[])
} else if (string (optarg) == "dci-specific") {
formulation = dcp::DCI_SPECIFIC;
} else {
} 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");
}
error ("you must specify --output");
}
-
shared_ptr<dcp::Certificate> 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) {
dcp::EncryptedKDM kdm = film->make_kdm (certificate, cpl, valid_from.get(), valid_to.get(), formulation);
kdm.as_xml (output);
if (verbose) {