[multiple changes]
2002-05-04 Benjamin Kosnik <bkoz@redhat.com> Paolo Carlini <pcarlini@unitus.it> * testsuite/22_locale/num_put_members_char.cc: Add test04(), testing for the locale_facets.tcc entry of the previous commit. * testsuite/22_locale/num_put_members_wchar_t.cc: Likewise. 2002-05-04 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: r53167
This commit is contained in:
parent
7e90efc403
commit
6d030676cc
@ -1,3 +1,26 @@
|
||||
2002-05-04 Benjamin Kosnik <bkoz@redhat.com>
|
||||
Paolo Carlini <pcarlini@unitus.it>
|
||||
|
||||
* testsuite/22_locale/num_put_members_char.cc: Add test04(),
|
||||
testing for the locale_facets.tcc entry of the previous commit.
|
||||
* testsuite/22_locale/num_put_members_wchar_t.cc: Likewise.
|
||||
|
||||
2002-05-04 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-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* configure.in (AC_CHECK_HEADERS): Check for string.h & stdlib.h.
|
||||
|
@ -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
|
||||
|
@ -310,11 +310,23 @@ void test03()
|
||||
#endif
|
||||
}
|
||||
|
||||
void test04()
|
||||
{
|
||||
bool test = true;
|
||||
|
||||
std::string loc1 = setlocale(LC_ALL, "ja_JP.eucjp");
|
||||
test01();
|
||||
test02();
|
||||
std::string loc2 = setlocale(LC_ALL, NULL);
|
||||
VERIFY( loc1 == loc2 );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
test02();
|
||||
test03();
|
||||
test04();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -309,6 +309,17 @@ void test03()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void test04()
|
||||
{
|
||||
bool test = true;
|
||||
|
||||
std::string loc1 = setlocale(LC_ALL, "ja_JP.eucjp");
|
||||
test01();
|
||||
test02();
|
||||
std::string loc2 = setlocale(LC_ALL, NULL);
|
||||
VERIFY( loc1 == loc2 );
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
@ -317,6 +328,7 @@ int main()
|
||||
test01();
|
||||
test02();
|
||||
test03();
|
||||
test04();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user