summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/src
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-11 23:35:43 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-11 23:35:43 +0000
commit37b8790ed92a09896f9a8ad06bddf8a3d156ca0e (patch)
tree61535da0dcdbb26accd934c6e3cd5923ac783db4 /libstdc++-v3/src
parent74e8abb06655486ecb5fba8efe10670d3f0c5ee2 (diff)
downloadppe42-gcc-37b8790ed92a09896f9a8ad06bddf8a3d156ca0e.tar.gz
ppe42-gcc-37b8790ed92a09896f9a8ad06bddf8a3d156ca0e.zip
2005-01-11 Paolo Carlini <pcarlini@suse.de>
Benjamin Kosnik <bkoz@redhat.com> * 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)): In case more than numeric_limits<streamsize>::max() chars are skipped, set _M_gcount = max(). * include/bits/istream.tcc (ignore(streamsize), ignore(streamsize, int_type)): Likewise; keep simple, don't forward. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@93208 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r--libstdc++-v3/src/istream.cc42
1 files changed, 36 insertions, 6 deletions
diff --git a/libstdc++-v3/src/istream.cc b/libstdc++-v3/src/istream.cc
index e3a36490283..2ecd948585a 100644
--- a/libstdc++-v3/src/istream.cc
+++ b/libstdc++-v3/src/istream.cc
@@ -125,6 +125,7 @@ namespace std
int_type __c = __sb->sgetc();
// See comment in istream.tcc.
+ bool __large_ignore = false;
while (true)
{
while (_M_gcount < __n
@@ -147,11 +148,17 @@ namespace std
}
if (__n == numeric_limits<streamsize>::max()
&& !traits_type::eq_int_type(__c, __eof))
- _M_gcount = numeric_limits<streamsize>::min();
+ {
+ _M_gcount = numeric_limits<streamsize>::min();
+ __large_ignore = true;
+ }
else
break;
}
+ if (__large_ignore)
+ _M_gcount = numeric_limits<streamsize>::max();
+
if (traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
}
@@ -183,6 +190,7 @@ namespace std
__streambuf_type* __sb = this->rdbuf();
int_type __c = __sb->sgetc();
+ bool __large_ignore = false;
while (true)
{
while (_M_gcount < __n
@@ -212,16 +220,23 @@ namespace std
if (__n == numeric_limits<streamsize>::max()
&& !traits_type::eq_int_type(__c, __eof)
&& !traits_type::eq_int_type(__c, __delim))
- _M_gcount = numeric_limits<streamsize>::min();
+ {
+ _M_gcount = numeric_limits<streamsize>::min();
+ __large_ignore = true;
+ }
else
break;
}
+ if (__large_ignore)
+ _M_gcount = numeric_limits<streamsize>::max();
+
if (traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
else if (traits_type::eq_int_type(__c, __delim))
{
- ++_M_gcount;
+ if (_M_gcount < numeric_limits<streamsize>::max())
+ ++_M_gcount;
__sb->sbumpc();
}
}
@@ -403,6 +418,7 @@ namespace std
__streambuf_type* __sb = this->rdbuf();
int_type __c = __sb->sgetc();
+ bool __large_ignore = false;
while (true)
{
while (_M_gcount < __n
@@ -425,11 +441,17 @@ namespace std
}
if (__n == numeric_limits<streamsize>::max()
&& !traits_type::eq_int_type(__c, __eof))
- _M_gcount = numeric_limits<streamsize>::min();
+ {
+ _M_gcount = numeric_limits<streamsize>::min();
+ __large_ignore = true;
+ }
else
break;
}
+ if (__large_ignore)
+ _M_gcount = numeric_limits<streamsize>::max();
+
if (traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
}
@@ -461,6 +483,7 @@ namespace std
__streambuf_type* __sb = this->rdbuf();
int_type __c = __sb->sgetc();
+ bool __large_ignore = false;
while (true)
{
while (_M_gcount < __n
@@ -490,16 +513,23 @@ namespace std
if (__n == numeric_limits<streamsize>::max()
&& !traits_type::eq_int_type(__c, __eof)
&& !traits_type::eq_int_type(__c, __delim))
- _M_gcount = numeric_limits<streamsize>::min();
+ {
+ _M_gcount = numeric_limits<streamsize>::min();
+ __large_ignore = true;
+ }
else
break;
}
+ if (__large_ignore)
+ _M_gcount = numeric_limits<streamsize>::max();
+
if (traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
else if (traits_type::eq_int_type(__c, __delim))
{
- ++_M_gcount;
+ if (_M_gcount < numeric_limits<streamsize>::max())
+ ++_M_gcount;
__sb->sbumpc();
}
}
OpenPOWER on IntegriCloud