[Patch/RFC] Fix libstdc++/12875

Paolo Carlini pcarlini@suse.de
Mon Nov 10 17:10:00 GMT 2003


Hi,

the PR is about setbuf: the current version, while strictly speaking
conforming, discards data if the buffer already hosts some upon
setbuf(s != 0, n > 0). This seems bad, I concur.

Moreover, while dealing with the PR, I noticed that we weren't
actually using the buffer provided by the user whenever setbuf was
called before open, sigh!

My proposal below simply changes setbuf to do nothing after open
- both for (0, 0) *and* now for (!=0, > 0) - and also tweaks slightly
_M_allocate_internal_buffer, thus fixing both the issues.

Alternately, if, for (!=0, >0) we want to allow the user to provide a
buffer after open, when safe of course, we may use _M_reading and
_M_writing and act when both are false...

What do you think?

Paolo.

/////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_12875
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031110/0f932c65/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_12875
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031110/0f932c65/attachment-0001.ksh>


More information about the Libstdc++ mailing list