Commit bf22935f by Paolo Carlini Committed by Paolo Carlini

locale_facets.tcc (money_get::do_get(..., string_type&): Minor tweak to the previous commit.

2003-10-24  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/locale_facets.tcc (money_get::do_get(...,
	string_type&): Minor tweak to the previous commit.

From-SVN: r72892
parent e194201c
2003-10-24 Paolo Carlini <pcarlini@suse.de> 2003-10-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (money_get::do_get(..., * include/bits/locale_facets.tcc (money_get::do_get(...,
string_type&): Minor tweak to the previous commit.
2003-10-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (money_get::do_get(...,
string_type&): Disregard the previous commit: doesn't hurt but string_type&): Disregard the previous commit: doesn't hurt but
doesn't accomplish anything useful either. This is the right doesn't accomplish anything useful either. This is the right
one, speeding up greatly the function in case of early fail. one, speeding up greatly the function in case of early fail.
......
...@@ -1284,7 +1284,7 @@ namespace std ...@@ -1284,7 +1284,7 @@ namespace std
__testvalid = false; __testvalid = false;
} }
if (__testvalid) if (__testvalid && __tmp_units.size())
{ {
const char_type __zero = __ctype.widen('0'); const char_type __zero = __ctype.widen('0');
...@@ -1297,33 +1297,30 @@ namespace std ...@@ -1297,33 +1297,30 @@ namespace std
__tmp_units.erase(0, __only_zeros ? __tmp_units.size() - 1 __tmp_units.erase(0, __only_zeros ? __tmp_units.size() - 1
: __first); : __first);
} }
// 22.2.6.1.2, p4
if (__sign.size() && __sign == __neg_sign
&& __tmp_units[0] != __zero)
__tmp_units.insert(__tmp_units.begin(), __ctype.widen('-'));
if (__tmp_units.size()) // Test for grouping fidelity.
if (__grouping.size() && __grouping_tmp.size())
{ {
// 22.2.6.1.2, p4 if (!std::__verify_grouping(__grouping, __grouping_tmp))
if (__sign.size() && __sign == __neg_sign __testvalid = false;
&& __tmp_units[0] != __zero) }
__tmp_units.insert(__tmp_units.begin(), __ctype.widen('-'));
// Iff not enough digits were supplied after the decimal-point.
// Test for grouping fidelity. if (__testdecfound)
if (__grouping.size() && __grouping_tmp.size()) {
{ const int __frac = __intl ? __mpt.frac_digits()
if (!std::__verify_grouping(__grouping, __grouping_tmp)) : __mpf.frac_digits();
__testvalid = false; if (__frac > 0 && __sep_pos != __frac)
} __testvalid = false;
// Iff not enough digits were supplied after the decimal-point.
if (__testdecfound)
{
const int __frac = __intl ? __mpt.frac_digits()
: __mpf.frac_digits();
if (__frac > 0 && __sep_pos != __frac)
__testvalid = false;
}
} }
else
__testvalid = false;
} }
else
__testvalid = false;
// Iff no more characters are available. // Iff no more characters are available.
if (__c == __eof) if (__c == __eof)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment