msvcp90: Don't set failbit in basic_istream::tellg.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42304
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2018-07-19 17:59:55 +02:00 committed by Alexandre Julliard
parent 551d0971c5
commit 98bc9fdaa4
2 changed files with 8 additions and 11 deletions

View File

@ -8823,9 +8823,6 @@ fpos_mbstatet* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpo
if(basic_istream_char_sentry_create(this, TRUE)) { if(basic_istream_char_sentry_create(this, TRUE)) {
basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base), basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
ret, 0, SEEKDIR_cur, OPENMODE_in); ret, 0, SEEKDIR_cur, OPENMODE_in);
if(ret->off==-1 && ret->pos==0 && MBSTATET_TO_INT(&ret->state)==0)
basic_ios_char_setstate(base, IOSTATE_failbit);
}else { }else {
ret->off = -1; ret->off = -1;
ret->pos = 0; ret->pos = 0;
@ -8842,9 +8839,6 @@ fpos_mbstatet* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpo
basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base), basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
ret, 0, SEEKDIR_cur, OPENMODE_in); ret, 0, SEEKDIR_cur, OPENMODE_in);
if(ret->off==-1 && ret->pos==0 && MBSTATET_TO_INT(&ret->state)==0)
basic_ios_char_setstate(base, IOSTATE_failbit);
#endif #endif
return ret; return ret;
@ -10398,9 +10392,6 @@ fpos_mbstatet* __thiscall basic_istream_wchar_tellg(basic_istream_wchar *this, f
if(basic_istream_wchar_sentry_create(this, TRUE)) { if(basic_istream_wchar_sentry_create(this, TRUE)) {
basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base), basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
ret, 0, SEEKDIR_cur, OPENMODE_in); ret, 0, SEEKDIR_cur, OPENMODE_in);
if(ret->off==-1 && ret->pos==0 && MBSTATET_TO_INT(&ret->state)==0)
basic_ios_wchar_setstate(base, IOSTATE_failbit);
}else { }else {
ret->off = -1; ret->off = -1;
ret->pos = 0; ret->pos = 0;
@ -10417,8 +10408,6 @@ fpos_mbstatet* __thiscall basic_istream_wchar_tellg(basic_istream_wchar *this, f
basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base), basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
ret, 0, SEEKDIR_cur, OPENMODE_in); ret, 0, SEEKDIR_cur, OPENMODE_in);
if(ret->off==-1 && ret->pos==0 && MBSTATET_TO_INT(&ret->state)==0)
basic_ios_wchar_setstate(base, IOSTATE_failbit);
#endif #endif
return ret; return ret;
} }

View File

@ -1857,6 +1857,10 @@ static void test_istream_tellg(void)
ok(rpos == &tpos, "wrong return fpos, expected = %p found = %p\n", rpos, &tpos); ok(rpos == &tpos, "wrong return fpos, expected = %p found = %p\n", rpos, &tpos);
ok(tpos.pos == 0, "wrong position, expected = 0 found = %s\n", wine_dbgstr_longlong(tpos.pos)); ok(tpos.pos == 0, "wrong position, expected = 0 found = %s\n", wine_dbgstr_longlong(tpos.pos));
ok(tpos.state == 0, "wrong state, expected = 0 found = %d\n", tpos.state); ok(tpos.state == 0, "wrong state, expected = 0 found = %d\n", tpos.state);
if(tests[i].seekoff == -1) {
ok(ss.basic_ios.base.state == IOSTATE_goodbit,
"ss.basic_ios.base.state = %x\n", ss.basic_ios.base.state);
}
call_func1(p_basic_stringstream_char_vbase_dtor, &ss); call_func1(p_basic_stringstream_char_vbase_dtor, &ss);
call_func1(p_basic_string_char_dtor, &str); call_func1(p_basic_string_char_dtor, &str);
@ -1884,6 +1888,10 @@ static void test_istream_tellg(void)
ok(rpos == &tpos, "wrong return fpos, expected = %p found = %p\n", rpos, &tpos); ok(rpos == &tpos, "wrong return fpos, expected = %p found = %p\n", rpos, &tpos);
ok(tpos.pos == 0, "wrong position, expected = 0 found = %s\n", wine_dbgstr_longlong(tpos.pos)); ok(tpos.pos == 0, "wrong position, expected = 0 found = %s\n", wine_dbgstr_longlong(tpos.pos));
ok(tpos.state == 0, "wrong state, expected = 0 found = %d\n", tpos.state); ok(tpos.state == 0, "wrong state, expected = 0 found = %d\n", tpos.state);
if(tests[i].seekoff == -1) {
ok(ss.basic_ios.base.state == IOSTATE_goodbit,
"ss.basic_ios.base.state = %x\n", ss.basic_ios.base.state);
}
call_func1(p_basic_stringstream_wchar_vbase_dtor, &wss); call_func1(p_basic_stringstream_wchar_vbase_dtor, &wss);
call_func1(p_basic_string_wchar_dtor, &wstr); call_func1(p_basic_string_wchar_dtor, &wstr);