changeset 10739:d27bd2f74137

src/DLD_FUNCTIONS/__magick_read__.cc: restore locale after GraphicsMagick initialisation
author Soren Hauberg <hauberg@gmail.com>
date Sun, 04 Jul 2010 11:44:50 +0200
parents a4b8364e04c7
children 6cc789b3f0e3
files src/ChangeLog src/DLD-FUNCTIONS/__magick_read__.cc
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Jul 02 14:28:39 2010 -0700
+++ b/src/ChangeLog	Sun Jul 04 11:44:50 2010 +0200
@@ -1,3 +1,7 @@
+2010-07-04  Soren Hauberg  <hauberg@gmail.com>
+	* DLD_FUNCTIONS/__magick_read__.cc: restore locale after
+	GraphicsMagick initialisation.
+
 2010-06-30  Jaroslav Hajek  <highegg@gmail.com>
 
 	* ov-range.cc (octave_range::save_ascii): Save length rather than
--- a/src/DLD-FUNCTIONS/__magick_read__.cc	Fri Jul 02 14:28:39 2010 -0700
+++ b/src/DLD-FUNCTIONS/__magick_read__.cc	Sun Jul 04 11:44:50 2010 +0200
@@ -39,6 +39,7 @@
 #ifdef HAVE_MAGICK
 
 #include <Magick++.h>
+#include <clocale>
 
 octave_value_list
 read_indexed_images (std::vector<Magick::Image>& imvec,
@@ -388,10 +389,17 @@
 
   if (! initialized)
     {
+      // Save the locale as GraphicsMagick might change this (depending on version)
+      const char *static_locale = setlocale (LC_ALL, NULL);
+      const std::string locale (static_locale);
+
       std::string program_name = octave_env::get_program_invocation_name ();
 
       Magick::InitializeMagick (program_name.c_str ());
 
+      // Restore locale from before GraphicsMagick initialisation
+      setlocale (LC_ALL, locale.c_str ());
+
       initialized = true;
     }