aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@unitus.it>2003-04-29 01:51:37 +0200
committerPaolo Carlini <paolo@gcc.gnu.org>2003-04-28 23:51:37 +0000
commit479a181108ee58622576b205b86793d42e964cbc (patch)
treefbd272a94e796d94fc7e968571ef340f15f122c6
parent988ad90d003221abfb91157ef289f702b055a8fd (diff)
downloadgcc-479a181108ee58622576b205b86793d42e964cbc.zip
gcc-479a181108ee58622576b205b86793d42e964cbc.tar.gz
gcc-479a181108ee58622576b205b86793d42e964cbc.tar.bz2
std_streambuf.h (_M_buf): is currently used only for basic_filebuf, therefore move it there.
2003-04-28 Paolo Carlini <pcarlini@unitus.it> * include/std/std_streambuf.h (_M_buf): is currently used only for basic_filebuf, therefore move it there. (basic_streambuf(), ~basic_streambuf()): Adjust. * include/std/std_fstream.h (_M_buf): Moved here. * include/std/std_sstream.h (setbuf): Don't set _M_buf, is actually redundant for basic_stringbuf. (_M_really_sync): Likewise. * include/bits/fstream.tcc (basic_filebuf()): Adjust. * include/bits/sstream.tcc (seekoff): Adjust. From-SVN: r66193
-rw-r--r--libstdc++-v3/ChangeLog12
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc5
-rw-r--r--libstdc++-v3/include/bits/sstream.tcc2
-rw-r--r--libstdc++-v3/include/std/std_fstream.h7
-rw-r--r--libstdc++-v3/include/std/std_sstream.h4
-rw-r--r--libstdc++-v3/include/std/std_streambuf.h20
6 files changed, 29 insertions, 21 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index bf1f4bb..9dbc3a1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,15 @@
+2003-04-28 Paolo Carlini <pcarlini@unitus.it>
+
+ * include/std/std_streambuf.h (_M_buf): is currently
+ used only for basic_filebuf, therefore move it there.
+ (basic_streambuf(), ~basic_streambuf()): Adjust.
+ * include/std/std_fstream.h (_M_buf): Moved here.
+ * include/std/std_sstream.h (setbuf): Don't set _M_buf,
+ is actually redundant for basic_stringbuf.
+ (_M_really_sync): Likewise.
+ * include/bits/fstream.tcc (basic_filebuf()): Adjust.
+ * include/bits/sstream.tcc (seekoff): Adjust.
+
2003-04-28 Benjamin Kosnik <bkoz@redhat.com>
* src/localename.cc: Standardize exception strings.
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index c03c0e5..8d9002e 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -76,8 +76,9 @@ namespace std
basic_filebuf<_CharT, _Traits>::
basic_filebuf() : __streambuf_type(), _M_file(&_M_lock),
_M_state_cur(__state_type()), _M_state_beg(__state_type()),
- _M_buf_size(BUFSIZ), _M_buf_allocated(false), _M_last_overflowed(false),
- _M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false)
+ _M_buf(NULL), _M_buf_size(BUFSIZ), _M_buf_allocated(false),
+ _M_last_overflowed(false), _M_pback_cur_save(0),
+ _M_pback_end_save(0), _M_pback_init(false)
{ this->_M_buf_unified = true; }
template<typename _CharT, typename _Traits>
diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc
index 1d8cc00..1175178 100644
--- a/libstdc++-v3/include/bits/sstream.tcc
+++ b/libstdc++-v3/include/bits/sstream.tcc
@@ -127,7 +127,7 @@ namespace std
if (_M_string.capacity() && (__testin || __testout || __testboth))
{
- char_type* __beg = this->_M_buf;
+ char_type* __beg = __testin ? this->_M_in_beg : this->_M_out_beg;
char_type* __curi = NULL;
char_type* __curo = NULL;
char_type* __endi = NULL;
diff --git a/libstdc++-v3/include/std/std_fstream.h b/libstdc++-v3/include/std/std_fstream.h
index 8c388bd..ffbf789 100644
--- a/libstdc++-v3/include/std/std_fstream.h
+++ b/libstdc++-v3/include/std/std_fstream.h
@@ -116,6 +116,13 @@ namespace std
/**
* @if maint
+ * Pointer to the beginning of internally-allocated space.
+ * @endif
+ */
+ char_type* _M_buf;
+
+ /**
+ * @if maint
* Actual size of internal buffer.
* @endif
*/
diff --git a/libstdc++-v3/include/std/std_sstream.h b/libstdc++-v3/include/std/std_sstream.h
index 6dc47e5..cd8faa0 100644
--- a/libstdc++-v3/include/std/std_sstream.h
+++ b/libstdc++-v3/include/std/std_sstream.h
@@ -229,7 +229,6 @@ namespace std
_M_string = __string_type(__s, __n);
// Step 2: Use the external array.
- this->_M_buf = __s;
_M_really_sync(__s, 0, 0);
}
return this;
@@ -263,9 +262,8 @@ namespace std
const bool __testout = this->_M_mode & ios_base::out;
__size_type __len = _M_string.size();
- this->_M_buf = __base;
if (__testin)
- this->setg(__base, __base + __i, __base + __len);
+ this->setg(__base, __base + __i, __base + __len);
if (__testout)
{
this->setp(__base, __base + _M_string.capacity());
diff --git a/libstdc++-v3/include/std/std_streambuf.h b/libstdc++-v3/include/std/std_streambuf.h
index bfb8e3f..14a5d89 100644
--- a/libstdc++-v3/include/std/std_streambuf.h
+++ b/libstdc++-v3/include/std/std_streambuf.h
@@ -161,16 +161,6 @@ namespace std
protected:
/**
* @if maint
- * Pointer to the beginning of internally-allocated space. Filebuf
- * manually allocates/deallocates this, whereas stringstreams attempt
- * to use the built-in intelligence of the string class. If you are
- * managing memory, set this. If not, leave it NULL.
- * @endif
- */
- char_type* _M_buf;
-
- /**
- * @if maint
* True iff _M_in_* and _M_out_* buffers should always point to
* the same place. True for fstreams, false for sstreams.
* @endif
@@ -245,7 +235,7 @@ namespace std
// __n + _M_out_[cur, lim] <= _M_out_end
// Assuming all _M_out_[beg, cur, lim] pointers are operating on
// the same range:
- // _M_buf <= _M_*_ <= _M_out_end
+ // _M_out_beg <= _M_*_ <= _M_out_end
void
_M_move_out_cur(off_type __n) // argument needs to be +-
{
@@ -467,10 +457,10 @@ namespace std
* - this is not an error
*/
basic_streambuf()
- : _M_buf(NULL), _M_buf_unified(false),
- _M_in_beg(0), _M_in_cur(0), _M_in_end(0), _M_out_beg(0),
- _M_out_cur(0), _M_out_end(0), _M_out_lim(0),
- _M_mode(ios_base::openmode(0)), _M_buf_locale(locale())
+ : _M_buf_unified(false), _M_in_beg(0), _M_in_cur(0),
+ _M_in_end(0), _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
+ _M_out_lim(0), _M_mode(ios_base::openmode(0)),
+ _M_buf_locale(locale())
{ }
// [27.5.2.3.1] get area access