aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@unitus.it>2003-03-31 20:24:13 +0200
committerPaolo Carlini <paolo@gcc.gnu.org>2003-03-31 18:24:13 +0000
commiteb98bd16ce5ada9df54e4340b8cbf86b45d385f2 (patch)
tree73484defd3a0008256a22e753fae73b6b37914c4 /libstdc++-v3/include/bits
parentc8ae788f59f209e7015fdf6c5933fcb8ef558700 (diff)
downloadgcc-eb98bd16ce5ada9df54e4340b8cbf86b45d385f2.zip
gcc-eb98bd16ce5ada9df54e4340b8cbf86b45d385f2.tar.gz
gcc-eb98bd16ce5ada9df54e4340b8cbf86b45d385f2.tar.bz2
std_streambuf.h (_M_out_buf_size()): Remove.
2003-03-31 Paolo Carlini <pcarlini@unitus.it> * include/std/std_streambuf.h (_M_out_buf_size()): Remove. * include/bits/fstream.tcc (_M_allocate_internal_buffer): Don't set _M_out_end. (basic_filebuf::overflow): Replace _M_out_buf_size() with this->_M_out_cur && this->_M_out_cur < this->_M_out_end. * include/bits/sstream.tcc (basic_stringbuf::overflow): Replace _M_out_buf_size() with this->_M_out_cur < this->_M_out_end; * include/bits/streambuf.tcc (basic_streambuf::sputc): Replace _M_out_buf_size() with _M_out_cur && _M_out_cur < _M_out_end. (basic_streambuf::xsputn): Replace _M_out_buf_size() with _M_out_end - _M_out_cur. (__copy_streambufs): Likewise. * include/std/std_fstream.h (_M_set_determinate): Set _M_out_end here. From-SVN: r65093
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc7
-rw-r--r--libstdc++-v3/include/bits/sstream.tcc2
-rw-r--r--libstdc++-v3/include/bits/streambuf.tcc10
3 files changed, 10 insertions, 9 deletions
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index f1b65a1..64f5d1d 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -48,10 +48,8 @@ namespace std
{
this->_M_buf_size = this->_M_buf_size_opt;
- // Allocate internal buffer...
+ // Allocate internal buffer.
this->_M_buf = new char_type[this->_M_buf_size];
- // ... and consistently set the end of buffer pointer.
- this->_M_out_end = this->_M_buf + this->_M_buf_size;
_M_buf_allocated = true;
}
}
@@ -255,7 +253,8 @@ namespace std
overflow(int_type __c)
{
int_type __ret = traits_type::eof();
- bool __testput = _M_out_buf_size();
+ bool __testput =
+ this->_M_out_cur && this->_M_out_cur < this->_M_out_end;
bool __testout = this->_M_mode & ios_base::out;
if (__testout)
diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc
index 5f9f62e..991cb13 100644
--- a/libstdc++-v3/include/bits/sstream.tcc
+++ b/libstdc++-v3/include/bits/sstream.tcc
@@ -92,7 +92,7 @@ namespace std
__size_type __len =
std::max(_M_string.capacity() + 1, this->_M_buf_size_opt);
- bool __testwrite = _M_out_buf_size();
+ bool __testwrite = this->_M_out_cur < this->_M_out_end;
if (__builtin_expect(!__testwrite && __len > _M_string.max_size(), false))
return traits_type::eof();
diff --git a/libstdc++-v3/include/bits/streambuf.tcc b/libstdc++-v3/include/bits/streambuf.tcc
index 6e9d192..47fc4ec 100644
--- a/libstdc++-v3/include/bits/streambuf.tcc
+++ b/libstdc++-v3/include/bits/streambuf.tcc
@@ -99,7 +99,7 @@ namespace std
sputc(char_type __c)
{
int_type __ret;
- if (_M_out_buf_size())
+ if (_M_out_cur && _M_out_cur < _M_out_end)
{
*_M_out_cur = __c;
_M_out_cur_move(1);
@@ -152,7 +152,7 @@ namespace std
streamsize __ret = 0;
while (__ret < __n)
{
- off_type __buf_len = _M_out_buf_size();
+ off_type __buf_len = _M_out_end - _M_out_cur;
if (__buf_len > 0)
{
off_type __remaining = __n - __ret;
@@ -189,11 +189,12 @@ namespace std
basic_streambuf<_CharT, _Traits>* __sbout)
{
typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::off_type off_type;
streamsize __ret = 0;
streamsize __bufsize = __sbin->in_avail();
streamsize __xtrct;
- const typename _Traits::off_type __size_opt =
+ const off_type __size_opt =
__sbin->_M_buf_size_opt > 0 ? __sbin->_M_buf_size_opt : 1;
try
@@ -213,7 +214,8 @@ namespace std
{
streamsize __charsread;
const streamsize __size =
- std::min(__size_opt, __sbout->_M_out_buf_size());
+ std::min(__size_opt, off_type(__sbout->_M_out_end -
+ __sbout->_M_out_cur));
if (__size > 1)
{
_CharT* __buf =