msvcp110: Use sentry in istream<>::tellg.

Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2016-04-04 13:24:21 -07:00 committed by Alexandre Julliard
parent 4686a5ee59
commit 3888aa4d8d
1 changed files with 30 additions and 1 deletions

View File

@ -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;
}