This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] libstdc++/37958 (again)


Hi,

tested x86_64-linux, committed to mainline.

Paolo.

////////////////
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.
Index: include/bits/locale_facets.tcc
===================================================================
*** include/bits/locale_facets.tcc	(revision 141498)
--- include/bits/locale_facets.tcc	(working copy)
*************** _GLIBCXX_BEGIN_LDBL_NAMESPACE
*** 604,661 ****
  	  const locale& __loc = __io._M_getloc();
  	  const __cache_type* __lc = __uc(__loc);
  
! 	  bool __testf = false;
! 	  bool __donef = false;
! 	  bool __testt = false;
! 	  bool __donet = false;
  	  size_t __n;
! 	  bool __testeof = __beg == __end;
!           for (__n = 0; !__testeof; ++__n)
!             {
! 	      const char_type __c = *__beg;
! 
! 	      if (!__donef)
  		{
! 		  if (__n < __lc->_M_falsename_size)
! 		    {
! 		      __testf = __c == __lc->_M_falsename[__n];
! 		      if (!__testf)
! 			__donef = true;
! 		    }
! 		  else
! 		    __donef = true;
  		}
  
! 	      if (!__donet)
! 		{
! 		  if (__n < __lc->_M_truename_size)
! 		    {
! 		      __testt = __c == __lc->_M_truename[__n];
! 		      if (!__testt)
! 			__donet = true;
! 		    }
! 		  else
! 		    __donet = true;
! 		}
  
! 	      if (__donef && __donet)
  		break;
! 	      
! 	      if (++__beg == __end)
! 		__testeof = true;
!             }
! 	  if (__testf && __n == __lc->_M_falsename_size)
  	    {
  	      __v = false;
  	      if (__testt && __n == __lc->_M_truename_size)
  		__err = ios_base::failbit;
  	      else
! 		__err = __donet ? ios_base::goodbit : ios_base::eofbit;
  	    }
! 	  else if (__testt && __n == __lc->_M_truename_size)
  	    {
  	      __v = true;
! 	      __err = __donef ? ios_base::goodbit : ios_base::eofbit;
  	    }
  	  else
  	    {
--- 604,650 ----
  	  const locale& __loc = __io._M_getloc();
  	  const __cache_type* __lc = __uc(__loc);
  
! 	  bool __testf = true;
! 	  bool __testt = true;
! 	  bool __testeof = false;
  	  size_t __n;
! 	  const size_t __lim = std::max(__lc->_M_falsename_size,
! 					__lc->_M_truename_size);
! 	  for (__n = 0; __n < __lim; ++__n, ++__beg)
! 	    {
! 	      if (__beg == __end)
  		{
! 		  __testeof = true;
! 		  break;
  		}
  
! 	      const char_type __c = *__beg;
  
! 	      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 ((!__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 = __testeof ? ios_base::eofbit : ios_base::goodbit;
  	    }
! 	  else if (__testt && __n == __lc->_M_truename_size && __n)
  	    {
  	      __v = true;
! 	      __err = __testeof ? ios_base::eofbit : ios_base::goodbit;
  	    }
  	  else
  	    {
*************** _GLIBCXX_BEGIN_LDBL_NAMESPACE
*** 663,672 ****
  	      // 23. Num_get overflow result.
  	      __v = false;
  	      __err = ios_base::failbit;
! 	      if (__testeof && __n)
  		__err |= ios_base::eofbit;
  	    }
!         }
        return __beg;
      }
  
--- 652,661 ----
  	      // 23. Num_get overflow result.
  	      __v = false;
  	      __err = ios_base::failbit;
! 	      if (__testeof)
  		__err |= ios_base::eofbit;
  	    }
! 	}
        return __beg;
      }
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]