This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[(tiny) patch] Don't set _M_buf_size in basic_stringbuf::setbuf
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: libstdc++ at gcc dot gnu dot org
- Cc: bkoz <bkoz at redhat dot com>
- Date: Thu, 24 Apr 2003 21:00:29 +0200
- Subject: [(tiny) patch] Don't set _M_buf_size in basic_stringbuf::setbuf
Hi,
seems obvious in the light of this recent comment
(of mine ;) in basic_streambuf:
/**
* @if maint
* Actual size of allocated internal buffer. Unused for sstreams,
* which have readily available _M_string.capacity().
* @endif
*/
Tested x86-linux.
Ok with you Benjamin?
/////////
2003-04-24 Paolo Carlini <pcarlini at unitus dot it>
* include/std/std_sstream.h (setbuf): don't set _M_buf_size,
in basic_stringbuf it's unused.
* include/std/std_sstream.h (underflow): consistently use
_M_in_cur, not gptr().
diff -urN libstdc++-v3-orig/include/std/std_sstream.h libstdc++-v3/include/std/std_sstream.h
--- libstdc++-v3-orig/include/std/std_sstream.h 2003-04-20 15:54:45.000000000 +0200
+++ libstdc++-v3/include/std/std_sstream.h 2003-04-24 20:35:53.000000000 +0200
@@ -191,7 +191,7 @@
underflow()
{
if (this->_M_in_cur < this->_M_in_end)
- return traits_type::to_int_type(*gptr());
+ return traits_type::to_int_type(*this->_M_in_cur);
else
return traits_type::eof();
}
@@ -230,7 +230,6 @@
// Step 2: Use the external array.
this->_M_buf = __s;
- this->_M_buf_size = __n;
_M_really_sync(__s, 0, 0);
}
return this;