This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

Re: basic_streambuf bug


On Wed, May 03, 2000 at 05:50:28PM +0400, Vadim Egorov wrote:
> There seemes to be a bug in basic_streambuf::xsgetn.
> ... The following patch fixes the problem.

> ! 		  int_type __c = this->uflow();  
> ! 		  if ( __c != traits_type::eof())
> ! 		    {
> ! 		      *__s++ = __c;
> ! 		      ++__retval;
> ! 		    }
>   		  else
>   		    break;

This is good.  Still, I'd rather see:

 		  int_type __c = this->uflow();  
 		  if ( __c == traits_type::eof())
 		    break;

	      	  *__s++ = traits_type::to_char_type(__c);
 		  ++__retval;

Are instances of int_type being converted to char_type by implicit
cast elsewhere in the module?  That's to fix.  A patch that just 
identifies where to consider fixing them would be worthwhile all by 
itself.

Nathan Myers
ncm at cantrip dot org


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