OSDN Git Service

2003-05-27 Jonathan Wakely <redi@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / std / std_streambuf.h
index bfb8e3f..38aa607 100644 (file)
@@ -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
@@ -197,9 +187,9 @@ namespace std
       //@{
       /**
        *  @if maint
-       *  _M_set_indeterminate and setp set it equal to _M_out_beg, then
-       *  at each put operation it may be moved forward (toward _M_out_end)
-       *  by _M_out_cur_move.
+       *  setp (and _M_set_buffer(0) in basic_filebuf) set it equal to
+       *  _M_out_beg, then at each put operation it may be moved
+       *  forward (toward _M_out_end) by _M_out_cur_move.
        *  @endif
       */      
       char_type*                _M_out_lim;    // End limit of used put area.
@@ -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 +-
       {
@@ -353,9 +343,10 @@ namespace std
       int_type 
       snextc()
       {
-       int_type __eof = traits_type::eof();
-       return (traits_type::eq_int_type(this->sbumpc(), __eof) 
-               ? __eof : this->sgetc());
+       int_type __ret = traits_type::eof();
+       if (!traits_type::eq_int_type(this->sbumpc(), __ret))
+         __ret = this->sgetc();
+       return __ret;
       }
 
       /**
@@ -467,10 +458,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
@@ -518,8 +509,6 @@ namespace std
        _M_in_beg = __gbeg;
        _M_in_cur = __gnext;
        _M_in_end = __gend;
-       if (!(_M_mode & ios_base::in) && __gbeg && __gnext && __gend)
-         _M_mode = _M_mode | ios_base::in;
       }
 
       // [27.5.2.3.2] put area access
@@ -565,8 +554,6 @@ namespace std
       { 
        _M_out_beg = _M_out_cur = _M_out_lim = __pbeg; 
        _M_out_end = __pend;
-       if (!(_M_mode & ios_base::out) && __pbeg && __pend)
-         _M_mode = _M_mode | ios_base::out;
       }
 
       // [27.5.2.4] virtual functions
@@ -713,8 +700,8 @@ namespace std
       uflow() 
       {
        int_type __ret = traits_type::eof();
-       const bool __testeof =
-         traits_type::eq_int_type(this->underflow(), __ret);
+       const bool __testeof = traits_type::eq_int_type(this->underflow(), 
+                                                       __ret);
        if (!__testeof && _M_in_cur < _M_in_end)
          {
            __ret = traits_type::to_int_type(*_M_in_cur);