From fd6ab0564d487a057a44131c4464708efff8511f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 1 May 2013 17:11:07 +0000 Subject: [PATCH] This should at least prevent crash in [#35172]... --- intern/locale/boost_locale_wrapper.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/intern/locale/boost_locale_wrapper.cpp b/intern/locale/boost_locale_wrapper.cpp index 81c348e52f1..bc902ac661e 100644 --- a/intern/locale/boost_locale_wrapper.cpp +++ b/intern/locale/boost_locale_wrapper.cpp @@ -76,21 +76,24 @@ void bl_locale_set(const char *locale) #endif } // Note: boost always uses "C" LC_NUMERIC by default! + + /* Generate the locale string (useful to know which locale we are actually using in case of "default" one). */ +#define LOCALE_INFO std::use_facet(_locale) + + locale_str = LOCALE_INFO.language(); + if (LOCALE_INFO.country() != "") { + locale_str += "_" + LOCALE_INFO.country(); + } + if (LOCALE_INFO.variant() != "") { + locale_str += "@" + LOCALE_INFO.variant(); + } + +#undef LOCALE_INFO + } catch(std::exception const &e) { std::cout << "bl_locale_set(" << locale << "): " << e.what() << " \n"; } - - /* Generate the locale string (useful to know which locale we are actually using in case of "default" one). */ -#define LOCALE_INFO std::use_facet(_locale) - - locale_str = LOCALE_INFO.language(); - if (LOCALE_INFO.country() != "") { - locale_str += "_" + LOCALE_INFO.country(); - } - if (LOCALE_INFO.variant() != "") { - locale_str += "@" + LOCALE_INFO.variant(); - } } const char *bl_locale_get(void)