]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sstream.tcc (seekoff): We can't seek beyond _M_out_lim...
authorPaolo Carlini <pcarlini@unitus.it>
Wed, 18 Jun 2003 18:34:09 +0000 (20:34 +0200)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 18 Jun 2003 18:34:09 +0000 (18:34 +0000)
2003-06-18  Paolo Carlini  <pcarlini@unitus.it>

* include/bits/sstream.tcc (seekoff): We can't seek beyond
_M_out_lim, therefore _M_move_out_cur boils down to simply
updating _M_out_cur.
(seekpos): Likewise, clean up.

From-SVN: r68162

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/sstream.tcc

index a77f7ec80119de2c0d59c6cc2dceee30b4983814..fad6a0868edf91db2dffe99df121ea7eafb27d32 100644 (file)
@@ -1,3 +1,10 @@
+2003-06-18  Paolo Carlini  <pcarlini@unitus.it>
+
+       * include/bits/sstream.tcc (seekoff): We can't seek beyond
+       _M_out_lim, therefore _M_move_out_cur boils down to simply
+       updating _M_out_cur.
+       (seekpos): Likewise, clean up.
+
 2003-06-18  Nathan C. Myers  <ncm-nospam@cantrip.org>
             Paolo Carlini  <pcarlini@unitus.it>
 
index 49a5aa0106e688da3d63b509fd66e91bd41ab3f3..764e2801d197044052064628c20d64286b3f71fb 100644 (file)
@@ -157,7 +157,7 @@ namespace std
              && __newoffo + __off >= 0 
              && this->_M_out_lim - __beg >= __newoffo + __off)
            {
-             _M_move_out_cur(__newoffo + __off - (this->_M_out_cur - __beg));
+             this->_M_out_cur = __beg + __newoffo + __off;
              __ret = pos_type(__newoffo);
            }
        }
@@ -174,34 +174,25 @@ namespace std
       if (_M_string.capacity())
        {
          off_type __pos = __sp; // Use streamoff operator to do conversion.
-         char_type* __beg = NULL;
-         char_type* __end = NULL;
          const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
          const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
+         char_type* __beg = __testin ? this->_M_in_beg : this->_M_out_beg;
          
          // NB: Ordered.
          bool __testposi = false;
          bool __testposo = false;
-         if (__testin)
-           {
-             __beg = this->_M_in_beg;
-             __end = this->_M_in_end;
-             if (0 <= __pos && __pos <= __end - __beg)
-               __testposi = true;
-           }
-         if (__testout)
-           {
-             __beg = this->_M_out_beg;
-             __end = this->_M_out_lim;
-             if (0 <= __pos && __pos <= __end - __beg)
-               __testposo = true;
-           }
+         if (__testin && 0 <= __pos
+             && __pos <=  this->_M_in_end - __beg)
+           __testposi = true;
+         if (__testout && 0 <= __pos
+             && __pos <=  this->_M_out_lim - __beg)
+           __testposo = true;
          if (__testposi || __testposo)
            {
              if (__testposi)
-               this->_M_in_cur = this->_M_in_beg + __pos;
+               this->_M_in_cur = __beg + __pos;
              if (__testposo)
-               _M_move_out_cur((__pos) - (this->_M_out_cur - __beg));
+               this->_M_out_cur = __beg + __pos;
              __ret = pos_type(off_type(__pos));
            }
        }