diff --git a/dlls/msvcp100/ios.c b/dlls/msvcp100/ios.c index 9583ae14a4..83a2c3aa86 100644 --- a/dlls/msvcp100/ios.c +++ b/dlls/msvcp100/ios.c @@ -5747,6 +5747,7 @@ basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *thi { basic_ios_char *base = basic_istream_char_get_basic_ios(this); int ch = (unsigned char)delim; + unsigned int state; TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(count), delim); @@ -5754,22 +5755,28 @@ basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *thi if(basic_istream_char_sentry_create(this, TRUE)) { basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base); + state = IOSTATE_goodbit; while(count > 0) { ch = basic_streambuf_char_sbumpc(strbuf); - if(ch==EOF || ch==(unsigned char)delim) + if(ch==EOF) { + state = IOSTATE_eofbit; + break; + } + + if(ch==(unsigned char)delim) break; this->count++; if(count != INT_MAX) count--; } - } + }else + state = IOSTATE_failbit; basic_istream_char_sentry_destroy(this); - if(ch == EOF) - basic_ios_char_setstate(base, IOSTATE_eofbit); + basic_ios_char_setstate(base, state); return this; } @@ -6871,6 +6878,7 @@ basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar * { basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this); unsigned short ch = delim; + unsigned int state; TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(count), delim); @@ -6878,22 +6886,28 @@ basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar * if(basic_istream_wchar_sentry_create(this, TRUE)) { basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base); + state = IOSTATE_goodbit; while(count > 0) { ch = basic_streambuf_wchar_sbumpc(strbuf); - if(ch==WEOF || ch==delim) + if(ch==WEOF) { + state = IOSTATE_eofbit; + break; + } + + if(ch==delim) break; this->count++; if(count != INT_MAX) count--; } - } + }else + state = IOSTATE_failbit; basic_istream_wchar_sentry_destroy(this); - if(ch == WEOF) - basic_ios_wchar_setstate(base, IOSTATE_eofbit); + basic_ios_wchar_setstate(base, state); return this; } diff --git a/dlls/msvcp60/ios.c b/dlls/msvcp60/ios.c index 48de106aaf..8201554709 100644 --- a/dlls/msvcp60/ios.c +++ b/dlls/msvcp60/ios.c @@ -7137,7 +7137,8 @@ DEFINE_THISCALL_WRAPPER(basic_istream_char_ignore, 12) basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *this, streamsize count, int delim) { basic_ios_char *base = basic_istream_char_get_basic_ios(this); - int ch = delim; + int ch = (unsigned char)delim; + unsigned int state; TRACE("(%p %ld %d)\n", this, count, delim); @@ -7145,22 +7146,28 @@ basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *thi if(basic_istream_char_sentry_create(this, TRUE)) { basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base); + state = IOSTATE_goodbit; while(count > 0) { ch = basic_streambuf_char_sbumpc(strbuf); - if(ch==EOF || ch==delim) + if(ch==EOF) { + state = IOSTATE_eofbit; + break; + } + + if(ch==(unsigned char)delim) break; this->count++; if(count != INT_MAX) count--; } - } + }else + state = IOSTATE_failbit; basic_istream_char_sentry_destroy(this); - if(ch == EOF) - basic_ios_char_setstate(base, IOSTATE_eofbit); + basic_ios_char_setstate(base, state); return this; } @@ -8389,6 +8396,7 @@ basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar * { basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this); unsigned short ch = delim; + unsigned int state; TRACE("(%p %ld %d)\n", this, count, delim); @@ -8396,22 +8404,28 @@ basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar * if(basic_istream_wchar_sentry_create(this, TRUE)) { basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base); + state = IOSTATE_goodbit; while(count > 0) { ch = basic_streambuf_wchar_sbumpc(strbuf); - if(ch==WEOF || ch==delim) + if(ch==WEOF) { + state = IOSTATE_eofbit; + break; + } + + if(ch==delim) break; this->count++; if(count != INT_MAX) count--; } - } + }else + state = IOSTATE_failbit; basic_istream_wchar_sentry_destroy(this); - if(ch == WEOF) - basic_ios_wchar_setstate(base, IOSTATE_eofbit); + basic_ios_wchar_setstate(base, state); return this; } diff --git a/dlls/msvcp71/ios.c b/dlls/msvcp71/ios.c index 148f2c8dc1..34404b507c 100644 --- a/dlls/msvcp71/ios.c +++ b/dlls/msvcp71/ios.c @@ -7469,7 +7469,8 @@ DEFINE_THISCALL_WRAPPER(basic_istream_char_ignore, 12) basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *this, streamsize count, int delim) { basic_ios_char *base = basic_istream_char_get_basic_ios(this); - int ch = delim; + int ch = (unsigned char)delim; + unsigned int state; TRACE("(%p %ld %d)\n", this, count, delim); @@ -7477,22 +7478,28 @@ basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *thi if(basic_istream_char_sentry_create(this, TRUE)) { basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base); + state = IOSTATE_goodbit; while(count > 0) { ch = basic_streambuf_char_sbumpc(strbuf); - if(ch==EOF || ch==delim) + if(ch==EOF) { + state = IOSTATE_eofbit; + break; + } + + if(ch==(unsigned char)delim) break; this->count++; if(count != INT_MAX) count--; } - } + }else + state = IOSTATE_failbit; basic_istream_char_sentry_destroy(this); - if(ch == EOF) - basic_ios_char_setstate(base, IOSTATE_eofbit); + basic_ios_char_setstate(base, state); return this; } @@ -8724,6 +8731,7 @@ basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar * { basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this); unsigned short ch = delim; + unsigned int state; TRACE("(%p %ld %d)\n", this, count, delim); @@ -8731,22 +8739,28 @@ basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar * if(basic_istream_wchar_sentry_create(this, TRUE)) { basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base); + state = IOSTATE_goodbit; while(count > 0) { ch = basic_streambuf_wchar_sbumpc(strbuf); - if(ch==WEOF || ch==delim) + if(ch==WEOF) { + state = IOSTATE_eofbit; + break; + } + + if(ch==delim) break; this->count++; if(count != INT_MAX) count--; } - } + }else + state = IOSTATE_failbit; basic_istream_wchar_sentry_destroy(this); - if(ch == WEOF) - basic_ios_wchar_setstate(base, IOSTATE_eofbit); + basic_ios_wchar_setstate(base, state); return this; }