+2002-09-05 Jakub Jelinek <jakub@redhat.com>
+
+ * config/locale/gnu/ctype_members.cc (ctype<wchar_t>::do_widen(char)):
+ Switch to _M_c_locale_ctype around btowc call.
+ (ctype<wchar_t>::do_widen(const char*, const char *, wchar_t*)):
+ Switch to _M_c_locale_ctype around mbsrtowcs call.
+ (ctype<wchar_t>::do_narrow(char)): Switch to _M_c_locale_ctype around
+ wctob call.
+ (ctype<wchar_t>::do_narrow(const char*, const char *, wchar_t*)):
+ Switch to _M_c_locale_ctype around wcsrtombs call.
+
2002-09-05 Jakub Jelinek <jakub@redhat.com>
* config/locale/gnu/monetary_members.cc
wchar_t
ctype<wchar_t>::
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<wchar_t>::
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<void*>(&__state), 0, sizeof(mbstate_t));
mbsrtowcs(__dest, &__lo, __hi - __lo, &__state);
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+ __uselocale(__old);
+#endif
return __hi;
}
ctype<wchar_t>::
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<char>(__c));
}
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)
{
else
break;
}
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+ __uselocale(__old);
+#endif
return __hi;
}
#endif // _GLIBCPP_USE_WCHAR_T