locale_facets.tcc (num_get<>::_M_extract_float): Cache *__beg in __c when parsing exponent sign too.

2004-10-28  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/locale_facets.tcc (num_get<>::_M_extract_float):
	Cache *__beg in __c when parsing exponent sign too.
	(num_get<>::do_get(..., bool&)): Cache *__beg.
	(money_get<>::_M_extract)): Likewise, in money_base::value.

From-SVN: r89753
This commit is contained in:
Paolo Carlini 2004-10-28 12:47:36 +00:00 committed by Paolo Carlini
parent fd326ba823
commit 53a8d0f021
2 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2004-10-28 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (num_get<>::_M_extract_float):
Cache *__beg in __c when parsing exponent sign too.
(num_get<>::do_get(..., bool&)): Cache *__beg.
(money_get<>::_M_extract)): Likewise, in money_base::value.
2004-10-27 Paolo Carlini <pcarlini@suse.de> 2004-10-27 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.h (assign(const basic_string&)): * include/bits/basic_string.h (assign(const basic_string&)):

View File

@ -329,7 +329,7 @@ namespace std
{ {
// According to 22.2.2.1.2, p8-9, first look for thousands_sep // According to 22.2.2.1.2, p8-9, first look for thousands_sep
// and decimal_point. // and decimal_point.
const char_type __c = *__beg; char_type __c = *__beg;
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
{ {
if (!__found_dec && !__found_sci) if (!__found_dec && !__found_sci)
@ -390,11 +390,12 @@ namespace std
// Remove optional plus or minus sign, if they exist. // Remove optional plus or minus sign, if they exist.
if (++__beg != __end) if (++__beg != __end)
{ {
const bool __plus = *__beg == __lit[__num_base::_S_iplus]; __c = *__beg;
if ((__plus || *__beg == __lit[__num_base::_S_iminus]) const bool __plus = __c == __lit[__num_base::_S_iplus];
if ((__plus || __c == __lit[__num_base::_S_iminus])
&& !(__lc->_M_use_grouping && !(__lc->_M_use_grouping
&& *__beg == __lc->_M_thousands_sep) && __c == __lc->_M_thousands_sep)
&& !(*__beg == __lc->_M_decimal_point)) && !(__c == __lc->_M_decimal_point))
{ {
__xtrc += __plus ? '+' : '-'; __xtrc += __plus ? '+' : '-';
++__beg; ++__beg;
@ -668,15 +669,17 @@ namespace std
size_t __n; size_t __n;
for (__n = 0; __beg != __end; ++__n, ++__beg) for (__n = 0; __beg != __end; ++__n, ++__beg)
{ {
const char_type __c = *__beg;
if (__testf) if (__testf)
if (__n < __lc->_M_falsename_size) if (__n < __lc->_M_falsename_size)
__testf = *__beg == __lc->_M_falsename[__n]; __testf = __c == __lc->_M_falsename[__n];
else else
break; break;
if (__testt) if (__testt)
if (__n < __lc->_M_truename_size) if (__n < __lc->_M_truename_size)
__testt = *__beg == __lc->_M_truename[__n]; __testt = __c == __lc->_M_truename[__n];
else else
break; break;
@ -1294,7 +1297,7 @@ namespace std
__res.reserve(32); __res.reserve(32);
const char_type* __lit_zero = __lit + money_base::_S_zero; const char_type* __lit_zero = __lit + money_base::_S_zero;
const money_base::pattern __p = __lc->_M_neg_format; const money_base::pattern __p = __lc->_M_neg_format;
for (int __i = 0; __i < 4 && __testvalid; ++__i) for (int __i = 0; __i < 4 && __testvalid; ++__i)
{ {
const part __which = static_cast<part>(__p.field[__i]); const part __which = static_cast<part>(__p.field[__i]);
@ -1356,14 +1359,15 @@ namespace std
// grouping of found thousands separators. // grouping of found thousands separators.
for (; __beg != __end; ++__beg) for (; __beg != __end; ++__beg)
{ {
const char_type __c = *__beg;
const char_type* __q = __traits_type::find(__lit_zero, const char_type* __q = __traits_type::find(__lit_zero,
10, *__beg); 10, __c);
if (__q != 0) if (__q != 0)
{ {
__res += money_base::_S_atoms[__q - __lit]; __res += money_base::_S_atoms[__q - __lit];
++__n; ++__n;
} }
else if (*__beg == __lc->_M_decimal_point else if (__c == __lc->_M_decimal_point
&& !__testdecfound) && !__testdecfound)
{ {
__last_pos = __n; __last_pos = __n;
@ -1371,7 +1375,7 @@ namespace std
__testdecfound = true; __testdecfound = true;
} }
else if (__lc->_M_use_grouping else if (__lc->_M_use_grouping
&& *__beg == __lc->_M_thousands_sep && __c == __lc->_M_thousands_sep
&& !__testdecfound) && !__testdecfound)
{ {
if (__n) if (__n)