Commit a576fe88 by Paolo Carlini Committed by Paolo Carlini

locale_facets.tcc (__pad<>::_S_pad): Minor tweaks, avoid unnecessary casts, do…

locale_facets.tcc (__pad<>::_S_pad): Minor tweaks, avoid unnecessary casts, do widenings just in time.

2007-05-17  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/locale_facets.tcc (__pad<>::_S_pad): Minor tweaks, avoid
	unnecessary casts, do widenings just in time.

From-SVN: r124790
parent 1941551a
2007-05-17 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (__pad<>::_S_pad): Minor tweaks, avoid
unnecessary casts, do widenings just in time.
2007-05-16 Benjamin Kosnik <bkoz@redhat.com> 2007-05-16 Benjamin Kosnik <bkoz@redhat.com>
* acinclude.m4 (GLIBCXX_CHECK_COMPILER_FEATURES): Add a function * acinclude.m4 (GLIBCXX_CHECK_COMPILER_FEATURES): Add a function
......
...@@ -1200,7 +1200,7 @@ _GLIBCXX_END_LDBL_NAMESPACE ...@@ -1200,7 +1200,7 @@ _GLIBCXX_END_LDBL_NAMESPACE
// Padding last. // Padding last.
if (__adjust == ios_base::left) if (__adjust == ios_base::left)
{ {
_Traits::copy(__news, const_cast<_CharT*>(__olds), __oldlen); _Traits::copy(__news, __olds, __oldlen);
_Traits::assign(__news + __oldlen, __plen, __fill); _Traits::assign(__news + __oldlen, __plen, __fill);
return; return;
} }
...@@ -1214,30 +1214,27 @@ _GLIBCXX_END_LDBL_NAMESPACE ...@@ -1214,30 +1214,27 @@ _GLIBCXX_END_LDBL_NAMESPACE
const locale& __loc = __io._M_getloc(); const locale& __loc = __io._M_getloc();
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc); const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
const bool __testsign = (__ctype.widen('-') == __olds[0] if (__ctype.widen('-') == __olds[0]
|| __ctype.widen('+') == __olds[0]); || __ctype.widen('+') == __olds[0])
const bool __testhex = (__ctype.widen('0') == __olds[0]
&& __oldlen > 1
&& (__ctype.widen('x') == __olds[1]
|| __ctype.widen('X') == __olds[1]));
if (__testhex)
{ {
__news[0] = __olds[0]; __news[0] = __olds[0];
__news[1] = __olds[1]; __mod = 1;
__mod = 2; ++__news;
__news += 2;
} }
else if (__testsign) else if (__ctype.widen('0') == __olds[0]
&& __oldlen > 1
&& (__ctype.widen('x') == __olds[1]
|| __ctype.widen('X') == __olds[1]))
{ {
__news[0] = __olds[0]; __news[0] = __olds[0];
__mod = 1; __news[1] = __olds[1];
++__news; __mod = 2;
__news += 2;
} }
// else Padding first. // else Padding first.
} }
_Traits::assign(__news, __plen, __fill); _Traits::assign(__news, __plen, __fill);
_Traits::copy(__news + __plen, const_cast<_CharT*>(__olds + __mod), _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod);
__oldlen - __mod);
} }
bool bool
......
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