Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75330 - trunk/boost/chrono/io
From: vicente.botet_at_[hidden]
Date: 2011-11-05 18:08:44


Author: viboes
Date: 2011-11-05 18:08:43 EDT (Sat, 05 Nov 2011)
New Revision: 75330
URL: http://svn.boost.org/trac/boost/changeset/75330

Log:
Chrono: fix some error in duration_get err parameter
Text files modified:
   trunk/boost/chrono/io/duration_get.hpp | 20 +++++++++++---------
   1 files changed, 11 insertions(+), 9 deletions(-)

Modified: trunk/boost/chrono/io/duration_get.hpp
==============================================================================
--- trunk/boost/chrono/io/duration_get.hpp (original)
+++ trunk/boost/chrono/io/duration_get.hpp 2011-11-05 18:08:43 EDT (Sat, 05 Nov 2011)
@@ -12,6 +12,7 @@
 #include <boost/chrono/config.hpp>
 #include <string>
 #include <boost/type_traits/is_scalar.hpp>
+#include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_signed.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/math/common_factor_rt.hpp>
@@ -172,7 +173,7 @@
         {
             if (s == end)
             {
- err |= std::ios_base::failbit;
+ err |= std::ios_base::eofbit;
                 break;
             }
             if (ct.narrow(*pattern, 0) == '%')
@@ -180,7 +181,7 @@
                 if (++pattern == pat_end)
                 {
                     err |= std::ios_base::failbit;
- break;
+ return s;
                 }
                 char cmd = ct.narrow(*pattern, 0);
                 switch (cmd)
@@ -189,15 +190,15 @@
                 {
                   if (value_found) {
                     err |= std::ios_base::failbit;
- break;
+ return s;
                   }
                   if (value_found) {
                     err |= std::ios_base::failbit;
- break;
+ return s;
                   }
                   value_found=true;
                   s=get_value(s, end, ios, err, r);
- if ((err & std::ios_base::failbit) != 0)
+ if ( err & (std::ios_base::badbit |std::ios_base::failbit) )
                   {
                     return s;
                   }
@@ -207,20 +208,21 @@
                 {
                   if (unit_found) {
                     err |= std::ios_base::failbit;
- break;
+ return s;
                   }
                   unit_found=true;
                   s = get_unit<Rep>(s, end, ios, err, rt);
- if ((err & std::ios_base::failbit) != 0)
+ if ( err & (std::ios_base::badbit |std::ios_base::failbit) )
                   {
                     return s;
- } break;
+ }
+ break;
                 }
                 case 'x':
                 {
                   if (unit_found || value_found || loc_found) {
                     err |= std::ios_base::failbit;
- break;
+ return s;
                   }
                   loc_found=true;
                   std::basic_string<CharT> pat = duration_units<CharT>::imbue_if_has_not(ios).get_pattern();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk