From 07af4ff5959d2ba358d4681aed3c9fe1cc30f74e Mon Sep 17 00:00:00 2001 From: rathnor Date: Mon, 4 Oct 2004 12:43:52 +0000 Subject: fix usage of setlocale return value, which returns a pointer to static memory, which we need to promptly copy --- ChangeLog | 3 +++ src/FbTk/XmbFontImp.cc | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01a09db..073d536 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.11 +*04/10/04: + * Fix handling of setlocale return (Thanks Victor Yegorov) + FbTk/XmbFontImp.cc *04/09/30: * Fix to show title of current tabbed-window as the label of the iconbar-button-group (Mathias) diff --git a/src/FbTk/XmbFontImp.cc b/src/FbTk/XmbFontImp.cc index eb01596..dc5c902 100644 --- a/src/FbTk/XmbFontImp.cc +++ b/src/FbTk/XmbFontImp.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: XmbFontImp.cc,v 1.13 2004/09/11 22:58:20 fluxgen Exp $ +// $Id: XmbFontImp.cc,v 1.14 2004/10/04 12:43:52 rathnor Exp $ #include "XmbFontImp.hh" @@ -117,7 +117,7 @@ XFontSet createFontSet(const char *fontname, bool utf8mode) { char **missing, *def = "-"; int nmissing, pixel_size = 0, buf_size = 0; char weight[FONT_ELEMENT_SIZE], slant[FONT_ELEMENT_SIZE]; - char * orig_locale = ""; + std::string orig_locale = ""; #ifdef HAVE_SETLOCALE if (utf8mode) { @@ -131,7 +131,7 @@ XFontSet createFontSet(const char *fontname, bool utf8mode) { if (fs && (! nmissing)) { #ifdef HAVE_SETLOCALE if (utf8mode) - setlocale(LC_CTYPE, orig_locale); + setlocale(LC_CTYPE, orig_locale.c_str()); #endif // HAVE_SETLOCALE return fs; } @@ -143,7 +143,7 @@ XFontSet createFontSet(const char *fontname, bool utf8mode) { setlocale(LC_CTYPE, "C"); fs = XCreateFontSet(display, fontname, &missing, &nmissing, &def); - setlocale(LC_CTYPE, orig_locale); + setlocale(LC_CTYPE, orig_locale.c_str()); } #endif // HAVE_SETLOCALE @@ -189,7 +189,7 @@ XFontSet createFontSet(const char *fontname, bool utf8mode) { #ifdef HAVE_SETLOCALE if (utf8mode) - setlocale(LC_CTYPE, orig_locale); + setlocale(LC_CTYPE, orig_locale.c_str()); #endif // HAVE_SETLOCALE return fs; -- cgit v0.11.2