msvcirt: Add implementation of streambuf::stossc.

This commit is contained in:
Iván Matellanes 2015-06-25 19:02:17 +02:00 committed by Alexandre Julliard
parent 346a8e1cbf
commit d553a0883f
5 changed files with 52 additions and 6 deletions

View File

@ -636,6 +636,25 @@ int __thiscall streambuf_sbumpc(streambuf *this)
return ret; return ret;
} }
/* ?stossc@streambuf@@QAEXXZ */
/* ?stossc@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@XZ (MSVCRTI.@) * ??1ios@@UAE@XZ (MSVCRTI.@)
* class ios & __thiscall ios::-ios<<(void) * class ios & __thiscall ios::-ios<<(void)

View File

@ -710,8 +710,8 @@
@ cdecl -arch=win64 ?sputn@streambuf@@QEAAHPEBDH@Z(ptr str long) streambuf_sputn @ cdecl -arch=win64 ?sputn@streambuf@@QEAAHPEBDH@Z(ptr str long) streambuf_sputn
@ stub -arch=win32 ?stdiofile@stdiobuf@@QAEPAU_iobuf@@XZ # struct _iobuf * __thiscall stdiobuf::stdiofile(void) @ stub -arch=win32 ?stdiofile@stdiobuf@@QAEPAU_iobuf@@XZ # struct _iobuf * __thiscall stdiobuf::stdiofile(void)
@ stub -arch=win64 ?stdiofile@stdiobuf@@QEAAPEAU_iobuf@@XZ @ stub -arch=win64 ?stdiofile@stdiobuf@@QEAAPEAU_iobuf@@XZ
@ stub -arch=win32 ?stossc@streambuf@@QAEXXZ # void __thiscall streambuf::stossc(void) @ thiscall -arch=win32 ?stossc@streambuf@@QAEXXZ(ptr) streambuf_stossc
@ stub -arch=win64 ?stossc@streambuf@@QEAAXXZ @ cdecl -arch=win64 ?stossc@streambuf@@QEAAXXZ(ptr) streambuf_stossc
@ stub -arch=win32 ?str@istrstream@@QAEPADXZ # char * __thiscall istrstream::str(void) @ stub -arch=win32 ?str@istrstream@@QAEPADXZ # char * __thiscall istrstream::str(void)
@ stub -arch=win64 ?str@istrstream@@QEAAPEADXZ @ stub -arch=win64 ?str@istrstream@@QEAAPEADXZ
@ stub -arch=win32 ?str@ostrstream@@QAEPADXZ # char * __thiscall ostrstream::str(void) @ stub -arch=win32 ?str@ostrstream@@QAEPADXZ # char * __thiscall ostrstream::str(void)

View File

@ -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_sgetc)(streambuf*);
static int (*__thiscall p_streambuf_snextc)(streambuf*); static int (*__thiscall p_streambuf_snextc)(streambuf*);
static int (*__thiscall p_streambuf_sputc)(streambuf*, int); static int (*__thiscall p_streambuf_sputc)(streambuf*, int);
static void (*__thiscall p_streambuf_stossc)(streambuf*);
static int (*__thiscall p_streambuf_sync)(streambuf*); static int (*__thiscall p_streambuf_sync)(streambuf*);
static void (*__thiscall p_streambuf_unlock)(streambuf*); static void (*__thiscall p_streambuf_unlock)(streambuf*);
static int (*__thiscall p_streambuf_xsgetn)(streambuf*, char*, int); static int (*__thiscall p_streambuf_xsgetn)(streambuf*, char*, int);
@ -155,6 +156,7 @@ static BOOL init(void)
SET(p_streambuf_sgetc, "?sgetc@streambuf@@QEAAHXZ"); SET(p_streambuf_sgetc, "?sgetc@streambuf@@QEAAHXZ");
SET(p_streambuf_snextc, "?snextc@streambuf@@QEAAHXZ"); SET(p_streambuf_snextc, "?snextc@streambuf@@QEAAHXZ");
SET(p_streambuf_sputc, "?sputc@streambuf@@QEAAHH@Z"); SET(p_streambuf_sputc, "?sputc@streambuf@@QEAAHH@Z");
SET(p_streambuf_stossc, "?stossc@streambuf@@QEAAXXZ");
SET(p_streambuf_sync, "?sync@streambuf@@UEAAHXZ"); SET(p_streambuf_sync, "?sync@streambuf@@UEAAHXZ");
SET(p_streambuf_unlock, "?unlock@streambuf@@QEAAXXZ"); SET(p_streambuf_unlock, "?unlock@streambuf@@QEAAXXZ");
SET(p_streambuf_xsgetn, "?xsgetn@streambuf@@UEAAHPEADH@Z"); SET(p_streambuf_xsgetn, "?xsgetn@streambuf@@UEAAHPEADH@Z");
@ -176,6 +178,7 @@ static BOOL init(void)
SET(p_streambuf_sgetc, "?sgetc@streambuf@@QAEHXZ"); SET(p_streambuf_sgetc, "?sgetc@streambuf@@QAEHXZ");
SET(p_streambuf_snextc, "?snextc@streambuf@@QAEHXZ"); SET(p_streambuf_snextc, "?snextc@streambuf@@QAEHXZ");
SET(p_streambuf_sputc, "?sputc@streambuf@@QAEHH@Z"); SET(p_streambuf_sputc, "?sputc@streambuf@@QAEHH@Z");
SET(p_streambuf_stossc, "?stossc@streambuf@@QAEXXZ");
SET(p_streambuf_sync, "?sync@streambuf@@UAEHXZ"); SET(p_streambuf_sync, "?sync@streambuf@@UAEHXZ");
SET(p_streambuf_unlock, "?unlock@streambuf@@QAEXXZ"); SET(p_streambuf_unlock, "?unlock@streambuf@@QAEXXZ");
SET(p_streambuf_xsgetn, "?xsgetn@streambuf@@UAEHPADH@Z"); SET(p_streambuf_xsgetn, "?xsgetn@streambuf@@UAEHPADH@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(sb3.stored_char == EOF, "wrong stored character, expected EOF got %c\n", sb3.stored_char);
ok(underflow_count == 54, "expected call to underflow\n"); 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]); SetEvent(lock_arg.test[3]);
WaitForSingleObject(thread, INFINITE); WaitForSingleObject(thread, INFINITE);

View File

@ -698,8 +698,8 @@
@ cdecl -arch=win64 ?sputn@streambuf@@QEAAHPEBDH@Z(ptr str long) msvcirt.?sputn@streambuf@@QEAAHPEBDH@Z @ cdecl -arch=win64 ?sputn@streambuf@@QEAAHPEBDH@Z(ptr str long) msvcirt.?sputn@streambuf@@QEAAHPEBDH@Z
@ stub -arch=win32 ?stdiofile@stdiobuf@@QAEPAU_iobuf@@XZ @ stub -arch=win32 ?stdiofile@stdiobuf@@QAEPAU_iobuf@@XZ
@ stub -arch=win64 ?stdiofile@stdiobuf@@QEAAPEAU_iobuf@@XZ @ stub -arch=win64 ?stdiofile@stdiobuf@@QEAAPEAU_iobuf@@XZ
@ stub -arch=win32 ?stossc@streambuf@@QAEXXZ @ thiscall -arch=win32 ?stossc@streambuf@@QAEXXZ(ptr) msvcirt.?stossc@streambuf@@QAEXXZ
@ stub -arch=win64 ?stossc@streambuf@@QEAAXXZ @ cdecl -arch=win64 ?stossc@streambuf@@QEAAXXZ(ptr) msvcirt.?stossc@streambuf@@QEAAXXZ
@ stub -arch=win32 ?str@istrstream@@QAEPADXZ @ stub -arch=win32 ?str@istrstream@@QAEPADXZ
@ stub -arch=win64 ?str@istrstream@@QEAAPEADXZ @ stub -arch=win64 ?str@istrstream@@QEAAPEADXZ
@ stub -arch=win32 ?str@ostrstream@@QAEPADXZ @ stub -arch=win32 ?str@ostrstream@@QAEPADXZ

View File

@ -770,8 +770,8 @@
@ cdecl -arch=win64 ?sputn@streambuf@@QEAAHPEBDH@Z(ptr str long) msvcirt.?sputn@streambuf@@QEAAHPEBDH@Z @ cdecl -arch=win64 ?sputn@streambuf@@QEAAHPEBDH@Z(ptr str long) msvcirt.?sputn@streambuf@@QEAAHPEBDH@Z
@ stub -arch=win32 ?stdiofile@stdiobuf@@QAEPAU_iobuf@@XZ @ stub -arch=win32 ?stdiofile@stdiobuf@@QAEPAU_iobuf@@XZ
@ stub -arch=win64 ?stdiofile@stdiobuf@@QEAAPEAU_iobuf@@XZ @ stub -arch=win64 ?stdiofile@stdiobuf@@QEAAPEAU_iobuf@@XZ
@ stub -arch=win32 ?stossc@streambuf@@QAEXXZ @ thiscall -arch=win32 ?stossc@streambuf@@QAEXXZ(ptr) msvcirt.?stossc@streambuf@@QAEXXZ
@ stub -arch=win64 ?stossc@streambuf@@QEAAXXZ @ cdecl -arch=win64 ?stossc@streambuf@@QEAAXXZ(ptr) msvcirt.?stossc@streambuf@@QEAAXXZ
@ stub -arch=win32 ?str@istrstream@@QAEPADXZ @ stub -arch=win32 ?str@istrstream@@QAEPADXZ
@ stub -arch=win64 ?str@istrstream@@QEAAPEADXZ @ stub -arch=win64 ?str@istrstream@@QEAAPEADXZ
@ stub -arch=win32 ?str@ostrstream@@QAEPADXZ @ stub -arch=win32 ?str@ostrstream@@QAEPADXZ