summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-21 22:41:52 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-21 22:41:52 +0100
commit47f25009bcbc765e397bcb471dd361a511c99daf (patch)
tree356ac924524183047a84e34674985b3a00c5ca24 /src/lib/util.cc
parentafc495f722f89fea0bcc579046d1a5d362e36f69 (diff)
parente8d8a27c7f6861b031b3250b0ad50d04c41a7721 (diff)
Untested merge of master.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index ad08c6ab4..56932720c 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -976,3 +976,22 @@ FrameRateConversion::FrameRateConversion (float source, int dcp)
}
}
}
+
+LocaleGuard::LocaleGuard ()
+ : _old (0)
+{
+ char const * old = setlocale (LC_NUMERIC, 0);
+
+ if (old) {
+ _old = strdup (old);
+ if (strcmp (_old, "POSIX")) {
+ setlocale (LC_NUMERIC, "POSIX");
+ }
+ }
+}
+
+LocaleGuard::~LocaleGuard ()
+{
+ setlocale (LC_NUMERIC, _old);
+ free (_old);
+}