This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

Re: [Patch] Clean up sbumpc, move back _M_buf_size, do not special case unbuffered _M_underflow...


On Mon, Jun 09, 2003 at 09:15:04PM +0200, Paolo Carlini wrote:
> Using regular buffering (no special cases in _M_underflow) solves in a 
> straightforward way also the seek issue, since we already have the 
> machineery inside seekoff.

Fine work, Paolo!

Quibbling...

> 2003-06-09  Paolo Carlini  <pcarlini@unitus.it>
>       setbuf(char_type* __s, streamsize __n)
>       {
>         if (!this->is_open() && __s == 0 && __n == 0)
> ! 	this->_M_buf_size = 1;
>         else if (__s && __n > 1)

Shouldn't this now say "__n >= 1" instead of "__n > 1" ?  

Also (but not so as to delay applying the patch), why do we care whether 
the stream is_open()?  I don't find support in the standard for that
requirement, unless we're (incorrectly) pre-filling the buffer on open 
instead of on first read.  It seems like this could be much simpler, 
something like

       if (__s && __n)
         {
	   _M_destroy_internal_buffer();
	   this->_M_buf = __s;
           this->_M_bufsize = __n;
	   _M_set_buffer(0);
	 }
       else if (__n < _M_bufsize)
         _M_bufsize =  __n ? __n : 1;

Nathan Myers
ncm-nospam@cantrip.org


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