diff options
author | Paolo Carlini <pcarlini@suse.de> | 2005-01-05 11:11:48 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2005-01-05 11:11:48 +0000 |
commit | 1e156882fad89fc2661abdf85e64a62d51815668 (patch) | |
tree | 080e0c96b4e24522fb5299998ff72b047a27e916 /libstdc++-v3/src | |
parent | 4514aa8c6728182bf47343a8acbcec44e326f78e (diff) | |
download | gcc-1e156882fad89fc2661abdf85e64a62d51815668.zip gcc-1e156882fad89fc2661abdf85e64a62d51815668.tar.gz gcc-1e156882fad89fc2661abdf85e64a62d51815668.tar.bz2 |
istream.cc (basic_istream<char>::ignore(streamsize), [...]): At the end, first check _M_gcount vs __n.
2005-01-05 Paolo Carlini <pcarlini@suse.de>
* src/istream.cc (basic_istream<char>::ignore(streamsize),
basic_istream<char>::ignore(streamsize, int_type),
basic_istream<wchar_t>::ignore(streamsize),
basic_istream<wchar_t>::ignore(streamsize, int_type)): At the end,
first check _M_gcount vs __n.
* include/bits/istream.tcc (ignore(streamsize), ignore(streamsize,
int_type)): Likewise.
* testsuite/27_io/basic_istream/ignore/char/4.cc: New.
* testsuite/27_io/basic_istream/ignore/wchar_t/4.cc: Likewise.
From-SVN: r92947
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/istream.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libstdc++-v3/src/istream.cc b/libstdc++-v3/src/istream.cc index 5bdcaaf..dc99051 100644 --- a/libstdc++-v3/src/istream.cc +++ b/libstdc++-v3/src/istream.cc @@ -123,7 +123,8 @@ namespace std const int_type __eof = traits_type::eof(); __streambuf_type* __sb = this->rdbuf(); int_type __c = __sb->sgetc(); - + + // See comment in istream.tcc. while (true) { while (_M_gcount < __n @@ -151,7 +152,7 @@ namespace std break; } - if (traits_type::eq_int_type(__c, __eof)) + if (_M_gcount < __n) __err |= ios_base::eofbit; } catch(...) @@ -216,9 +217,11 @@ namespace std break; } - if (traits_type::eq_int_type(__c, __eof)) + if (_M_gcount == __n) + ; + else if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; - else if (traits_type::eq_int_type(__c, __delim)) + else { ++_M_gcount; __sb->sbumpc(); @@ -429,7 +432,7 @@ namespace std break; } - if (traits_type::eq_int_type(__c, __eof)) + if (_M_gcount < __n) __err |= ios_base::eofbit; } catch(...) @@ -494,9 +497,11 @@ namespace std break; } - if (traits_type::eq_int_type(__c, __eof)) + if (_M_gcount == __n) + ; + else if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; - else if (traits_type::eq_int_type(__c, __delim)) + else { ++_M_gcount; __sb->sbumpc(); |