summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-26 08:13:35 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-26 08:13:35 +0000
commit021be9bee07c7fbb23bb0f857a03be55787e6a21 (patch)
tree3b3a0afc5646c0de8c5b8ddd4583848213227e34
parentb97071d51262d6e2f1f66be59b72015bd32f3a54 (diff)
downloadppe42-gcc-021be9bee07c7fbb23bb0f857a03be55787e6a21.tar.gz
ppe42-gcc-021be9bee07c7fbb23bb0f857a03be55787e6a21.zip
2003-04-26 Paolo Carlini <pcarlini@unitus.it>
* include/bits/streambuf.tcc (__copy_streambufs): Don't use in_avail(), simplify. 2003-04-26 Paolo Carlini <pcarlini@unitus.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(). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66100 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog13
-rw-r--r--libstdc++-v3/include/bits/streambuf.tcc22
-rw-r--r--libstdc++-v3/include/std/std_sstream.h3
3 files changed, 24 insertions, 14 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index cfbb11aa29a..b7888311301 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,16 @@
+2003-04-26 Paolo Carlini <pcarlini@unitus.it>
+
+ * include/bits/streambuf.tcc (__copy_streambufs): Don't
+ use in_avail(), simplify.
+
+2003-04-26 Paolo Carlini <pcarlini@unitus.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().
+
2003-04-25 Ranjit Mathew <rmathew@hotmail.com>
Phil Edwards <pme@gcc.gnu.org>
diff --git a/libstdc++-v3/include/bits/streambuf.tcc b/libstdc++-v3/include/bits/streambuf.tcc
index dff48d25dfc..8623d25c790 100644
--- a/libstdc++-v3/include/bits/streambuf.tcc
+++ b/libstdc++-v3/include/bits/streambuf.tcc
@@ -188,30 +188,29 @@ namespace std
typedef typename _Traits::off_type off_type;
streamsize __ret = 0;
- streamsize __in_avail = __sbin->in_avail();
- streamsize __xtrct;
const off_type __buf_size =
__sbin->_M_buf_size > 0 ? __sbin->_M_buf_size : 1;
-
try
{
- while (__in_avail != -1)
+ for (;;)
{
- if (__in_avail != 0 && __sbin->_M_in_cur
- && __sbin->_M_in_cur + __in_avail <= __sbin->_M_in_end)
+ streamsize __xtrct;
+ const off_type __avail = __sbin->_M_in_end
+ - __sbin->_M_in_cur;
+ if (__avail)
{
- __xtrct = __sbout->sputn(__sbin->_M_in_cur, __in_avail);
+ __xtrct = __sbout->sputn(__sbin->_M_in_cur, __avail);
__ret += __xtrct;
__sbin->_M_in_cur_move(__xtrct);
- if (__xtrct != __in_avail)
+ if (__xtrct != __avail)
break;
}
else
{
streamsize __charsread;
- const streamsize __size =
- std::min(__buf_size, off_type(__sbout->_M_out_end -
- __sbout->_M_out_cur));
+ const off_type __size = std::min(__buf_size,
+ off_type(__sbout->_M_out_end
+ - __sbout->_M_out_cur));
if (__size > 1)
{
_CharT* __buf =
@@ -242,7 +241,6 @@ namespace std
}
if (_Traits::eq_int_type(__sbin->sgetc(), _Traits::eof()))
break;
- __in_avail = __sbin->in_avail();
}
}
catch(exception& __fail)
diff --git a/libstdc++-v3/include/std/std_sstream.h b/libstdc++-v3/include/std/std_sstream.h
index 48b81cd8d95..6dc47e55156 100644
--- a/libstdc++-v3/include/std/std_sstream.h
+++ b/libstdc++-v3/include/std/std_sstream.h
@@ -191,7 +191,7 @@ namespace std
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 @@ namespace std
// Step 2: Use the external array.
this->_M_buf = __s;
- this->_M_buf_size = __n;
_M_really_sync(__s, 0, 0);
}
return this;
OpenPOWER on IntegriCloud