Fix 3272 and 5181 in the branch? (was: Re: Plans for 3.0.4 ?)

Paolo Carlini pcarlini@unitus.it
Wed Jan 16 12:59:00 GMT 2002


Benjamin Kosnik wrote:

> Please.

This is what I have eventually committed.

Cheers,
Paolo.

/////////////

2002-01-16  Benjamin Kosnik <bkoz@redhat.com>
                            <vakatov@ncbi.nlm.nih.gov>

        libstdc++/3272 (copy from trunk 2001-06-11)
        libstdc++/5181
        * include/bits/streambuf.tcc (__copy_streambufs): Don't set eofbit.
        * testsuite/27_io/ostream_inserter_other.cc (test04): Add test.
        * testsuite/27_io/istream_extractor_other.cc: Fix.

diff -urN libstdc++-v3-orig/include/bits/streambuf.tcc
libstdc++-v3/include/bits/streambuf.tcc
--- libstdc++-v3-orig/include/bits/streambuf.tcc Fri Jul 20 02:14:09 2001
+++ libstdc++-v3/include/bits/streambuf.tcc Wed Jan 16 19:24:29 2002
@@ -206,12 +206,8 @@
      __sbin->_M_in_cur_move(__xtrct);
      if (__xtrct == __bufsize)
        {
-  int_type __c = __sbin->sgetc();
-  if (__c == _Traits::eof())
-    {
-      __ios.setstate(ios_base::eofbit);
-      break;
-    }
+               if (__sbin->sgetc() == _Traits::eof())
+                 break;
   __bufsize = __sbin->in_avail();
        }
      else
diff -urN libstdc++-v3-orig/testsuite/27_io/istream_extractor_other.cc
libstdc++-v3/testsuite/27_io/istream_extractor_other.cc
--- libstdc++-v3-orig/testsuite/27_io/istream_extractor_other.cc Tue Aug 28 23:19:09
2001
+++ libstdc++-v3/testsuite/27_io/istream_extractor_other.cc Wed Jan 16 19:29:17 2002
@@ -128,9 +128,9 @@
   state1 = is_04.rdstate();
   is_04 >> &isbuf_03;
   state2 = is_04.rdstate();
-  VERIFY( state1 != state2 );
+  VERIFY( state1 == state2 );
   VERIFY( !static_cast<bool>(state2 & statefail) );
-  VERIFY( state2 == stateeof );
+  VERIFY( state2 != stateeof );
   strtmp = isbuf_03.str();
   VERIFY( strtmp == str_02 ); // as only an "in" buffer
   VERIFY( isbuf_03.sgetc() == 'a' );
diff -urN libstdc++-v3-orig/testsuite/27_io/ostream_inserter_other.cc
libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc
--- libstdc++-v3-orig/testsuite/27_io/ostream_inserter_other.cc Tue Aug 28 23:19:09
2001
+++ libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc Wed Jan 16 19:27:09 2002
@@ -1,7 +1,7 @@
 // 1999-08-16 bkoz
 // 1999-11-01 bkoz

-// Copyright (C) 1999, 2000 Free Software Foundation
+// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -134,12 +134,28 @@
   return 0;
 }

+// libstdc++/3272
+void test04()
+{
+  using namespace std;
+  bool test = true;
+  istringstream istr("inside betty carter");
+  ostringstream ostr;
+  ostr << istr.rdbuf() << endl;
+
+  if (ostr.rdstate() & ios_base::eofbit)
+    test = false;
+
+  VERIFY( test );
+}
+
 int
 main()
 {
   test01();
   test02();
   test03();
+  test04();

   return 0;
 }




More information about the Gcc mailing list