]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
streambuf_iterator.h (class istreambuf_iterator): Consistently use _M_c to cache...
authorPaolo Carlini <pcarlini@suse.de>
Mon, 8 Nov 2004 17:55:54 +0000 (17:55 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 8 Nov 2004 17:55:54 +0000 (17:55 +0000)
2004-11-08  Paolo Carlini  <pcarlini@suse.de>

* include/bits/streambuf_iterator.h (class istreambuf_iterator):
Consistently use _M_c to cache the current char, i.e., not only
when operator++(int) is involved; change _M_c to mutable.
(_M_get()): Always save the return value of _M_sbuf->sgetc() into
_M_c.
* testsuite/22_locale/time_get/get_monthname/char/1.cc: Fix
(long standing) typo.
* testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc: Likewise.
* testsuite/22_locale/time_get/get_weekday/char/1.cc: Likewise.
* testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc: Likewise.

From-SVN: r90275

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/streambuf_iterator.h
libstdc++-v3/testsuite/22_locale/time_get/get_monthname/char/1.cc
libstdc++-v3/testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc
libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc
libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc

index 62f996c11d964301ae1ba222ccddfe48ab88dd87..86a8dcfd5266092a9355c3cfa835f5f408d3b25a 100644 (file)
@@ -1,3 +1,16 @@
+2004-11-08  Paolo Carlini  <pcarlini@suse.de>
+
+       * include/bits/streambuf_iterator.h (class istreambuf_iterator):
+       Consistently use _M_c to cache the current char, i.e., not only
+       when operator++(int) is involved; change _M_c to mutable.
+       (_M_get()): Always save the return value of _M_sbuf->sgetc() into
+       _M_c.
+       * testsuite/22_locale/time_get/get_monthname/char/1.cc: Fix
+       (long standing) typo.
+       * testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc: Likewise.
+       * testsuite/22_locale/time_get/get_weekday/char/1.cc: Likewise.
+       * testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc: Likewise.
+
 2004-11-08  Paolo Carlini  <pcarlini@suse.de>
 
        * include/bits/istream.tcc (getline(char_type*, streamsize,
index 970933578c734e4cc23fffc91c96a3a291dff007..f378862ed14cdbd0392687658311ac15b0534c5f 100644 (file)
@@ -72,7 +72,7 @@ namespace std
       // NB: This implementation assumes the "end of stream" value
       // is EOF, or -1.
       mutable streambuf_type*  _M_sbuf;
-      int_type                 _M_c;
+      mutable int_type         _M_c;
 
     public:
       ///  Construct end of input stream iterator.
@@ -157,10 +157,11 @@ namespace std
        int_type __ret = __eof;
        if (_M_sbuf)
          {
-           if (!traits_type::eq_int_type(_M_c, __eof))
+           if (!traits_type::eq_int_type(_M_c, __eof)
+               || !traits_type::eq_int_type((_M_c = _M_sbuf->sgetc()),
+                                            __eof))
              __ret = _M_c;
-           else if (traits_type::eq_int_type((__ret = _M_sbuf->sgetc()),
-                                             __eof))
+           else
              _M_sbuf = 0;
          }
        return __ret;
index 5d314613f9f40b99b0c3facb53699b0d227ec755..b96007b22c9855da4a280fcfc52e80d54e0acc06 100644 (file)
@@ -102,7 +102,7 @@ void test01()
   tim_get.get_monthname(is_it06, end, iss, errorstate, &time06);
   VERIFY( time06.tm_mon == 4 );
   VERIFY( errorstate == ios_base::failbit );
-  VERIFY( *is_it05 == 'l');
+  VERIFY( *is_it06 == 'l');
 }
 
 int main()
index c5c51a38dee4b149818c742a46ecea7ffcc1afc4..9eb219f3cd99b90deff46e626a279bb01276160a 100644 (file)
@@ -102,7 +102,7 @@ void test01()
   tim_get.get_monthname(is_it06, end, iss, errorstate, &time06);
   VERIFY( time06.tm_mon == 4 );
   VERIFY( errorstate == ios_base::failbit );
-  VERIFY( *is_it05 == L'l' );
+  VERIFY( *is_it06 == L'l' );
 }
 
 int main()
index 85565e87853a26f938b635de865aa976687f46f3..1d6da0a8ab1ff0ec425311543d90c59b9d38f251 100644 (file)
@@ -106,7 +106,7 @@ void test01()
   tim_get.get_weekday(is_it06, end, iss, errorstate, &time06);
   VERIFY( time06.tm_wday == 4 );
   VERIFY( errorstate == ios_base::failbit );
-  VERIFY( *is_it05 == 'u');
+  VERIFY( *is_it06 == 'u');
 }
 
 int main()
index 67efe266847c8a45230d043e9c9fd69d813d07b0..1852b9b39ee8cf95ce87ee871553f57ea8608133 100644 (file)
@@ -106,7 +106,7 @@ void test01()
   tim_get.get_weekday(is_it06, end, iss, errorstate, &time06);
   VERIFY( time06.tm_wday == 4 );
   VERIFY( errorstate == ios_base::failbit );
-  VERIFY( *is_it05 == L'u' );
+  VERIFY( *is_it06 == L'u' );
 }
 
 int main()