diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-10 16:38:33 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-12 09:13:51 +0100 |
| commit | b1dc9c3a2f7e55c9afc5bf2d5b465371b048e14f (patch) | |
| tree | 9968238c6c0511f044e6fcdb4abcc08b5eb28f27 /src/lib/dcpomatic_time.cc | |
| parent | 4a0ae92e28d7d1f0dd648d1b620efc324fdef161 (diff) | |
Remove all use of stringstream in an attempt to fix
the suspected thread-unsafe crash bugs on OS X.
Diffstat (limited to 'src/lib/dcpomatic_time.cc')
| -rw-r--r-- | src/lib/dcpomatic_time.cc | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/lib/dcpomatic_time.cc b/src/lib/dcpomatic_time.cc index f96688979..6563c6e5f 100644 --- a/src/lib/dcpomatic_time.cc +++ b/src/lib/dcpomatic_time.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington <cth@carlh.net> + Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -19,8 +19,9 @@ */ #include "dcpomatic_time.h" +#include <inttypes.h> -using std::ostream; +using std::string; template <> Time<ContentTimeDifferentiator, DCPTimeDifferentiator>::Time (DCPTime d, FrameRateChange f) @@ -76,23 +77,26 @@ max (ContentTime a, ContentTime b) return b; } -ostream & -operator<< (ostream& s, ContentTime t) +string +to_string (ContentTime t) { - s << "[CONT " << t.get() << " " << t.seconds() << "s]"; - return s; + char buffer[64]; + snprintf (buffer, sizeof(buffer), "[CONT %" PRId64 " %fs]", t.get(), t.seconds()); + return buffer; } -ostream & -operator<< (ostream& s, DCPTime t) +string +to_string (DCPTime t) { - s << "[DCP " << t.get() << " " << t.seconds() << "s]"; - return s; + char buffer[64]; + snprintf (buffer, sizeof(buffer), "[DCP %" PRId64 " %fs]", t.get(), t.seconds()); + return buffer; } -ostream & -operator<< (ostream& s, DCPTimePeriod p) +string +to_string (DCPTimePeriod p) { - s << "[DCP " << p.from.get() << " " << p.from.seconds() << "s -> " << p.to.get() << " " << p.to.seconds() << "s]"; - return s; + char buffer[64]; + snprintf (buffer, sizeof(buffer), "[DCP %" PRId64 " %fs -> %" PRId64 " %fs]", p.from.get(), p.from.seconds(), p.to.get(), p.to.seconds()); + return buffer; } |
