]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
std_streambuf.h (_M_mode): Move from here to filebuf and stringbuf.
authorPaolo Carlini <pcarlini@unitus.it>
Mon, 30 Jun 2003 11:17:23 +0000 (13:17 +0200)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 30 Jun 2003 11:17:23 +0000 (11:17 +0000)
2003-06-30  Paolo Carlini  <pcarlini@unitus.it>

* include/std/std_streambuf.h (_M_mode): Move from here to
filebuf and stringbuf.
(~basic_streambuf()): Don't set _M_mode.
(basic_streambuf()): Don't set _M_mode.
* include/std/std_fstream.h (_M_mode): Move here, from streambuf.
(~basic_filebuf()): Clean up.
* include/bits/fstream.tcc (basic_filebuf()): Set _M_mode.
* include/std/std_sstream.h (_M_mode): Move here, from streambuf.
* testsuite/27_io/basic_streambuf/cons/char/1.cc: Don't set _M_mode.
* testsuite/27_io/basic_streambuf/overflow/char/1.cc: Likewise.
* testsuite/27_io/basic_streambuf/sgetc/char/1.cc: Likewise.
* testsuite/27_io/basic_streambuf/sgetn/char/1.cc: Likewise.
* testsuite/27_io/basic_streambuf/sputn/char/1.cc: Likewise.

2003-06-30  Paolo Carlini  <pcarlini@unitus.it>

* include/std/std_fstream.h (_M_underflow): Remove.
(uflow): Remove, inherited from streambuf.
(underflow): Only declare.
* include/bits/fstream.tcc (_M_underflow): Rename to
underflow, to which is equivalent for __bump == false,
simplify.
* include/std/std_sstream.h (_M_underflow): Remove.
(uflow): Remove, inherited from streambuf.
(underflow): Only declare.
* include/bits/sstream.tcc (_M_underflow): Rename to
underflow, to which is equivalent for __bump == false,
simplify.

From-SVN: r68695

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fstream.tcc
libstdc++-v3/include/bits/sstream.tcc
libstdc++-v3/include/std/std_fstream.h
libstdc++-v3/include/std/std_sstream.h
libstdc++-v3/include/std/std_streambuf.h
libstdc++-v3/testsuite/27_io/basic_streambuf/cons/char/1.cc
libstdc++-v3/testsuite/27_io/basic_streambuf/overflow/char/1.cc
libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc
libstdc++-v3/testsuite/27_io/basic_streambuf/sgetn/char/1.cc
libstdc++-v3/testsuite/27_io/basic_streambuf/sputn/char/1.cc

index 2090247381f710f3d4bcc646957cef242cd64c5a..a50cbed3de874ef42f530419bcf6838a9498597a 100644 (file)
@@ -1,3 +1,34 @@
+2003-06-30  Paolo Carlini  <pcarlini@unitus.it>
+
+       * include/std/std_streambuf.h (_M_mode): Move from here to
+       filebuf and stringbuf.
+       (~basic_streambuf()): Don't set _M_mode.
+       (basic_streambuf()): Don't set _M_mode.
+       * include/std/std_fstream.h (_M_mode): Move here, from streambuf.
+       (~basic_filebuf()): Clean up.
+       * include/bits/fstream.tcc (basic_filebuf()): Set _M_mode.
+       * include/std/std_sstream.h (_M_mode): Move here, from streambuf.
+       * testsuite/27_io/basic_streambuf/cons/char/1.cc: Don't set _M_mode.
+       * testsuite/27_io/basic_streambuf/overflow/char/1.cc: Likewise.
+       * testsuite/27_io/basic_streambuf/sgetc/char/1.cc: Likewise.
+       * testsuite/27_io/basic_streambuf/sgetn/char/1.cc: Likewise.
+       * testsuite/27_io/basic_streambuf/sputn/char/1.cc: Likewise.
+
+2003-06-30  Paolo Carlini  <pcarlini@unitus.it>
+
+       * include/std/std_fstream.h (_M_underflow): Remove.
+       (uflow): Remove, inherited from streambuf.
+       (underflow): Only declare.
+       * include/bits/fstream.tcc (_M_underflow): Rename to 
+       underflow, to which is equivalent for __bump == false,
+       simplify.
+       * include/std/std_sstream.h (_M_underflow): Remove.
+       (uflow): Remove, inherited from streambuf.
+       (underflow): Only declare.
+       * include/bits/sstream.tcc (_M_underflow): Rename to 
+       underflow, to which is equivalent for __bump == false,
+       simplify.
+
 2003-06-29  Paolo Carlini  <pcarlini@unitus.it>
 
        * include/bits/stl_algo.h (LOTS): Fully qualify standard
index 6f585dc453146d32ea86c85ea1e011ea2d74be94..a5510e380aa64f68370af2b7f186aefc4349f56d 100644 (file)
@@ -69,11 +69,11 @@ namespace std
   template<typename _CharT, typename _Traits>
     basic_filebuf<_CharT, _Traits>::
     basic_filebuf() : __streambuf_type(), _M_file(&_M_lock), 
-    _M_state_cur(__state_type()), _M_state_beg(__state_type()),
-    _M_buf(NULL), _M_buf_size(BUFSIZ), _M_buf_allocated(false),
-    _M_reading(false), _M_writing(false), _M_last_overflowed(false),
-    _M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false),
-    _M_codecvt(0)
+    _M_mode(ios_base::openmode(0)), _M_state_cur(__state_type()),
+    _M_state_beg(__state_type()), _M_buf(NULL), _M_buf_size(BUFSIZ),
+    _M_buf_allocated(false), _M_reading(false), _M_writing(false),
+    _M_last_overflowed(false), _M_pback_cur_save(0), _M_pback_end_save(0),
+    _M_pback_init(false), _M_codecvt(0)
     { 
       if (has_facet<__codecvt_type>(this->_M_buf_locale))
        _M_codecvt = &use_facet<__codecvt_type>(this->_M_buf_locale);
@@ -180,7 +180,7 @@ namespace std
   template<typename _CharT, typename _Traits>
     typename basic_filebuf<_CharT, _Traits>::int_type 
     basic_filebuf<_CharT, _Traits>::
-    _M_underflow(bool __bump)
+    underflow()
     {
       int_type __ret = traits_type::eof();
       const bool __testin = this->_M_mode & ios_base::in;
@@ -194,12 +194,7 @@ namespace std
          _M_destroy_pback();
 
          if (this->gptr() < this->egptr())
-           {
-             __ret = traits_type::to_int_type(*this->gptr());
-             if (__bump)
-               this->gbump(1);
-             return __ret;
-           }
+           return traits_type::to_int_type(*this->gptr());
 
          // Get and convert input sequence.
          const size_t __buflen = this->_M_buf_size > 1
@@ -247,8 +242,6 @@ namespace std
              _M_set_buffer(__ilen);
              _M_reading = true;
              __ret = traits_type::to_int_type(*this->gptr());
-             if (__bump)
-               this->gbump(1);
            }
          else if (__elen == 0)
            {
index f5b4c578071d5e5382775731930091ee416314a0..d512e8adb08ab1ee9e56372df064f84233af0e20 100644 (file)
@@ -115,7 +115,7 @@ namespace std
   template <class _CharT, class _Traits, class _Alloc>
     typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type 
     basic_stringbuf<_CharT, _Traits, _Alloc>::
-    _M_underflow(bool __bump)
+    underflow()
     {
       int_type __ret = traits_type::eof();
       const bool __testin = this->_M_mode & ios_base::in;
@@ -125,11 +125,7 @@ namespace std
          _M_update_egptr();
 
          if (this->gptr() < this->egptr())
-           {
-             __ret = traits_type::to_int_type(*this->gptr());
-             if (__bump)
-               this->gbump(1);
-           }
+           __ret = traits_type::to_int_type(*this->gptr());
        }
       return __ret;
     }
index 605fad22b3e7bfcdb3c775b7d6ef6d4fad9b1c63..b4ea860d6c32821cc2eb3e85fd8916d2d504f5ee 100644 (file)
@@ -105,6 +105,13 @@ namespace std
       */
       __file_type              _M_file;
 
+      /**
+       *  @if maint
+       *  Place to stash in || out || in | out settings for current filebuf.
+       *  @endif
+      */
+      ios_base::openmode       _M_mode;
+
       // Current and beginning state type for codecvt.
       /**
        *  @if maint
@@ -213,8 +220,6 @@ namespace std
       ~basic_filebuf()
       {
        this->close();
-       _M_buf_size = 0;
-       _M_last_overflowed = false;
       }
 
       // Members:
@@ -281,29 +286,9 @@ namespace std
       // charater from the real input source when the buffer is empty.
       // Buffered input uses underflow()
 
-      // The only difference between underflow() and uflow() is that the
-      // latter bumps _M_in_cur after the read.  In the sync_with_stdio
-      // case, this is important, as we need to unget the read character in
-      // the underflow() case in order to maintain synchronization.  So
-      // instead of calling underflow() from uflow(), we create a common
-      // subroutine to do the real work.
-      /**
-       *  @if maint
-       *  @doctodo
-       *  @endif
-      */
-      int_type
-      _M_underflow(bool __bump);
-
-      // [documentation is inherited]
-      virtual int_type
-      underflow()
-      { return _M_underflow(false); }
-
       // [documentation is inherited]
       virtual int_type
-      uflow()
-      { return _M_underflow(true); }
+      underflow();
 
       // [documentation is inherited]
       virtual int_type
index 687e26ad07e0ae92f7419456c97569a1c0749fc5..4d6d26046193914ab113a4f501e3a545efb89f00 100644 (file)
@@ -85,6 +85,13 @@ namespace std
       //@}
 
     protected:
+      /**
+       *  @if maint
+       *  Place to stash in || out || in | out settings for current stringbuf.
+       *  @endif
+      */
+      ios_base::openmode       _M_mode;
+
       // Data Members:
       /**
        *  @if maint
@@ -179,18 +186,9 @@ namespace std
        _M_sync(const_cast<char_type*>(_M_string.data()), 0, __len);
       }
 
-      int_type
-      _M_underflow(bool __bump);
-
-      // [documentation is inherited]
-      virtual int_type
-      underflow()
-      { return _M_underflow(false); }
-
       // [documentation is inherited]
       virtual int_type
-      uflow()
-      { return _M_underflow(true); }
+      underflow();
 
       // [documentation is inherited]
       virtual int_type
index f29fea5f5b7a52cab79fe94d327189a81307c074..70967ebf7420433b81bbb788d4d1431356916bcb 100644 (file)
@@ -176,13 +176,6 @@ namespace std
       char_type*               _M_out_cur;    // Current put area. 
       char_type*               _M_out_end;    // End of put area.
 
-      /**
-       *  @if maint
-       *  Place to stash in || out || in | out settings for current streambuf.
-       *  @endif
-      */
-      ios_base::openmode       _M_mode;
-
       /**
        *  @if maint
        *  Current locale setting.
@@ -201,9 +194,7 @@ namespace std
       /// Destructor deallocates no buffer space.
       virtual 
       ~basic_streambuf() 
-      {
-       _M_mode = ios_base::openmode(0);
-      }
+      { }
 
       // [27.5.2.2.1] locales
       /**
@@ -451,7 +442,7 @@ namespace std
       basic_streambuf()
       : _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_mode(ios_base::openmode(0)),_M_buf_locale(locale()) 
+      _M_buf_locale(locale()) 
       { }
 
       // [27.5.2.3.1] get area access
index 905852422a6419345c7dfc9c69e3e554f2398bfc..c48ecbcc43d570aa345280b4c4335b54ab310068 100644 (file)
@@ -41,7 +41,7 @@ public:
   typedef std::streambuf::char_type char_type;
 
   testbuf(): std::streambuf() 
-  { _M_mode = (std::ios_base::in | std::ios_base::out); }
+  { }
 
   bool
   check_pointers()
index 386193b46c075b811af81828e80d789cbc5090b7..2a3a4be1a25a34b96dfa64e4daa2a159e696351b 100644 (file)
@@ -41,7 +41,7 @@ public:
   typedef std::streambuf::char_type char_type;
 
   testbuf(): std::streambuf() 
-  { _M_mode = (std::ios_base::in | std::ios_base::out); }
+  { }
 
   bool
   check_pointers()
index 9efa3a72a4829dc0372c5bddc88e6a3b3a4722c4..d2833831e725fa7e4191464b24cdb2ac1879081f 100644 (file)
@@ -41,7 +41,7 @@ public:
   typedef std::streambuf::char_type char_type;
 
   testbuf(): std::streambuf() 
-  { _M_mode = (std::ios_base::in | std::ios_base::out); }
+  { }
 
   bool
   check_pointers()
index 2466de5299fb111fc0d13430830187bf37a63a46..f1392dc631da7a9732aeb71c0308a2b1d8a790de 100644 (file)
@@ -41,7 +41,7 @@ public:
   typedef std::streambuf::char_type char_type;
 
   testbuf(): std::streambuf() 
-  { _M_mode = (std::ios_base::in | std::ios_base::out); }
+  { }
 
   bool
   check_pointers()
index f48f788f4f271fdfb7bd8b800fb9b8b692e6dc1d..0feabcd08cd85b287618545cfc492b4db4f20922 100644 (file)
@@ -41,7 +41,7 @@ public:
   typedef std::streambuf::char_type char_type;
 
   testbuf(): std::streambuf() 
-  { _M_mode = (std::ios_base::in | std::ios_base::out); }
+  { }
 
   bool
   check_pointers()