summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-08-19 21:01:28 +0100
committerCarl Hetherington <cth@carlh.net>2014-08-19 21:01:28 +0100
commit9a2b45caa81d8fb056802dfe3c25f214e808ffdf (patch)
tree1cead4781d2a8546c3ba8b8f936d18bf8e8a6403 /src/lib/util.cc
parentaa3565457977dabb658f41c71e14151473b91f07 (diff)
Use SafeStringStream instead of std::stringstream to try to fix random crashes on OS X.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 6f3907391..d96001d13 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -22,7 +22,6 @@
* @brief Some utility functions and classes.
*/
-#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>
@@ -70,6 +69,7 @@ extern "C" {
#include "cross.h"
#include "video_content.h"
#include "md5_digester.h"
+#include "safe_stringstream.h"
#ifdef DCPOMATIC_WINDOWS
#include "stack.hpp"
#endif
@@ -77,7 +77,6 @@ extern "C" {
#include "i18n.h"
using std::string;
-using std::stringstream;
using std::setfill;
using std::ostream;
using std::endl;
@@ -121,7 +120,7 @@ seconds_to_hms (int s)
int h = m / 60;
m -= (h * 60);
- stringstream hms;
+ SafeStringStream hms;
hms << h << N_(":");
hms.width (2);
hms << std::setfill ('0') << m << N_(":");
@@ -142,7 +141,7 @@ seconds_to_approximate_hms (int s)
int h = m / 60;
m -= (h * 60);
- stringstream ap;
+ SafeStringStream ap;
bool const hours = h > 0;
bool const minutes = h < 10 && m > 0;
@@ -261,7 +260,7 @@ stacktrace (ostream& out, int levels)
static string
ffmpeg_version_to_string (int v)
{
- stringstream s;
+ SafeStringStream s;
s << ((v & 0xff0000) >> 16) << N_(".") << ((v & 0xff00) >> 8) << N_(".") << (v & 0xff);
return s.str ();
}
@@ -270,7 +269,7 @@ ffmpeg_version_to_string (int v)
string
dependency_version_summary ()
{
- stringstream s;
+ SafeStringStream s;
s << N_("libopenjpeg ") << opj_version () << N_(", ")
<< N_("libavcodec ") << ffmpeg_version_to_string (avcodec_version()) << N_(", ")
<< N_("libavfilter ") << ffmpeg_version_to_string (avfilter_version()) << N_(", ")