Remove all use of stringstream in an attempt to fix
[dcpomatic.git] / src / tools / dcpomatic_kdm_cli.cc
index ad5ee1c7bbcdae99ae298f1cba7359038a92fc3e..5126e1954c10405b1929c2acf0a72e1b188afa11 100644 (file)
@@ -29,7 +29,6 @@
 #include "lib/config.h"
 #include "lib/exceptions.h"
 #include "lib/emailer.h"
-#include <locked_sstream.h>
 #include <dcp/certificate.h>
 #include <getopt.h>
 #include <iostream>
@@ -82,10 +81,10 @@ time_from_string (string t)
 static boost::posix_time::time_duration
 duration_from_string (string d)
 {
-       locked_stringstream s (d);
        int N;
-       string unit;
-       s >> N >> unit;
+       char unit_buf[64] = "\0";
+       sscanf (d.c_str(), "%d %64s", &N, unit_buf);
+       string const unit (unit_buf);
 
        if (N == 0) {
                cerr << "Could not understand duration \"" << d << "\"\n";
@@ -284,10 +283,10 @@ int main (int argc, char* argv[])
                        output = ".";
                }
 
-               NameFormat::Map values;
-               values["film_name"] = film->name();
-               values["from"] = dcp::LocalTime(valid_from.get()).date() + " " + dcp::LocalTime(valid_from.get()).time_of_day();
-               values["to"] = dcp::LocalTime(valid_to.get()).date() + " " + dcp::LocalTime(valid_to.get()).time_of_day();
+               dcp::NameFormat::Map values;
+               values['f'] = film->name();
+               values['b'] = dcp::LocalTime(valid_from.get()).date() + " " + dcp::LocalTime(valid_from.get()).time_of_day();
+               values['e'] = dcp::LocalTime(valid_to.get()).date() + " " + dcp::LocalTime(valid_to.get()).time_of_day();
 
                try {
                        list<ScreenKDM> screen_kdms = film->make_kdms (