]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
std_streambuf.h (basic_streambuf::_M_buf): Change to size_t, from int_type.
authorBenjamin Kosnik <bkoz@redhat.com>
Thu, 4 Jul 2002 09:20:01 +0000 (09:20 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Thu, 4 Jul 2002 09:20:01 +0000 (09:20 +0000)
2002-07-04  Benjamin Kosnik  <bkoz@redhat.com>
            Jack Reeves  <jackw_reeves@hotmail.com>

* include/std/std_streambuf.h (basic_streambuf::_M_buf): Change to
size_t, from int_type.
  (basic_streambuf::_M_buf_size_opt): Same.
  (basic_streambuf::_S_pback_sizex): Same.
* include/bits/streambuf.tcc: Same.
* include/std/std_streambuf.h (basic_streambuf::snextc): Use
eq_int_type.
(basic_streambuf::uflow): Same.
* include/bits/sstream.tcc (basic_stringbuf::overflow): Use
to_char_type.
* include/bits/basic_ios.tcc (basic_ios::init): Use _CharT().
* include/bits/streambuf.tcc (basic_streambuf::xsgetn): Use
eq_int_type.
(basic_streambuf::xsputn): Same.
(__copy_streambufs): Same.

Co-Authored-By: Jack Reeves <jackw_reeves@hotmail.com>
From-SVN: r55242

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_ios.tcc
libstdc++-v3/include/bits/sstream.tcc
libstdc++-v3/include/bits/streambuf.tcc
libstdc++-v3/include/std/std_streambuf.h

index d2ddff24217551881df727788f625f16494111dd..90d0eb7864da120ec798f2b0ac357550074b5799 100644 (file)
@@ -1,3 +1,22 @@
+2002-07-04  Benjamin Kosnik  <bkoz@redhat.com>
+            Jack Reeves  <jackw_reeves@hotmail.com>
+
+       * include/std/std_streambuf.h (basic_streambuf::_M_buf): Change to
+       size_t, from int_type.
+       (basic_streambuf::_M_buf_size_opt): Same.
+       (basic_streambuf::_S_pback_sizex): Same.        
+       * include/bits/streambuf.tcc: Same.
+       * include/std/std_streambuf.h (basic_streambuf::snextc): Use
+       eq_int_type.
+       (basic_streambuf::uflow): Same.
+       * include/bits/sstream.tcc (basic_stringbuf::overflow): Use
+       to_char_type.
+       * include/bits/basic_ios.tcc (basic_ios::init): Use _CharT().
+       * include/bits/streambuf.tcc (basic_streambuf::xsgetn): Use
+       eq_int_type.
+       (basic_streambuf::xsputn): Same.
+       (__copy_streambufs): Same.
+
 2002-07-03  Benjamin Kosnik  <bkoz@redhat.com>
 
        * include/std/std_memory.h: Fix formatting.
index 1e345dc2117205d9394cf744a348547c05f08abd..a38a95b58a0ff43834ad0635ca44bb6298a155ef 100644 (file)
@@ -156,7 +156,7 @@ namespace std
       // unformatted input and output with non-required basic_ios
       // instantiations is possible even without imbuing the expected
       // ctype<char_type> facet.
-      _M_fill = 0;
+      _M_fill = _CharT();
       _M_fill_init = false;
 
       _M_exception = goodbit;
index e7419504d3e548069b9d3b81de3ba5feb36d251c..fd56347a7a4afa9f21c42d2ad81cfc92d57b66c0 100644 (file)
@@ -95,13 +95,13 @@ namespace std
              __len *= 2;
 
              if (__testwrite)
-               __ret = this->sputc(__c);
+               __ret = this->sputc(traits_type::to_char_type(__c));
              else if (__len <= _M_string.max_size())
                {
                  // Force-allocate, re-sync.
                  _M_string = this->str();
                  _M_string.reserve(__len);
-                 _M_buf_size = static_cast<int_type>(__len);
+                 _M_buf_size = __len;
                  _M_really_sync(_M_in_cur - _M_in_beg, 
                                 _M_out_cur - _M_out_beg);
                  *_M_out_cur = traits_type::to_char_type(__c);
index 292999cfba3183cc898ce08edbf08779bd769181..2f790e902cb7c9f0e5d2bcd76149790733d5404d 100644 (file)
@@ -40,7 +40,7 @@
 namespace std 
 {
   template<typename _CharT, typename _Traits>
-    const typename basic_streambuf<_CharT, _Traits>::int_type
+    const size_t
     basic_streambuf<_CharT, _Traits>::_S_pback_size;
 
   template<typename _CharT, typename _Traits>
@@ -138,7 +138,7 @@ namespace std
          if (__ret < __n)
            {
              int_type __c = this->uflow();  
-             if (__c != traits_type::eof())
+             if (!traits_type::eq_int_type(__c, traits_type::eof()))
                {
                  traits_type::assign(*__s++, traits_type::to_char_type(__c));
                  ++__ret;
@@ -177,7 +177,7 @@ namespace std
          if (__ret < __n)
            {
              int_type __c = this->overflow(traits_type::to_int_type(*__s));
-             if (__c != traits_type::eof())
+             if (!traits_type::eq_int_type(__c, traits_type::eof()))
                {
                  ++__ret;
                  ++__s;
@@ -214,7 +214,7 @@ namespace std
              __sbin->_M_in_cur_move(__xtrct);
              if (__xtrct == __bufsize)
                {
-                 if (__sbin->sgetc() == _Traits::eof())
+                 if (_Traits::eq_int_type(__sbin->sgetc(), _Traits::eof()))
                    break;
                  __bufsize = __sbin->in_avail();
                }
index a319b89e2e9b2f19efaf405f04b53a33b8c830a7..14db73c07cce9b4b455ebc5e669929fadeed8344 100644 (file)
@@ -91,10 +91,10 @@ namespace std
       char_type*               _M_buf;         
 
       // Actual size of allocated internal buffer, in bytes.
-      int_type                 _M_buf_size;
+      size_t                   _M_buf_size;
 
       // Optimal or preferred size of internal buffer, in bytes.
-      int_type                 _M_buf_size_opt;
+      size_t                   _M_buf_size_opt;
 
       // True iff _M_in_* and _M_out_* buffers should always point to
       // the same place.  True for fstreams, false for sstreams.
@@ -126,7 +126,7 @@ namespace std
       // requirements. The only basic_streambuf member function that
       // needs access to these data members is in_avail...
       // NB: pbacks of over one character are not currently supported.
-      static const int_type            _S_pback_size = 1; 
+      static const size_t      _S_pback_size = 1; 
       char_type                        _M_pback[_S_pback_size]; 
       char_type*               _M_pback_cur_save;
       char_type*               _M_pback_end_save;
@@ -140,8 +140,8 @@ namespace std
       {
        if (!_M_pback_init)
          {
-           int_type __dist = _M_in_end - _M_in_cur;
-           int_type __len = min(_S_pback_size, __dist);
+           size_t __dist = _M_in_end - _M_in_cur;
+           size_t __len = min(_S_pback_size, __dist);
            traits_type::copy(_M_pback, _M_in_cur, __len);
            _M_pback_cur_save = _M_in_cur;
            _M_pback_end_save = _M_in_end;
@@ -159,12 +159,12 @@ namespace std
        if (_M_pback_init)
          {
            // Length _M_in_cur moved in the pback buffer.
-           int_type __off_cur = _M_in_cur - _M_pback;
+           size_t __off_cur = _M_in_cur - _M_pback;
            
            // For in | out buffers, the end can be pushed back...
-           int_type __off_end = 0;
-           int_type __pback_len = _M_in_end - _M_pback;
-           int_type __save_len = _M_pback_end_save - _M_buf;
+           size_t __off_end = 0;
+           size_t __pback_len = _M_in_end - _M_pback;
+           size_t __save_len = _M_pback_end_save - _M_buf;
            if (__pback_len > __save_len)
              __off_end = __pback_len - __save_len;
 
@@ -288,8 +288,8 @@ namespace std
          {
            if (_M_pback_init)
              {
-               int_type __save_len =  _M_pback_end_save - _M_pback_cur_save;
-               int_type __pback_len = _M_in_cur - _M_pback;
+               size_t __save_len =  _M_pback_end_save - _M_pback_cur_save;
+               size_t __pback_len = _M_in_cur - _M_pback;
                __ret = __save_len - __pback_len;
              }
            else
@@ -304,7 +304,8 @@ namespace std
       snextc()
       {
        int_type __eof = traits_type::eof();
-       return (this->sbumpc() == __eof ? __eof : this->sgetc()); 
+       return (traits_type::eq_int_type(this->sbumpc(), __eof) 
+               ? __eof : this->sgetc());
       }
 
       int_type 
@@ -342,10 +343,10 @@ namespace std
 
     protected:
       basic_streambuf()
-      : _M_buf(NULL), _M_buf_size(0), 
-      _M_buf_size_opt(static_cast<int_type>(BUFSIZ)), _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_mode(ios_base::openmode(0)), _M_buf_locale(locale()), 
+      : _M_buf(NULL), _M_buf_size(0), _M_buf_size_opt(BUFSIZ), 
+      _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_mode(ios_base::openmode(0)), _M_buf_locale(locale()), 
       _M_buf_locale_init(false), _M_pback_cur_save(0), _M_pback_end_save(0), 
       _M_pback_init(false)
       { }
@@ -438,7 +439,7 @@ namespace std
       uflow() 
       {
        int_type __ret = traits_type::eof();
-       bool __testeof = this->underflow() == __ret;
+       bool __testeof = traits_type::eq_int_type(this->underflow(), __ret);
        bool __testpending = _M_in_cur && _M_in_cur < _M_in_end;
        if (!__testeof && __testpending)
          {