streambuf.tcc: repaired _S_copy_streambufs()

2000-06-13  Brent Verner <brent@rcfile.org>

	* bits/streambuf.tcc: repaired _S_copy_streambufs()
	* testsuite/27_io/ostream_inserter_other.cc (test03): Added testcase.

From-SVN: r34528
This commit is contained in:
Brent Verner 2000-06-13 22:20:56 +00:00 committed by Benjamin Kosnik
parent 2d2586a495
commit 96cbf48b35
3 changed files with 51 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2000-06-13 Brent Verner <brent@rcfile.org>
* bits/streambuf.tcc: repaired _S_copy_streambufs()
* testsuite/27_io/ostream_inserter_other.cc (test03): Added testcase.
2000-06-12 Benjamin Kosnik <bkoz@purist.soma.redhat.com> 2000-06-12 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
* bits/locale_facets.h (ctype<wchar_t>): Remove unnecessary data * bits/locale_facets.h (ctype<wchar_t>): Remove unnecessary data

View File

@ -239,6 +239,7 @@ namespace std {
__ios.setstate(ios_base::eofbit); __ios.setstate(ios_base::eofbit);
break; break;
} }
__bufsize = __sbin->in_avail();
} }
else else
break; break;

View File

@ -1,7 +1,7 @@
// 1999-08-16 bkoz // 1999-08-16 bkoz
// 1999-11-01 bkoz // 1999-11-01 bkoz
// Copyright (C) 1999 Free Software Foundation // Copyright (C) 1999, 2000 Free Software Foundation
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
@ -90,10 +90,51 @@ bool test02() {
return test; return test;
} }
int main() // via Brent Verner <brent@rcfile.org>
// http://sourceware.cygnus.com/ml/libstdc++/2000-06/msg00005.html
int
test03(void)
{ {
test01(); using namespace std;
test02();
typedef ios::pos_type pos_type;
const char* TEST_IN = "testsuite/ostream_inserter_other_in";
const char* TEST_OUT = "testsuite/ostream_inserter_other_out";
pos_type i_read, i_wrote, rs, ws;
double tf_size = BUFSIZ * 2.5;
ofstream testfile(TEST_IN);
for ( int i=0; i < tf_size; ++i )
testfile.put('.');
testfile.close();
ifstream in(TEST_IN);
ofstream out(TEST_OUT);
out << in.rdbuf();
in.seekg(0,ios_base::beg);
out.seekp(0,ios_base::beg);
rs = in.tellg();
ws = out.tellp();
in.seekg(0,ios_base::end);
out.seekp(0,ios_base::end);
i_read = in.tellg() - rs;
i_wrote = out.tellp() - ws;
in.close();
out.close();
#ifdef DEBUG_ASSERT
assert(i_read == i_wrote);
#endif
return 0;
}
int main()
{
test01();
test02();
test03();
return 0; return 0;
} }