From: Jakub Jelinek Date: Thu, 5 Sep 2002 07:53:14 +0000 (+0200) Subject: ctype_members.cc (ctype::do_widen(char)): Switch to _M_c_locale_ctype around... X-Git-Tag: releases/gcc-3.2.1~323 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc35178929390e41ae75a054b8202b49e78bc8a9;p=thirdparty%2Fgcc.git ctype_members.cc (ctype::do_widen(char)): Switch to _M_c_locale_ctype around btowc call. * config/locale/gnu/ctype_members.cc (ctype::do_widen(char)): Switch to _M_c_locale_ctype around btowc call. (ctype::do_widen(const char*, const char *, wchar_t*)): Switch to _M_c_locale_ctype around mbsrtowcs call. (ctype::do_narrow(char)): Switch to _M_c_locale_ctype around wctob call. (ctype::do_narrow(const char*, const char *, wchar_t*)): Switch to _M_c_locale_ctype around wcsrtombs call. From-SVN: r56840 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 153080896d00..63ec5e68c009 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2002-09-05 Jakub Jelinek + + * config/locale/gnu/ctype_members.cc (ctype::do_widen(char)): + Switch to _M_c_locale_ctype around btowc call. + (ctype::do_widen(const char*, const char *, wchar_t*)): + Switch to _M_c_locale_ctype around mbsrtowcs call. + (ctype::do_narrow(char)): Switch to _M_c_locale_ctype around + wctob call. + (ctype::do_narrow(const char*, const char *, wchar_t*)): + Switch to _M_c_locale_ctype around wcsrtombs call. + 2002-09-05 Jakub Jelinek * config/locale/gnu/monetary_members.cc diff --git a/libstdc++-v3/config/locale/gnu/ctype_members.cc b/libstdc++-v3/config/locale/gnu/ctype_members.cc index 18c3a8250942..db1e356d0381 100644 --- a/libstdc++-v3/config/locale/gnu/ctype_members.cc +++ b/libstdc++-v3/config/locale/gnu/ctype_members.cc @@ -166,15 +166,30 @@ namespace std wchar_t ctype:: do_widen(char __c) const - { return btowc(__c); } - + { +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __c_locale __old = __uselocale(_M_c_locale_ctype); +#endif + wchar_t __ret = btowc(__c); +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __uselocale(__old); +#endif + return __ret; + } + const char* ctype:: do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const { +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __c_locale __old = __uselocale(_M_c_locale_ctype); +#endif mbstate_t __state; memset(static_cast(&__state), 0, sizeof(mbstate_t)); mbsrtowcs(__dest, &__lo, __hi - __lo, &__state); +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __uselocale(__old); +#endif return __hi; } @@ -182,7 +197,13 @@ namespace std ctype:: do_narrow(wchar_t __wc, char __dfault) const { +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __c_locale __old = __uselocale(_M_c_locale_ctype); +#endif int __c = wctob(__wc); +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __uselocale(__old); +#endif return (__c == EOF ? __dfault : static_cast(__c)); } @@ -191,6 +212,9 @@ namespace std do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, char* __dest) const { +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __c_locale __old = __uselocale(_M_c_locale_ctype); +#endif size_t __offset = 0; while (true) { @@ -208,6 +232,9 @@ namespace std else break; } +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __uselocale(__old); +#endif return __hi; } #endif // _GLIBCPP_USE_WCHAR_T