From 6ef4b79c95c5494878bbea87a9cda9e45a75e163 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 29 Apr 2003 01:02:46 +0200 Subject: [PATCH] std_streambuf.h (_M_buf_size): is currently used only for basic_filebuf, therefore move it there. 2003-04-28 Paolo Carlini * include/std/std_streambuf.h (_M_buf_size): is currently used only for basic_filebuf, therefore move it there. (basic_streambuf(), ~basic_streambuf()): Adjust. * include/std/std_fstream.h (_M_buf_size): Moved here. * include/bits/fstream.tcc (basic_filebuf()): Adjust. From-SVN: r66191 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/bits/fstream.tcc | 2 +- libstdc++-v3/include/std/std_fstream.h | 9 +++++++++ libstdc++-v3/include/std/std_streambuf.h | 12 +----------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 853b8ace7b4..f8fd27b0e03 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2003-04-28 Paolo Carlini + + * include/std/std_streambuf.h (_M_buf_size): is currently + used only for basic_filebuf, therefore move it there. + (basic_streambuf(), ~basic_streambuf()): Adjust. + * include/std/std_fstream.h (_M_buf_size): Moved here. + * include/bits/fstream.tcc (basic_filebuf()): Adjust. + 2003-04-28 Paolo Carlini * include/bits/streambuf.tcc (__copy_streambufs): Don't use diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index 75bc0c8e485..c03c0e5b4fd 100644 --- a/libstdc++-v3/include/bits/fstream.tcc +++ b/libstdc++-v3/include/bits/fstream.tcc @@ -76,7 +76,7 @@ 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_allocated(false), _M_last_overflowed(false), + _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; } diff --git a/libstdc++-v3/include/std/std_fstream.h b/libstdc++-v3/include/std/std_fstream.h index 6a58a4a56bb..8c388bdfb3b 100644 --- a/libstdc++-v3/include/std/std_fstream.h +++ b/libstdc++-v3/include/std/std_fstream.h @@ -45,6 +45,7 @@ #include #include #include // For codecvt +#include // For SEEK_SET, SEEK_CUR, SEEK_END, BUFSIZ #include #include @@ -113,6 +114,13 @@ namespace std __state_type _M_state_cur; __state_type _M_state_beg; + /** + * @if maint + * Actual size of internal buffer. + * @endif + */ + size_t _M_buf_size; + // Set iff _M_buf is allocated memory from _M_allocate_internal_buffer. /** * @if maint @@ -209,6 +217,7 @@ namespace std ~basic_filebuf() { this->close(); + _M_buf_size = 0; _M_last_overflowed = false; } diff --git a/libstdc++-v3/include/std/std_streambuf.h b/libstdc++-v3/include/std/std_streambuf.h index a5fdc2f5a02..bfb8e3fd514 100644 --- a/libstdc++-v3/include/std/std_streambuf.h +++ b/libstdc++-v3/include/std/std_streambuf.h @@ -44,7 +44,6 @@ #include #include -#include // For SEEK_SET, SEEK_CUR, SEEK_END #include #include @@ -170,14 +169,6 @@ namespace std */ char_type* _M_buf; - /** - * @if maint - * Actual size of allocated internal buffer. Unused for sstreams, - * which have readily available _M_string.capacity(). - * @endif - */ - size_t _M_buf_size; - /** * @if maint * True iff _M_in_* and _M_out_* buffers should always point to @@ -278,7 +269,6 @@ namespace std ~basic_streambuf() { _M_buf_unified = false; - _M_buf_size = 0; _M_mode = ios_base::openmode(0); } @@ -477,7 +467,7 @@ namespace std * - this is not an error */ basic_streambuf() - : _M_buf(NULL), _M_buf_size(BUFSIZ), _M_buf_unified(false), + : _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())