Commit fa4262a4 by Paolo Carlini Committed by Paolo Carlini

PR libstdc++/37958 (cont)

2008-11-01  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/37958 (cont)
	* include/bits/locale_facets.tcc (num_get<>::do_get(iter_type,
	iter_type, ios_base&, ios_base::iostate&, bool&): Fix again.

From-SVN: r141517
parent 12f681a0
2008-11-01 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/37958 (cont)
* include/bits/locale_facets.tcc (num_get<>::do_get(iter_type,
iter_type, ios_base&, ios_base::iostate&, bool&): Fix again.
2008-11-01 Jonathan Wakely <jwakely.gcc@gmail.com> 2008-11-01 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/shared_ptr.h: Update comparisons to match WP. * include/bits/shared_ptr.h: Update comparisons to match WP.
......
...@@ -604,58 +604,47 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE ...@@ -604,58 +604,47 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
const locale& __loc = __io._M_getloc(); const locale& __loc = __io._M_getloc();
const __cache_type* __lc = __uc(__loc); const __cache_type* __lc = __uc(__loc);
bool __testf = false; bool __testf = true;
bool __donef = false; bool __testt = true;
bool __testt = false; bool __testeof = false;
bool __donet = false;
size_t __n; size_t __n;
bool __testeof = __beg == __end; const size_t __lim = std::max(__lc->_M_falsename_size,
for (__n = 0; !__testeof; ++__n) __lc->_M_truename_size);
{ for (__n = 0; __n < __lim; ++__n, ++__beg)
const char_type __c = *__beg; {
if (__beg == __end)
if (!__donef)
{ {
if (__n < __lc->_M_falsename_size) __testeof = true;
{ break;
__testf = __c == __lc->_M_falsename[__n];
if (!__testf)
__donef = true;
}
else
__donef = true;
} }
if (!__donet) const char_type __c = *__beg;
{
if (__n < __lc->_M_truename_size)
{
__testt = __c == __lc->_M_truename[__n];
if (!__testt)
__donet = true;
}
else
__donet = true;
}
if (__donef && __donet) if (__testf && __n < __lc->_M_falsename_size)
__testf = __c == __lc->_M_falsename[__n];
if (__testt && __n < __lc->_M_truename_size)
__testt = __c == __lc->_M_truename[__n];
if (!__testt && !__testf)
break; break;
if (++__beg == __end) if ((!__testt && __n >= __lc->_M_falsename_size)
__testeof = true; || (!__testf && __n >= __lc->_M_truename_size))
} break;
if (__testf && __n == __lc->_M_falsename_size) }
if (__testf && __n == __lc->_M_falsename_size && __n)
{ {
__v = false; __v = false;
if (__testt && __n == __lc->_M_truename_size) if (__testt && __n == __lc->_M_truename_size)
__err = ios_base::failbit; __err = ios_base::failbit;
else else
__err = __donet ? ios_base::goodbit : ios_base::eofbit; __err = __testeof ? ios_base::eofbit : ios_base::goodbit;
} }
else if (__testt && __n == __lc->_M_truename_size) else if (__testt && __n == __lc->_M_truename_size && __n)
{ {
__v = true; __v = true;
__err = __donef ? ios_base::goodbit : ios_base::eofbit; __err = __testeof ? ios_base::eofbit : ios_base::goodbit;
} }
else else
{ {
...@@ -663,10 +652,10 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE ...@@ -663,10 +652,10 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
// 23. Num_get overflow result. // 23. Num_get overflow result.
__v = false; __v = false;
__err = ios_base::failbit; __err = ios_base::failbit;
if (__testeof && __n) if (__testeof)
__err |= ios_base::eofbit; __err |= ios_base::eofbit;
} }
} }
return __beg; return __beg;
} }
......
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