aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2008-11-01 16:17:42 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2008-11-01 16:17:42 +0000
commitfa4262a47aa70a6f1baa2dd35d1cdb929c250da6 (patch)
tree2f248d0d97d4ae46d4395ad5effd535d33f120c2 /libstdc++-v3
parent12f681a099e339747f99d5275611ee373096a7a6 (diff)
downloadgcc-fa4262a47aa70a6f1baa2dd35d1cdb929c250da6.zip
gcc-fa4262a47aa70a6f1baa2dd35d1cdb929c250da6.tar.gz
gcc-fa4262a47aa70a6f1baa2dd35d1cdb929c250da6.tar.bz2
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
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc69
2 files changed, 35 insertions, 40 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 06fd7a4..cf6d99d 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+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>
* include/bits/shared_ptr.h: Update comparisons to match WP.
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index 1052e03..7dacbe5 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -604,58 +604,47 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
const locale& __loc = __io._M_getloc();
const __cache_type* __lc = __uc(__loc);
- bool __testf = false;
- bool __donef = false;
- bool __testt = false;
- bool __donet = false;
+ bool __testf = true;
+ bool __testt = true;
+ bool __testeof = false;
size_t __n;
- bool __testeof = __beg == __end;
- for (__n = 0; !__testeof; ++__n)
- {
- const char_type __c = *__beg;
-
- if (!__donef)
+ const size_t __lim = std::max(__lc->_M_falsename_size,
+ __lc->_M_truename_size);
+ for (__n = 0; __n < __lim; ++__n, ++__beg)
+ {
+ if (__beg == __end)
{
- if (__n < __lc->_M_falsename_size)
- {
- __testf = __c == __lc->_M_falsename[__n];
- if (!__testf)
- __donef = true;
- }
- else
- __donef = true;
+ __testeof = true;
+ break;
}
- if (!__donet)
- {
- if (__n < __lc->_M_truename_size)
- {
- __testt = __c == __lc->_M_truename[__n];
- if (!__testt)
- __donet = true;
- }
- else
- __donet = true;
- }
+ const char_type __c = *__beg;
- 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;
-
- if (++__beg == __end)
- __testeof = true;
- }
- if (__testf && __n == __lc->_M_falsename_size)
+
+ if ((!__testt && __n >= __lc->_M_falsename_size)
+ || (!__testf && __n >= __lc->_M_truename_size))
+ break;
+ }
+ if (__testf && __n == __lc->_M_falsename_size && __n)
{
__v = false;
if (__testt && __n == __lc->_M_truename_size)
__err = ios_base::failbit;
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;
- __err = __donef ? ios_base::goodbit : ios_base::eofbit;
+ __err = __testeof ? ios_base::eofbit : ios_base::goodbit;
}
else
{
@@ -663,10 +652,10 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
// 23. Num_get overflow result.
__v = false;
__err = ios_base::failbit;
- if (__testeof && __n)
+ if (__testeof)
__err |= ios_base::eofbit;
}
- }
+ }
return __beg;
}