Supporter.
[dcpomatic.git] / src / lib / content.cc
index 1ec607d394896b8ec0dbdc7ad1dbeacb7cfb7393..11a4b21cca3026706911cb0c51ea9230eabc8797 100644 (file)
 #include "ui_signaller.h"
 #include "exceptions.h"
 #include "film.h"
+#include "safe_stringstream.h"
 
 #include "i18n.h"
 
 using std::string;
-using std::stringstream;
 using std::set;
 using std::list;
 using std::cout;
 using std::vector;
+using std::max;
 using boost::shared_ptr;
 using libdcp::raw_convert;
 
@@ -211,7 +212,7 @@ Content::technical_summary () const
 Time
 Content::length_after_trim () const
 {
-       return full_length() - trim_start() - trim_end();
+       return max (int64_t (0), full_length() - trim_start() - trim_end());
 }
 
 /** @param t A time relative to the start of this content (not the position).
@@ -229,7 +230,7 @@ Content::trimmed (Time t) const
 string
 Content::identifier () const
 {
-       stringstream s;
+       SafeStringStream s;
        
        s << Content::digest()
          << "_" << position()