basic_streambuf bug

Nathan Myers ncm@cantrip.org
Wed May 3 11:17:00 GMT 2000


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



More information about the Libstdc++ mailing list