Iván Matellanes : msvcirt: Add implementation of streambuf::stossc.
Module: wine Branch: master Commit: d553a0883f21cc6a990688975d54395e90c8c52a URL: http://source.winehq.org/git/wine.git/?a=commit;h=d553a0883f21cc6a990688975d... Author: Iván Matellanes <matellanesivan(a)gmail.com> Date: Thu Jun 25 19:02:17 2015 +0200 msvcirt: Add implementation of streambuf::stossc. --- dlls/msvcirt/msvcirt.c | 19 +++++++++++++++++++ dlls/msvcirt/msvcirt.spec | 4 ++-- dlls/msvcirt/tests/msvcirt.c | 27 +++++++++++++++++++++++++++ dlls/msvcrt20/msvcrt20.spec | 4 ++-- dlls/msvcrt40/msvcrt40.spec | 4 ++-- 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index 808237c..66858de 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -636,6 +636,25 @@ int __thiscall streambuf_sbumpc(streambuf *this) return ret; } +/* ?stossc(a)streambuf@@QAEXXZ */ +/* ?stossc(a)streambuf@@QEAAXXZ */ +DEFINE_THISCALL_WRAPPER(streambuf_stossc, 4) +void __thiscall streambuf_stossc(streambuf *this) +{ + TRACE("(%p)\n", this); + if (this->unbuffered) { + if (this->stored_char == EOF) + call_streambuf_underflow(this); + else + this->stored_char = EOF; + } else { + if (this->gptr >= this->egptr) + call_streambuf_underflow(this); + if (this->gptr < this->egptr) + this->gptr++; + } +} + /****************************************************************** * ??1ios@@UAE(a)XZ (MSVCRTI.@) * class ios & __thiscall ios::-ios<<(void) diff --git a/dlls/msvcirt/msvcirt.spec b/dlls/msvcirt/msvcirt.spec index b3f592d..913f186 100644 --- a/dlls/msvcirt/msvcirt.spec +++ b/dlls/msvcirt/msvcirt.spec @@ -710,8 +710,8 @@ @ cdecl -arch=win64 ?sputn(a)streambuf@@QEAAHPEBDH(a)Z(ptr str long) streambuf_sputn @ stub -arch=win32 ?stdiofile(a)stdiobuf@@QAEPAU_iobuf@@XZ # struct _iobuf * __thiscall stdiobuf::stdiofile(void) @ stub -arch=win64 ?stdiofile(a)stdiobuf@@QEAAPEAU_iobuf@@XZ -@ stub -arch=win32 ?stossc(a)streambuf@@QAEXXZ # void __thiscall streambuf::stossc(void) -@ stub -arch=win64 ?stossc(a)streambuf@@QEAAXXZ +@ thiscall -arch=win32 ?stossc(a)streambuf@@QAEXXZ(ptr) streambuf_stossc +@ cdecl -arch=win64 ?stossc(a)streambuf@@QEAAXXZ(ptr) streambuf_stossc @ stub -arch=win32 ?str(a)istrstream@@QAEPADXZ # char * __thiscall istrstream::str(void) @ stub -arch=win64 ?str(a)istrstream@@QEAAPEADXZ @ stub -arch=win32 ?str(a)ostrstream@@QAEPADXZ # char * __thiscall ostrstream::str(void) diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c index 8ebf045..42c0e3a 100644 --- a/dlls/msvcirt/tests/msvcirt.c +++ b/dlls/msvcirt/tests/msvcirt.c @@ -65,6 +65,7 @@ static streambuf* (*__thiscall p_streambuf_setbuf)(streambuf*, char*, int); static int (*__thiscall p_streambuf_sgetc)(streambuf*); static int (*__thiscall p_streambuf_snextc)(streambuf*); static int (*__thiscall p_streambuf_sputc)(streambuf*, int); +static void (*__thiscall p_streambuf_stossc)(streambuf*); static int (*__thiscall p_streambuf_sync)(streambuf*); static void (*__thiscall p_streambuf_unlock)(streambuf*); static int (*__thiscall p_streambuf_xsgetn)(streambuf*, char*, int); @@ -155,6 +156,7 @@ static BOOL init(void) SET(p_streambuf_sgetc, "?sgetc(a)streambuf@@QEAAHXZ"); SET(p_streambuf_snextc, "?snextc(a)streambuf@@QEAAHXZ"); SET(p_streambuf_sputc, "?sputc(a)streambuf@@QEAAHH(a)Z"); + SET(p_streambuf_stossc, "?stossc(a)streambuf@@QEAAXXZ"); SET(p_streambuf_sync, "?sync(a)streambuf@@UEAAHXZ"); SET(p_streambuf_unlock, "?unlock(a)streambuf@@QEAAXXZ"); SET(p_streambuf_xsgetn, "?xsgetn(a)streambuf@@UEAAHPEADH(a)Z"); @@ -176,6 +178,7 @@ static BOOL init(void) SET(p_streambuf_sgetc, "?sgetc(a)streambuf@@QAEHXZ"); SET(p_streambuf_snextc, "?snextc(a)streambuf@@QAEHXZ"); SET(p_streambuf_sputc, "?sputc(a)streambuf@@QAEHH(a)Z"); + SET(p_streambuf_stossc, "?stossc(a)streambuf@@QAEXXZ"); SET(p_streambuf_sync, "?sync(a)streambuf@@UAEHXZ"); SET(p_streambuf_unlock, "?unlock(a)streambuf@@QAEXXZ"); SET(p_streambuf_xsgetn, "?xsgetn(a)streambuf@@UAEHPADH(a)Z"); @@ -662,6 +665,30 @@ static void test_streambuf(void) ok(sb3.stored_char == EOF, "wrong stored character, expected EOF got %c\n", sb3.stored_char); ok(underflow_count == 54, "expected call to underflow\n"); + /* stossc */ + call_func1(p_streambuf_stossc, &sb); + ok(sb.gptr == sb.eback + 3, "wrong get pointer, expected %p got %p\n", sb.eback + 3, sb.gptr); + test_this = &sb2; + call_func1(p_streambuf_stossc, &sb2); + ok(sb2.gptr == sb2.egptr, "wrong get pointer, expected %p got %p\n", sb2.egptr, sb2.gptr); + ok(underflow_count == 55, "expected call to underflow\n"); + get_end = 0; + call_func1(p_streambuf_stossc, &sb2); + ok(sb2.gptr == sb2.eback + 1, "wrong get pointer, expected %p got %p\n", sb2.eback + 1, sb2.gptr); + ok(underflow_count == 56, "expected call to underflow\n"); + sb2.gptr = sb2.egptr - 1; + call_func1(p_streambuf_stossc, &sb2); + ok(sb2.gptr == sb2.egptr, "wrong get pointer, expected %p got %p\n", sb2.egptr, sb2.gptr); + ok(underflow_count == 56, "no call to underflow expected\n"); + test_this = &sb3; + call_func1(p_streambuf_stossc, &sb3); + ok(sb3.stored_char == EOF, "wrong stored character, expected EOF got %c\n", sb3.stored_char); + ok(underflow_count == 57, "expected call to underflow\n"); + sb3.stored_char = 'a'; + call_func1(p_streambuf_stossc, &sb3); + ok(sb3.stored_char == EOF, "wrong stored character, expected EOF got %c\n", sb3.stored_char); + ok(underflow_count == 57, "no call to underflow expected\n"); + SetEvent(lock_arg.test[3]); WaitForSingleObject(thread, INFINITE); diff --git a/dlls/msvcrt20/msvcrt20.spec b/dlls/msvcrt20/msvcrt20.spec index 2e4bc16..f37d876 100644 --- a/dlls/msvcrt20/msvcrt20.spec +++ b/dlls/msvcrt20/msvcrt20.spec @@ -698,8 +698,8 @@ @ cdecl -arch=win64 ?sputn(a)streambuf@@QEAAHPEBDH(a)Z(ptr str long) msvcirt.?sputn(a)streambuf@@QEAAHPEBDH(a)Z @ stub -arch=win32 ?stdiofile(a)stdiobuf@@QAEPAU_iobuf@@XZ @ stub -arch=win64 ?stdiofile(a)stdiobuf@@QEAAPEAU_iobuf@@XZ -@ stub -arch=win32 ?stossc(a)streambuf@@QAEXXZ -@ stub -arch=win64 ?stossc(a)streambuf@@QEAAXXZ +@ thiscall -arch=win32 ?stossc(a)streambuf@@QAEXXZ(ptr) msvcirt.?stossc(a)streambuf@@QAEXXZ +@ cdecl -arch=win64 ?stossc(a)streambuf@@QEAAXXZ(ptr) msvcirt.?stossc(a)streambuf@@QEAAXXZ @ stub -arch=win32 ?str(a)istrstream@@QAEPADXZ @ stub -arch=win64 ?str(a)istrstream@@QEAAPEADXZ @ stub -arch=win32 ?str(a)ostrstream@@QAEPADXZ diff --git a/dlls/msvcrt40/msvcrt40.spec b/dlls/msvcrt40/msvcrt40.spec index a3cfbdc..9173aef 100644 --- a/dlls/msvcrt40/msvcrt40.spec +++ b/dlls/msvcrt40/msvcrt40.spec @@ -770,8 +770,8 @@ @ cdecl -arch=win64 ?sputn(a)streambuf@@QEAAHPEBDH(a)Z(ptr str long) msvcirt.?sputn(a)streambuf@@QEAAHPEBDH(a)Z @ stub -arch=win32 ?stdiofile(a)stdiobuf@@QAEPAU_iobuf@@XZ @ stub -arch=win64 ?stdiofile(a)stdiobuf@@QEAAPEAU_iobuf@@XZ -@ stub -arch=win32 ?stossc(a)streambuf@@QAEXXZ -@ stub -arch=win64 ?stossc(a)streambuf@@QEAAXXZ +@ thiscall -arch=win32 ?stossc(a)streambuf@@QAEXXZ(ptr) msvcirt.?stossc(a)streambuf@@QAEXXZ +@ cdecl -arch=win64 ?stossc(a)streambuf@@QEAAXXZ(ptr) msvcirt.?stossc(a)streambuf@@QEAAXXZ @ stub -arch=win32 ?str(a)istrstream@@QAEPADXZ @ stub -arch=win64 ?str(a)istrstream@@QEAAPEADXZ @ stub -arch=win32 ?str(a)ostrstream@@QAEPADXZ
participants (1)
-
Alexandre Julliard