From 6e5541034896607b250e03206045aa1a0d8d5ce2 Mon Sep 17 00:00:00 2001 From: darco Date: Sat, 24 Dec 2005 23:09:09 +0000 Subject: [PATCH] Fixed weird localization issue where saves SIF files would use number in the local format git-svn-id: http://svn.voria.com/code@100 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/examples/Makefile.in | 2 +- synfig-core/trunk/src/modules/mod_openexr/Makefile.am | 4 ++-- synfig-core/trunk/src/synfig/general.h | 15 +++++++++++++++ synfig-core/trunk/src/synfig/loadcanvas.cpp | 2 ++ synfig-core/trunk/src/synfig/savecanvas.cpp | 3 +++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/synfig-core/trunk/examples/Makefile.in b/synfig-core/trunk/examples/Makefile.in index b96ef0b..f0ae222 100644 --- a/synfig-core/trunk/examples/Makefile.in +++ b/synfig-core/trunk/examples/Makefile.in @@ -209,7 +209,7 @@ sharedstatedir = @sharedstatedir@ synfigincludedir = @synfigincludedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -EXTRA_DIST = about_dialog.sif backdrop.sif business_card.sif candy.sif cells.sif eye.sif eyes.sif gamma.sif gradient.sif headmo.sif installer-logo.sif japan.sif logo.sif logo.tiff macwolfen.sif Makefile.am mandelbrot.sif newjulia.sif newjulia2.sif noise.sif pirates.sif preambletaffy.sif prologue_kid.sif sparkle.sif splat.sif star.sif wallpaper.sif warpcube.sif warptext.sif z_depth_test.sif +EXTRA_DIST = about_dialog.sif backdrop.sif business_card.sif candy.sif cells.sif eye.sif eyes.sif gamma.sif gradient.sif headmo.sif installer-logo.sif japan.sif logo.sif macwolfen.sif Makefile.am mandelbrot.sif newjulia.sif newjulia2.sif noise.sif pirates.sif preambletaffy.sif prologue_kid.sif sparkle.sif splat.sif star.sif wallpaper.sif warpcube.sif warptext.sif z_depth_test.sif all: all-am .SUFFIXES: diff --git a/synfig-core/trunk/src/modules/mod_openexr/Makefile.am b/synfig-core/trunk/src/modules/mod_openexr/Makefile.am index 6fd752e..e1354de 100644 --- a/synfig-core/trunk/src/modules/mod_openexr/Makefile.am +++ b/synfig-core/trunk/src/modules/mod_openexr/Makefile.am @@ -10,8 +10,8 @@ if WITH_OPENEXR module_LTLIBRARIES = libmod_openexr.la libmod_openexr_la_SOURCES = main.cpp mptr_openexr.cpp mptr_openexr.h trgt_openexr.cpp trgt_openexr.h libmod_openexr_la_LDFLAGS = -module @PNG_LIBS@ -no-undefined -libmod_openexr_la_LIBADD = -L../../synfig -lsynfig @SYNFIG_LIBS@ -libmod_openexr_la_CXXFLAGS = @SYNFIG_CFLAGS@ +libmod_openexr_la_LIBADD = -L../../synfig -lsynfig @SYNFIG_LIBS@ @OPENEXR_LIBS@ +libmod_openexr_la_CXXFLAGS = @SYNFIG_CFLAGS@ @OPENEXR_CFLAGS@ else endif diff --git a/synfig-core/trunk/src/synfig/general.h b/synfig-core/trunk/src/synfig/general.h index 7e8f0e3..3be6cce 100644 --- a/synfig-core/trunk/src/synfig/general.h +++ b/synfig-core/trunk/src/synfig/general.h @@ -30,6 +30,7 @@ #include #include "string.h" #include "version.h" +#include /* === M A C R O S ========================================================= */ @@ -61,6 +62,20 @@ namespace synfig { +class ChangeLocale { + const char *previous; + int category; +public: + ChangeLocale(int category, const char *locale): + previous(setlocale(category,NULL)),category(category) + { + setlocale(category,locale); + } + ~ChangeLocale() { + setlocale(category,previous); + } +}; + /*! \class ProgressCallback ** \todo writeme */ diff --git a/synfig-core/trunk/src/synfig/loadcanvas.cpp b/synfig-core/trunk/src/synfig/loadcanvas.cpp index b370158..49ee884 100644 --- a/synfig-core/trunk/src/synfig/loadcanvas.cpp +++ b/synfig-core/trunk/src/synfig/loadcanvas.cpp @@ -2260,6 +2260,7 @@ CanvasParser::parse_from_file_as(const String &file_,const String &as_) CHECK_EXPIRE_TIME(); try { + ChangeLocale change_locale(LC_NUMERIC, "C"); String file(unix_to_local_path(file_)); String as(unix_to_local_path(as_)); @@ -2321,6 +2322,7 @@ CanvasParser::parse_from_string(const String &data) try { + ChangeLocale change_locale(LC_NUMERIC, "C"); filename=_(""); total_warnings_=0; xmlpp::DomParser parser; diff --git a/synfig-core/trunk/src/synfig/savecanvas.cpp b/synfig-core/trunk/src/synfig/savecanvas.cpp index 2638147..6bb025a 100644 --- a/synfig-core/trunk/src/synfig/savecanvas.cpp +++ b/synfig-core/trunk/src/synfig/savecanvas.cpp @@ -710,6 +710,8 @@ xmlpp::Element* encode_canvas(xmlpp::Element* root,Canvas::ConstHandle canvas) bool synfig::save_canvas(const String &filename, Canvas::ConstHandle canvas) { + ChangeLocale change_locale(LC_NUMERIC, "C"); + synfig::String tmp_filename(filename+".TMP"); try @@ -750,6 +752,7 @@ synfig::save_canvas(const String &filename, Canvas::ConstHandle canvas) String synfig::canvas_to_string(Canvas::ConstHandle canvas) { + ChangeLocale change_locale(LC_NUMERIC, "C"); assert(canvas); xmlpp::Document document; -- 2.7.4