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

Alexandre Julliard julliard at winehq.org
Thu Sep 13 03:49:16 CDT 2018


Module: wine
Branch: stable
Commit: 091c963734fd29e84ffae0fac3d0124eea33eb86
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=091c963734fd29e84ffae0fac3d0124eea33eb86

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Jul 19 17:59:55 2018 +0200

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 98bc9fdaa431f274fe3a9fc538b0b562c6fad981)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/msvcp90/ios.c       | 11 -----------
 dlls/msvcp90/tests/ios.c |  8 ++++++++
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 3f85997..fb9d668 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -8823,9 +8823,6 @@ fpos_mbstatet* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpo
     if(basic_istream_char_sentry_create(this, TRUE)) {
         basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
                 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 {
         ret->off = -1;
         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),
             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
 
     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)) {
         basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
                 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 {
         ret->off = -1;
         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),
             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
     return ret;
 }
diff --git a/dlls/msvcp90/tests/ios.c b/dlls/msvcp90/tests/ios.c
index c075f01..e1a08ff 100644
--- a/dlls/msvcp90/tests/ios.c
+++ b/dlls/msvcp90/tests/ios.c
@@ -1857,6 +1857,10 @@ static void test_istream_tellg(void)
         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.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_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(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);
+        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_string_wchar_dtor, &wstr);




More information about the wine-cvs mailing list