msvcirt: Add implementation of streambuf::sync.
This commit is contained in:
parent
7fe0b56e15
commit
1f1cf8a68e
|
@ -437,8 +437,8 @@ void __thiscall streambuf_setp(streambuf *this, char *pb, char *ep)
|
||||||
DEFINE_THISCALL_WRAPPER(streambuf_sync, 4)
|
DEFINE_THISCALL_WRAPPER(streambuf_sync, 4)
|
||||||
int __thiscall streambuf_sync(streambuf *this)
|
int __thiscall streambuf_sync(streambuf *this)
|
||||||
{
|
{
|
||||||
FIXME("(%p): stub\n", this);
|
TRACE("(%p)\n", this);
|
||||||
return EOF;
|
return (this->gptr == this->egptr && this->pbase == this->pptr) ? 0 : EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ?unbuffered@streambuf@@IAEXH@Z */
|
/* ?unbuffered@streambuf@@IAEXH@Z */
|
||||||
|
|
|
@ -61,6 +61,7 @@ static void (*__thiscall p_streambuf_pbump)(streambuf*, int);
|
||||||
static void (*__thiscall p_streambuf_setb)(streambuf*, char*, char*, int);
|
static void (*__thiscall p_streambuf_setb)(streambuf*, char*, char*, int);
|
||||||
static void (*__thiscall p_streambuf_setlock)(streambuf*);
|
static void (*__thiscall p_streambuf_setlock)(streambuf*);
|
||||||
static streambuf* (*__thiscall p_streambuf_setbuf)(streambuf*, char*, int);
|
static streambuf* (*__thiscall p_streambuf_setbuf)(streambuf*, char*, int);
|
||||||
|
static int (*__thiscall p_streambuf_sync)(streambuf*);
|
||||||
static void (*__thiscall p_streambuf_unlock)(streambuf*);
|
static void (*__thiscall p_streambuf_unlock)(streambuf*);
|
||||||
|
|
||||||
/* Emulate a __thiscall */
|
/* Emulate a __thiscall */
|
||||||
|
@ -144,6 +145,7 @@ static BOOL init(void)
|
||||||
SET(p_streambuf_setb, "?setb@streambuf@@IEAAXPEAD0H@Z");
|
SET(p_streambuf_setb, "?setb@streambuf@@IEAAXPEAD0H@Z");
|
||||||
SET(p_streambuf_setbuf, "?setbuf@streambuf@@UEAAPEAV1@PEADH@Z");
|
SET(p_streambuf_setbuf, "?setbuf@streambuf@@UEAAPEAV1@PEADH@Z");
|
||||||
SET(p_streambuf_setlock, "?setlock@streambuf@@QEAAXXZ");
|
SET(p_streambuf_setlock, "?setlock@streambuf@@QEAAXXZ");
|
||||||
|
SET(p_streambuf_sync, "?sync@streambuf@@UEAAHXZ");
|
||||||
SET(p_streambuf_unlock, "?unlock@streambuf@@QEAAXXZ");
|
SET(p_streambuf_unlock, "?unlock@streambuf@@QEAAXXZ");
|
||||||
} else {
|
} else {
|
||||||
SET(p_streambuf_reserve_ctor, "??0streambuf@@IAE@PADH@Z");
|
SET(p_streambuf_reserve_ctor, "??0streambuf@@IAE@PADH@Z");
|
||||||
|
@ -158,6 +160,7 @@ static BOOL init(void)
|
||||||
SET(p_streambuf_setb, "?setb@streambuf@@IAEXPAD0H@Z");
|
SET(p_streambuf_setb, "?setb@streambuf@@IAEXPAD0H@Z");
|
||||||
SET(p_streambuf_setbuf, "?setbuf@streambuf@@UAEPAV1@PADH@Z");
|
SET(p_streambuf_setbuf, "?setbuf@streambuf@@UAEPAV1@PADH@Z");
|
||||||
SET(p_streambuf_setlock, "?setlock@streambuf@@QAEXXZ");
|
SET(p_streambuf_setlock, "?setlock@streambuf@@QAEXXZ");
|
||||||
|
SET(p_streambuf_sync, "?sync@streambuf@@UAEHXZ");
|
||||||
SET(p_streambuf_unlock, "?unlock@streambuf@@QAEXXZ");
|
SET(p_streambuf_unlock, "?unlock@streambuf@@QAEXXZ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,6 +344,18 @@ static void test_streambuf(void)
|
||||||
call_func2(p_streambuf_pbump, &sb, 20);
|
call_func2(p_streambuf_pbump, &sb, 20);
|
||||||
ok(sb.pptr == sb.pbase + 18, "advance put pointer failed, expected %p got %p\n", sb.pbase + 18, sb.pptr);
|
ok(sb.pptr == sb.pbase + 18, "advance put pointer failed, expected %p got %p\n", sb.pbase + 18, sb.pptr);
|
||||||
|
|
||||||
|
/* sync */
|
||||||
|
ret = (int) call_func1(p_streambuf_sync, &sb);
|
||||||
|
ok(ret == EOF, "sync failed, expected EOF got %d\n", ret);
|
||||||
|
sb.gptr = sb.egptr;
|
||||||
|
ret = (int) call_func1(p_streambuf_sync, &sb);
|
||||||
|
ok(ret == EOF, "sync failed, expected EOF got %d\n", ret);
|
||||||
|
sb.pptr = sb.pbase;
|
||||||
|
ret = (int) call_func1(p_streambuf_sync, &sb);
|
||||||
|
ok(ret == 0, "sync failed, expected 0 got %d\n", ret);
|
||||||
|
ret = (int) call_func1(p_streambuf_sync, &sb2);
|
||||||
|
ok(ret == 0, "sync failed, expected 0 got %d\n", ret);
|
||||||
|
|
||||||
SetEvent(lock_arg.test[3]);
|
SetEvent(lock_arg.test[3]);
|
||||||
WaitForSingleObject(thread, INFINITE);
|
WaitForSingleObject(thread, INFINITE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue