aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-09-05 09:54:26 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2002-09-05 09:54:26 +0200
commitf373d4c761d558910774264f085e117f6c8cf791 (patch)
tree163734e49b1723c47f849e3c8f087a7547741975
parent9a6d20712ba05d64e03f7252c5b145494ce7937e (diff)
downloadgcc-f373d4c761d558910774264f085e117f6c8cf791.zip
gcc-f373d4c761d558910774264f085e117f6c8cf791.tar.gz
gcc-f373d4c761d558910774264f085e117f6c8cf791.tar.bz2
ctype_members.cc (ctype<wchar_t>::do_widen(char)): Switch to _M_c_locale_ctype around btowc call.
* 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. From-SVN: r56841
-rw-r--r--libstdc++-v3/ChangeLog11
-rw-r--r--libstdc++-v3/config/locale/gnu/ctype_members.cc31
2 files changed, 40 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 06cf2a0..f96da8b 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,16 @@
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
(moneypunct<wchar_t, true>::_M_initialize_moneypunct,
moneypunct<wchar_t, false>::_M_initialize_moneypunct): Use
diff --git a/libstdc++-v3/config/locale/gnu/ctype_members.cc b/libstdc++-v3/config/locale/gnu/ctype_members.cc
index 18c3a82..db1e356 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<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;
}
@@ -182,7 +197,13 @@ namespace std
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));
}
@@ -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