From: Paolo Carlini Date: Mon, 1 Apr 2002 08:55:05 +0000 (+0200) Subject: 2002-04-01 Paolo Carlini X-Git-Tag: releases/gcc-3.3.0~5978 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=99b629fa30fac1730d656c67369ef06b4c04ef27;p=thirdparty%2Fgcc.git 2002-04-01 Paolo Carlini * config/locale/ieee_1003.1-2001/codecvt_specializations.h (codecvt::do_out, codecvt::do_unshift, codecvt::do_in): By definition, sizeof(char) == 1. * include/bits/locale_facets.tcc (money_get::do_get, money_put::do_put): Ditto. * testsuite/21_strings/inserters_extractors.cc (test04): Ditto. From-SVN: r51685 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 948d4d5e2998..e4ae7ef36f34 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2002-04-01 Paolo Carlini + + * config/locale/ieee_1003.1-2001/codecvt_specializations.h + (codecvt::do_out, codecvt::do_unshift, codecvt::do_in): + By definition, sizeof(char) == 1. + * include/bits/locale_facets.tcc (money_get::do_get, + money_put::do_put): Ditto. + * testsuite/21_strings/inserters_extractors.cc + (test04): Ditto. + 2002-03-30 Richard Henderson PR c++/3719 diff --git a/libstdc++-v3/config/locale/ieee_1003.1-2001/codecvt_specializations.h b/libstdc++-v3/config/locale/ieee_1003.1-2001/codecvt_specializations.h index 8cac2995d48f..891c66b2844c 100644 --- a/libstdc++-v3/config/locale/ieee_1003.1-2001/codecvt_specializations.h +++ b/libstdc++-v3/config/locale/ieee_1003.1-2001/codecvt_specializations.h @@ -285,9 +285,9 @@ { typedef state_type::__desc_type __desc_type; const __desc_type* __desc = __state._M_get_out_descriptor(); - const size_t __fmultiple = sizeof(intern_type) / sizeof(char); + const size_t __fmultiple = sizeof(intern_type); size_t __fbytes = __fmultiple * (__from_end - __from); - const size_t __tmultiple = sizeof(extern_type) / sizeof(char); + const size_t __tmultiple = sizeof(extern_type); size_t __tbytes = __tmultiple * (__to_end - __to); // Argument list for iconv specifies a byte sequence. Thus, @@ -352,7 +352,7 @@ { typedef state_type::__desc_type __desc_type; const __desc_type* __desc = __state._M_get_in_descriptor(); - const size_t __tmultiple = sizeof(intern_type) / sizeof(char); + const size_t __tmultiple = sizeof(intern_type); size_t __tlen = __tmultiple * (__to_end - __to); // Argument list for iconv specifies a byte sequence. Thus, @@ -390,9 +390,9 @@ { typedef state_type::__desc_type __desc_type; const __desc_type* __desc = __state._M_get_in_descriptor(); - const size_t __fmultiple = sizeof(extern_type) / sizeof(char); + const size_t __fmultiple = sizeof(extern_type); size_t __flen = __fmultiple * (__from_end - __from); - const size_t __tmultiple = sizeof(intern_type) / sizeof(char); + const size_t __tmultiple = sizeof(intern_type); size_t __tlen = __tmultiple * (__to_end - __to); // Argument list for iconv specifies a byte sequence. Thus, diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 30e663287377..27fc8787148b 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -938,7 +938,7 @@ namespace std __beg = this->do_get(__beg, __end, __intl, __io, __err, __str); const int __n = numeric_limits::digits10; - char* __cs = static_cast(__builtin_alloca(sizeof(char) * __n)); + char* __cs = static_cast(__builtin_alloca(__n)); const locale __loc = __io.getloc(); const ctype<_CharT>& __ctype = use_facet >(__loc); const _CharT* __wcs = __str.c_str(); @@ -1152,20 +1152,20 @@ namespace std #ifdef _GLIBCPP_USE_C99 // First try a buffer perhaps big enough. int __cs_size = 64; - char* __cs = static_cast(__builtin_alloca(sizeof(char) * __cs_size)); + char* __cs = static_cast(__builtin_alloca(__cs_size)); int __len = __convert_from_v(__cs, __cs_size, "%.01Lf", __units, _S_c_locale); // If the buffer was not large enough, try again with the correct size. if (__len >= __cs_size) { __cs_size = __len + 1; - __cs = static_cast(__builtin_alloca(sizeof(char) * __cs_size)); + __cs = static_cast(__builtin_alloca(__cs_size)); __len = __convert_from_v(__cs, __cs_size, "%.01Lf", __units, _S_c_locale); } #else // max_exponent10 + 1 for the integer part, + 4 for sign, decimal point, // decimal digit, '\0'. const int __cs_size = numeric_limits::max_exponent10 + 5; - char* __cs = static_cast(__builtin_alloca(sizeof(char) * __cs_size)); + char* __cs = static_cast(__builtin_alloca(__cs_size)); int __len = __convert_from_v(__cs, 0, "%.01Lf", __units, _S_c_locale); #endif _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __cs_size)); diff --git a/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc b/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc index b83e5aa4e603..5d1d9f50b195 100644 --- a/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc +++ b/libstdc++-v3/testsuite/21_strings/inserters_extractors.cc @@ -155,7 +155,7 @@ void test04(int size) { bool test = true; std::string str(size, 's'); - int expected_size = (2 * (size + sizeof(char))); + int expected_size = 2 * (size + 1); std::ostringstream oss(str); // sanity checks