Daniel Lehman : msvcp110: Use sentry in istream<>::tellg.
Module: wine Branch: master Commit: 3888aa4d8d406fce2c63b79e4e8fe164cd549a36 URL: http://source.winehq.org/git/wine.git/?a=commit;h=3888aa4d8d406fce2c63b79e4e... Author: Daniel Lehman <dlehman(a)esri.com> Date: Mon Apr 4 13:24:21 2016 -0700 msvcp110: Use sentry in istream<>::tellg. Signed-off-by: Daniel Lehman <dlehman(a)esri.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcp90/ios.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index fbbb320..6b9a820 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -8746,6 +8746,20 @@ fpos_int* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpos_int TRACE("(%p %p)\n", this, ret); +#if _MSVCP_VER >= 110 + 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 && ret->state==0) + basic_ios_char_setstate(base, IOSTATE_failbit); + }else { + ret->off = -1; + ret->pos = 0; + ret->state = 0; + } + basic_istream_char_sentry_destroy(this); +#else if(ios_base_fail(&base->base)) { ret->off = -1; ret->pos = 0; @@ -8758,6 +8772,7 @@ fpos_int* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpos_int if(ret->off==-1 && ret->pos==0 && ret->state==0) basic_ios_char_setstate(base, IOSTATE_failbit); +#endif return ret; } @@ -10270,6 +10285,20 @@ fpos_int* __thiscall basic_istream_wchar_tellg(basic_istream_wchar *this, fpos_i TRACE("(%p %p)\n", this, ret); +#if _MSVCP_VER >= 110 + 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 && ret->state==0) + basic_ios_wchar_setstate(base, IOSTATE_failbit); + }else { + ret->off = -1; + ret->pos = 0; + ret->state = 0; + } + basic_istream_wchar_sentry_destroy(this); +#else if(ios_base_fail(&base->base)) { ret->off = -1; ret->pos = 0; @@ -10281,7 +10310,7 @@ fpos_int* __thiscall basic_istream_wchar_tellg(basic_istream_wchar *this, fpos_i ret, 0, SEEKDIR_cur, OPENMODE_in); if(ret->off==-1 && ret->pos==0 && ret->state==0) basic_ios_wchar_setstate(base, IOSTATE_failbit); - +#endif return ret; }
participants (1)
-
Alexandre Julliard