diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-30 08:39:52 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-30 08:39:52 +0000 |
commit | 792bb14e2e3c41b08cf1d8c5eef607dbfbe738cf (patch) | |
tree | 2520c26bb1a85c62c5f72b63833eba53b4350b34 /libstdc++-v3/include/bits/locale_facets.tcc | |
parent | 5d8b6da234eb056f402e05f0cd2eebbb291ad860 (diff) | |
download | gcc-792bb14e2e3c41b08cf1d8c5eef607dbfbe738cf.tar.gz |
2005-09-30 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/23953
* include/bits/locale_facets.tcc (__numpunct_cache<>::_M_cache,
__moneypunct_cache<>::_M_cache): Check that grouping()[0] > 0.
(__verify_grouping): Do the last check only if __grouping[__min] > 0.
(__add_grouping<>): End recursion if *__gbeg <= 0.
* testsuite/22_locale/num_get/get/char/23953.cc: New.
* testsuite/22_locale/num_get/get/wchar_t/23953.cc: Likewise.
* testsuite/22_locale/num_put/put/char/23953.cc: Likewise.
* testsuite/22_locale/num_put/put/wchar_t/23953.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104814 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/locale_facets.tcc')
-rw-r--r-- | libstdc++-v3/include/bits/locale_facets.tcc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index e78f64a9187..eb4a3527c5c 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -193,7 +193,8 @@ namespace std char* __grouping = new char[_M_grouping_size]; __np.grouping().copy(__grouping, _M_grouping_size); _M_grouping = __grouping; - _M_use_grouping = _M_grouping_size && __np.grouping()[0] != 0; + _M_use_grouping = (_M_grouping_size + && static_cast<signed char>(__np.grouping()[0]) > 0); _M_truename_size = __np.truename().size(); _CharT* __truename = new _CharT[_M_truename_size]; @@ -228,7 +229,8 @@ namespace std char* __grouping = new char[_M_grouping_size]; __mp.grouping().copy(__grouping, _M_grouping_size); _M_grouping = __grouping; - _M_use_grouping = _M_grouping_size && __mp.grouping()[0] != 0; + _M_use_grouping = (_M_grouping_size + && static_cast<signed char>(__mp.grouping()[0]) > 0); _M_decimal_point = __mp.decimal_point(); _M_thousands_sep = __mp.thousands_sep(); @@ -2471,9 +2473,11 @@ namespace std __test = __grouping_tmp[__i] == __grouping[__j]; for (; __i && __test; --__i) __test = __grouping_tmp[__i] == __grouping[__min]; - // ... but the last parsed grouping can be <= numpunct - // grouping. - __test &= __grouping_tmp[0] <= __grouping[__min]; + // ... but the first parsed grouping can be <= numpunct + // grouping (only do the check if the numpunct char is > 0 + // because <= 0 means any size is ok). + if (static_cast<signed char>(__grouping[__min]) > 0) + __test &= __grouping_tmp[0] <= __grouping[__min]; return __test; } @@ -2483,7 +2487,8 @@ namespace std const char* __gbeg, size_t __gsize, const _CharT* __first, const _CharT* __last) { - if (__last - __first > *__gbeg) + if (__last - __first > *__gbeg + && static_cast<signed char>(*__gbeg) > 0) { const bool __bump = __gsize != 1; __s = std::__add_grouping(__s, __sep, __gbeg + __bump, |