diff options
author | Brent Verner <brent@rcfile.org> | 2000-06-13 22:20:56 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2000-06-13 22:20:56 +0000 |
commit | 96cbf48b356f055114db997b653cf08cdf8a7535 (patch) | |
tree | 4c60969def9119d89ea4c7a2b087b31ee8da8c2c | |
parent | 2d2586a4950c6901f8aa08c4ca17d0ebf30975a5 (diff) | |
download | gcc-96cbf48b356f055114db997b653cf08cdf8a7535.zip gcc-96cbf48b356f055114db997b653cf08cdf8a7535.tar.gz gcc-96cbf48b356f055114db997b653cf08cdf8a7535.tar.bz2 |
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
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/bits/streambuf.tcc | 1 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc | 43 |
3 files changed, 48 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c0b73b6..688b84b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -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> * bits/locale_facets.h (ctype<wchar_t>): Remove unnecessary data diff --git a/libstdc++-v3/bits/streambuf.tcc b/libstdc++-v3/bits/streambuf.tcc index 924ddb0..d5ed76d 100644 --- a/libstdc++-v3/bits/streambuf.tcc +++ b/libstdc++-v3/bits/streambuf.tcc @@ -239,6 +239,7 @@ namespace std { __ios.setstate(ios_base::eofbit); break; } + __bufsize = __sbin->in_avail(); } else break; diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc index cbe99ed..12c9e8b 100644 --- a/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc +++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_other.cc @@ -1,7 +1,7 @@ // 1999-08-16 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 // software; you can redistribute it and/or modify it under the @@ -90,10 +90,51 @@ bool test02() { return test; } +// via Brent Verner <brent@rcfile.org> +// http://sourceware.cygnus.com/ml/libstdc++/2000-06/msg00005.html +int +test03(void) +{ + using namespace std; + + 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; } |