This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] libstdc++/3272
- To: gcc-patches at gcc dot gnu dot org
- Subject: [v3] libstdc++/3272
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Tue, 26 Jun 2001 18:08:16 -0700
Hmm.. on second thought, don't set output stream's eofbit when input
stream gets to the end of the file...
2001-06-26 Benjamin Kosnik <bkoz@fillmore.constant.com>
<vakatov@ncbi.nlm.nih.gov>
libstdc++/3272
* 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.
Index: include/bits/streambuf.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/streambuf.tcc,v
retrieving revision 1.6
diff -c -p -r1.6 streambuf.tcc
*** streambuf.tcc 2001/03/27 03:48:16 1.6
--- streambuf.tcc 2001/06/27 01:06:00
*************** namespace std {
*** 206,217 ****
__sbin->_M_in_cur_move(__xtrct);
if (__xtrct == __bufsize)
{
! int_type __c = __sbin->sgetc();
! if (__c == _Traits::eof())
! {
! __ios.setstate(ios_base::eofbit);
! break;
! }
__bufsize = __sbin->in_avail();
}
else
--- 206,213 ----
__sbin->_M_in_cur_move(__xtrct);
if (__xtrct == __bufsize)
{
! if (__sbin->sgetc() == _Traits::eof())
! break;
__bufsize = __sbin->in_avail();
}
else
Index: testsuite/27_io/istream_extractor_other.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/istream_extractor_other.cc,v
retrieving revision 1.5
diff -c -p -r1.5 istream_extractor_other.cc
*** istream_extractor_other.cc 2001/05/12 16:51:42 1.5
--- istream_extractor_other.cc 2001/06/27 01:06:02
*************** bool test01() {
*** 128,136 ****
state1 = is_04.rdstate();
is_04 >> &isbuf_03;
state2 = is_04.rdstate();
! VERIFY( state1 != state2 );
VERIFY( !static_cast<bool>(state2 & statefail) );
! VERIFY( state2 == stateeof );
strtmp = isbuf_03.str();
VERIFY( strtmp == str_02 ); // as only an "in" buffer
VERIFY( isbuf_03.sgetc() == 'a' );
--- 128,136 ----
state1 = is_04.rdstate();
is_04 >> &isbuf_03;
state2 = is_04.rdstate();
! VERIFY( state1 == state2 );
VERIFY( !static_cast<bool>(state2 & statefail) );
! VERIFY( state2 != stateeof );
strtmp = isbuf_03.str();
VERIFY( strtmp == str_02 ); // as only an "in" buffer
VERIFY( isbuf_03.sgetc() == 'a' );
Index: testsuite/27_io/ostream_inserter_other.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc,v
retrieving revision 1.7
diff -c -p -r1.7 ostream_inserter_other.cc
*** ostream_inserter_other.cc 2001/05/12 16:51:42 1.7
--- ostream_inserter_other.cc 2001/06/27 01:06:02
***************
*** 1,7 ****
// 1999-08-16 bkoz
// 1999-11-01 bkoz
! // Copyright (C) 1999, 2000 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
--- 1,7 ----
// 1999-08-16 bkoz
// 1999-11-01 bkoz
! // Copyright (C) 1999, 2000, 2001 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
*************** test03(void)
*** 134,139 ****
--- 134,154 ----
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()
{
*************** main()
*** 143,145 ****
--- 158,172 ----
return 0;
}