c_locale.cc (__convert_to_v(float, double, long double)): Fix the temporary switch to the "C" locale...
2002-05-18 Takeshi Kobayakawa <tskoba@mte.biglobe.ne.jp> * config/locale/generic/c_locale.cc (__convert_to_v(float, double, long double)): Fix the temporary switch to the "C" locale, saving and restoring in the proper way the current locale. * config/locale/generic/time_members.cc (__timepunct<char, wchar_t>::_M_put): Likewise. * config/locale/gnu/messages_members.cc (messages<char>::do_get): Likewise. * config/locale/gnu/messages_members.h (messages<_CharT>::do_get): Likewise. * config/locale/gnu/time_members.cc (__timepunct<char, wchar_t>::_M_put): Likewise. * include/bits/locale_facets.tcc (__convert_from_v): Likewise. From-SVN: r53597
This commit is contained in:
parent
013400e9cc
commit
e95bc62d23
|
@ -1,3 +1,19 @@
|
|||
2002-05-18 Takeshi Kobayakawa <tskoba@mte.biglobe.ne.jp>
|
||||
|
||||
* config/locale/generic/c_locale.cc
|
||||
(__convert_to_v(float, double, long double)):
|
||||
Fix the temporary switch to the "C" locale, saving and
|
||||
restoring in the proper way the current locale.
|
||||
* config/locale/generic/time_members.cc
|
||||
(__timepunct<char, wchar_t>::_M_put): Likewise.
|
||||
* config/locale/gnu/messages_members.cc
|
||||
(messages<char>::do_get): Likewise.
|
||||
* config/locale/gnu/messages_members.h
|
||||
(messages<_CharT>::do_get): Likewise.
|
||||
* config/locale/gnu/time_members.cc
|
||||
(__timepunct<char, wchar_t>::_M_put): Likewise.
|
||||
* include/bits/locale_facets.tcc (__convert_from_v): Likewise.
|
||||
|
||||
2002-05-18 Paolo Carlini <pcarlini@unitus.it>
|
||||
Nathan Myers <ncm@cantrip.org>
|
||||
Philip Martin <philip@codematters.co.uk>
|
||||
|
|
|
@ -120,7 +120,8 @@ namespace std
|
|||
if (!(__err & ios_base::failbit))
|
||||
{
|
||||
// Assumes __s formatted for "C" locale.
|
||||
const char* __old = setlocale(LC_ALL, "C");
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, "C");
|
||||
char* __sanity;
|
||||
errno = 0;
|
||||
#if defined(_GLIBCPP_USE_C99)
|
||||
|
@ -147,6 +148,7 @@ namespace std
|
|||
else
|
||||
__err |= ios_base::failbit;
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +160,8 @@ namespace std
|
|||
if (!(__err & ios_base::failbit))
|
||||
{
|
||||
// Assumes __s formatted for "C" locale.
|
||||
const char* __old = setlocale(LC_ALL, "C");
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, "C");
|
||||
char* __sanity;
|
||||
errno = 0;
|
||||
double __d = strtod(__s, &__sanity);
|
||||
|
@ -167,6 +170,7 @@ namespace std
|
|||
else
|
||||
__err |= ios_base::failbit;
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,7 +182,8 @@ namespace std
|
|||
if (!(__err & ios_base::failbit))
|
||||
{
|
||||
// Assumes __s formatted for "C" locale.
|
||||
const char* __old = setlocale(LC_ALL, "C");
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, "C");
|
||||
#if defined(_GLIBCPP_USE_C99)
|
||||
char* __sanity;
|
||||
errno = 0;
|
||||
|
@ -202,6 +207,7 @@ namespace std
|
|||
else
|
||||
__err |= ios_base::failbit;
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,9 +51,11 @@ namespace std
|
|||
_M_put(char* __s, size_t __maxlen, const char* __format,
|
||||
const tm* __tm) const
|
||||
{
|
||||
const char* __old = setlocale(LC_ALL, _M_name_timepunct);
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, _M_name_timepunct);
|
||||
strftime(__s, __maxlen, __format, __tm);
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
}
|
||||
|
||||
template<>
|
||||
|
@ -132,9 +134,11 @@ namespace std
|
|||
_M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
|
||||
const tm* __tm) const
|
||||
{
|
||||
const char* __old = setlocale(LC_ALL, _M_name_timepunct);
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, _M_name_timepunct);
|
||||
wcsftime(__s, __maxlen, __format, __tm);
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
|
@ -48,9 +48,11 @@ namespace std
|
|||
__uselocale(__old);
|
||||
return string(__msg);
|
||||
#else
|
||||
const char* __old = setlocale(LC_ALL, _M_name_messages);
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, _M_name_messages);
|
||||
const char* __msg = gettext(__dfault.c_str());
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
return string(__msg);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -65,9 +65,11 @@
|
|||
__uselocale(__old);
|
||||
return _M_convert_from_char(__msg);
|
||||
#else
|
||||
const char* __old = setlocale(LC_ALL, _M_name_messages);
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, _M_name_messages);
|
||||
char* __msg = gettext(_M_convert_to_char(__dfault));
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
return _M_convert_from_char(__msg);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -54,9 +54,11 @@ namespace std
|
|||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
|
||||
__strftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
|
||||
#else
|
||||
const char* __old = setlocale(LC_ALL, _M_name_timepunct);
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, _M_name_timepunct);
|
||||
strftime(__s, __maxlen, __format, __tm);
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -202,9 +204,11 @@ namespace std
|
|||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
|
||||
__wcsftime_l(__s, __maxlen, _M_c_locale_timepunct, __format, __tm);
|
||||
#else
|
||||
const char* __old = setlocale(LC_ALL, _M_name_timepunct);
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, _M_name_timepunct);
|
||||
wcsftime(__s, __maxlen, __format, __tm);
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1959,12 +1959,14 @@ namespace std
|
|||
_Tv __v, const __c_locale&, int __prec = -1)
|
||||
{
|
||||
int __ret;
|
||||
const char* __old = setlocale(LC_ALL, "C");
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, "C");
|
||||
if (__prec >= 0)
|
||||
__ret = snprintf(__out, __size, __fmt, __prec, __v);
|
||||
else
|
||||
__ret = snprintf(__out, __size, __fmt, __v);
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
return __ret;
|
||||
}
|
||||
#else
|
||||
|
@ -1974,12 +1976,14 @@ namespace std
|
|||
const __c_locale&, int __prec = -1)
|
||||
{
|
||||
int __ret;
|
||||
const char* __old = setlocale(LC_ALL, "C");
|
||||
char* __old = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, "C");
|
||||
if (__prec >= 0)
|
||||
__ret = sprintf(__out, __fmt, __prec, __v);
|
||||
else
|
||||
__ret = sprintf(__out, __fmt, __v);
|
||||
setlocale(LC_ALL, __old);
|
||||
free(__old);
|
||||
return __ret;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue