Module: synfig/synfig Branch: master Commit: 406dc17260884fc08a0f5c126e4bdbc7505a5035 URL: http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig/synfig;a=commit;h=406dc17260884fc08a0f5c126e4bdbc7505a5035
Author: Carlos Lopez <[email protected]> Date: Sun Nov 28 12:26:47 2010 +0100 Fix synfig::ChangleLocale class. It wasn't backing up the old locale so it didn't restore it back when the class destructor was called. --- synfig-core/src/synfig/general.h | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/synfig-core/src/synfig/general.h b/synfig-core/src/synfig/general.h index 639eb51..0442918 100644 --- a/synfig-core/src/synfig/general.h +++ b/synfig-core/src/synfig/general.h @@ -69,16 +69,20 @@ namespace synfig { class ChangeLocale { - const String previous; - const int category; + const String previous; + const int category; public: - ChangeLocale(int category, const char *locale): - previous(setlocale(category,locale)),category(category) - { - } - ~ChangeLocale() { - setlocale(category,previous.c_str()); - } + ChangeLocale(int category, const char *locale): + // This backups the old locale + previous(setlocale(category,NULL)),category(category) + { + // This effectively changes the locale + setlocale(category, locale); + } + ~ChangeLocale() { + // This restores the locale + setlocale(category,previous.c_str()); + } }; /*! \class ProgressCallback ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Synfig-devl mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/synfig-devl
