diff options
| author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-06 07:12:32 +0000 |
|---|---|---|
| committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-06 07:12:32 +0000 |
| commit | e5716fc6027cdbdb7fd525107ec6d367cd7a39fe (patch) | |
| tree | ece36af1dbd3a89b2d2aff500fbf18dc45ecc247 | |
| parent | c5de137a2552c1c8ac4e1b83c7e1084bf1ff846d (diff) | |
| download | ppe42-gcc-e5716fc6027cdbdb7fd525107ec6d367cd7a39fe.tar.gz ppe42-gcc-e5716fc6027cdbdb7fd525107ec6d367cd7a39fe.zip | |
2000-10-05 Brent Verner <brent@rcfile.org>
* bits/istream.tcc [basic_istream::get(basic_streambuf&)]: Removed
test for _M_gcount < in_avail(), as in_avail() only reports info
for current buffer, causing method to return at end of buffer.
* testsuite/27_io/istream_unformatted.cc [test07()]: New test.
* testsuite/27_io/istream_unformatted-3.txt: New file.
* testsuite/27_io/istream_unformatted-3.tst: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36752 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | libstdc++-v3/include/bits/istream.tcc | 5 | ||||
| -rw-r--r-- | libstdc++-v3/testsuite/27_io/istream_unformatted.cc | 26 |
2 files changed, 26 insertions, 5 deletions
diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index 8ad2de04862..1c42630b5eb 100644 --- a/libstdc++-v3/include/bits/istream.tcc +++ b/libstdc++-v3/include/bits/istream.tcc @@ -588,11 +588,10 @@ namespace std { bool __testdelim = __c == __idelim; bool __testeof = __c == __eof; bool __testput = true; - streamsize __n = __this_sb->in_avail(); - while (_M_gcount <= __n && !__testeof && !__testdelim + while (!__testeof && !__testdelim && (__testput = __sb.sputc(traits_type::to_char_type(__c)) - != __eof)) + != __eof)) { ++_M_gcount; __c = __this_sb->sbumpc(); diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc index 6757a390d07..d34e5784b85 100644 --- a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc +++ b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc @@ -452,7 +452,28 @@ test06() return 0; } - +// bug reported by bgarcia@laurelnetworks.com +// http://sources.redhat.com/ml/libstdc++-prs/2000-q3/msg00041.html +int +test07() +{ + const char* tfn = "testsuite/istream_unformatted-3.txt"; + std::ifstream infile; + infile.open(tfn); + VERIFY( infile ); + while (infile) + { + std::string line; + std::ostringstream line_ss; + while (infile.peek() == '\n') + infile.get(); + infile.get(*(line_ss.rdbuf())); + line = line_ss.str(); + VERIFY( line == "1234567890" || line == "" ); + } + return 0; +} + int main() { @@ -462,7 +483,8 @@ main() test04(); test05(); test06(); - + test07(); + return 0; } |

