Commit 5b577977 by Paolo Carlini Committed by Paolo Carlini

2003-10-05 Paolo Carlini <pcarlini@unitus.it>

	* include/bits/locale_facets.tcc
	(num_put::do_put(..., bool)): Prefer ?: to if-else.
	(time_get::_M_extract_name): Qualify min with std::.
	(__pad<>::_S_pad): Constify two variables; simplify an
	if-else statement factoring out some code.

	* include/bits/locale_facets.tcc: Minor cosmetic changes.

From-SVN: r72112
parent 368ebcd6
2003-10-05 Paolo Carlini <pcarlini@unitus.it>
* include/bits/locale_facets.tcc
(num_put::do_put(..., bool)): Prefer ?: to if-else.
(time_get::_M_extract_name): Qualify min with std::.
(__pad<>::_S_pad): Constify two variables; simplify an
if-else statement factoring out some code.
* include/bits/locale_facets.tcc: Minor cosmetic changes.
2003-10-04 Paolo Carlini <pcarlini@unitus.it> 2003-10-04 Paolo Carlini <pcarlini@unitus.it>
* include/bits/locale_facets.tcc (num_get::_M_extract_float): * include/bits/locale_facets.tcc (num_get::_M_extract_float):
......
...@@ -739,7 +739,7 @@ namespace std ...@@ -739,7 +739,7 @@ namespace std
else if (__flags & ios_base::showpos) else if (__flags & ios_base::showpos)
*__buf-- = __lit[__num_base::_S_oplus]; *__buf-- = __lit[__num_base::_S_oplus];
} }
else if (__basefield == ios_base::oct) else if (__basefield == ios_base::oct)
{ {
// Octal. // Octal.
do do
...@@ -793,13 +793,13 @@ namespace std ...@@ -793,13 +793,13 @@ namespace std
if (__basefield == ios_base::oct) if (__basefield == ios_base::oct)
{ {
__off = 1; __off = 1;
*__new = *__cs; __new[0] = __cs[0];
} }
else if (__basefield == ios_base::hex) else if (__basefield == ios_base::hex)
{ {
__off = 2; __off = 2;
*__new = *__cs; __new[0] = __cs[0];
*(__new + 1) = *(__cs + 1); __new[1] = __cs[1];
} }
_CharT* __p; _CharT* __p;
__p = std::__add_grouping(__new + __off, __sep, __grouping.c_str(), __p = std::__add_grouping(__new + __off, __sep, __grouping.c_str(),
...@@ -987,13 +987,13 @@ namespace std ...@@ -987,13 +987,13 @@ namespace std
_CharT* __ws2; _CharT* __ws2;
if (__lc->_M_use_grouping) if (__lc->_M_use_grouping)
{ {
// Grouping can add (almost) as many separators as the // Grouping can add (almost) as many separators as the
// number of digits, but no more. // number of digits, but no more.
__ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
* __len * 2)); * __len * 2));
_M_group_float(__lc->_M_grouping, __lc->_M_thousands_sep, __p, _M_group_float(__lc->_M_grouping, __lc->_M_thousands_sep, __p,
__ws2, __ws, __len); __ws2, __ws, __len);
__ws = __ws2; __ws = __ws2;
} }
// Pad. // Pad.
...@@ -1031,10 +1031,7 @@ namespace std ...@@ -1031,10 +1031,7 @@ namespace std
const __cache_type* __lc = __uc(__loc); const __cache_type* __lc = __uc(__loc);
const _CharT* __name; const _CharT* __name;
if (__v) __name = __v ? __lc->_M_truename : __lc->_M_falsename;
__name = __lc->_M_truename;
else
__name = __lc->_M_falsename;
int __len = char_traits<_CharT>::length(__name); int __len = char_traits<_CharT>::length(__name);
_CharT* __cs; _CharT* __cs;
...@@ -1813,8 +1810,8 @@ namespace std ...@@ -1813,8 +1810,8 @@ namespace std
// Find smallest matching string. // Find smallest matching string.
size_t __minlen = 10; size_t __minlen = 10;
for (size_t __i2 = 0; __i2 < __nmatches; ++__i2) for (size_t __i2 = 0; __i2 < __nmatches; ++__i2)
__minlen = min(__minlen, __minlen = std::min(__minlen,
__traits_type::length(__names[__matches[__i2]])); __traits_type::length(__names[__matches[__i2]]));
if (__pos < __minlen && __beg != __end) if (__pos < __minlen && __beg != __end)
{ {
...@@ -2237,38 +2234,30 @@ namespace std ...@@ -2237,38 +2234,30 @@ namespace std
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
const _CharT __minus = __ctype.widen('-'); const _CharT __minus = __ctype.widen('-');
const _CharT __plus = __ctype.widen('+'); const _CharT __plus = __ctype.widen('+');
bool __testsign = _Traits::eq(__olds[0], __minus) const bool __testsign = _Traits::eq(__olds[0], __minus)
|| _Traits::eq(__olds[0], __plus); || _Traits::eq(__olds[0], __plus);
bool __testhex = _Traits::eq(__ctype.widen('0'), __olds[0]) const bool __testhex = _Traits::eq(__ctype.widen('0'), __olds[0])
&& (_Traits::eq(__ctype.widen('x'), __olds[1]) && (_Traits::eq(__ctype.widen('x'), __olds[1])
|| _Traits::eq(__ctype.widen('X'), __olds[1])); || _Traits::eq(__ctype.widen('X'), __olds[1]));
if (__testhex) if (__testhex)
{ {
__news[0] = __olds[0]; __news[0] = __olds[0];
__news[1] = __olds[1]; __news[1] = __olds[1];
__mod += 2; __mod = 2;
__news += 2; __news += 2;
__beg = __pads;
__beglen = __plen;
__end = const_cast<_CharT*>(__olds + __mod);
} }
else if (__testsign) else if (__testsign)
{ {
__news[0] = __olds[0]; __news[0] = __olds[0];
++__mod; __mod = 1;
++__news; ++__news;
__beg = __pads;
__beglen = __plen;
__end = const_cast<_CharT*>(__olds + __mod);
}
else
{
// Padding first.
__beg = __pads;
__beglen = __plen;
__end = const_cast<_CharT*>(__olds);
} }
// else Padding first.
__beg = __pads;
__beglen = __plen;
__end = const_cast<_CharT*>(__olds + __mod);
} }
else else
{ {
......
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