Iván Matellanes : msvcirt: Add implementation of streambuf::sync.
Module: wine Branch: master Commit: 1f1cf8a68e38c68fbdfbcaaf60d89930fff2dbef URL: http://source.winehq.org/git/wine.git/?a=commit;h=1f1cf8a68e38c68fbdfbcaaf60... Author: Iván Matellanes <matellanesivan(a)gmail.com> Date: Tue Jun 9 19:40:33 2015 +0200 msvcirt: Add implementation of streambuf::sync. --- dlls/msvcirt/msvcirt.c | 4 ++-- dlls/msvcirt/tests/msvcirt.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index a5b7141..e20fb68 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -437,8 +437,8 @@ void __thiscall streambuf_setp(streambuf *this, char *pb, char *ep) DEFINE_THISCALL_WRAPPER(streambuf_sync, 4) int __thiscall streambuf_sync(streambuf *this) { - FIXME("(%p): stub\n", this); - return EOF; + TRACE("(%p)\n", this); + return (this->gptr == this->egptr && this->pbase == this->pptr) ? 0 : EOF; } /* ?unbuffered(a)streambuf@@IAEXH(a)Z */ diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c index 2a45b04..057c6c8 100644 --- a/dlls/msvcirt/tests/msvcirt.c +++ b/dlls/msvcirt/tests/msvcirt.c @@ -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_setlock)(streambuf*); static streambuf* (*__thiscall p_streambuf_setbuf)(streambuf*, char*, int); +static int (*__thiscall p_streambuf_sync)(streambuf*); static void (*__thiscall p_streambuf_unlock)(streambuf*); /* Emulate a __thiscall */ @@ -144,6 +145,7 @@ static BOOL init(void) SET(p_streambuf_setb, "?setb(a)streambuf@@IEAAXPEAD0H(a)Z"); SET(p_streambuf_setbuf, "?setbuf(a)streambuf@@UEAAPEAV1(a)PEADH@Z"); SET(p_streambuf_setlock, "?setlock(a)streambuf@@QEAAXXZ"); + SET(p_streambuf_sync, "?sync(a)streambuf@@UEAAHXZ"); SET(p_streambuf_unlock, "?unlock(a)streambuf@@QEAAXXZ"); } else { SET(p_streambuf_reserve_ctor, "??0streambuf@@IAE(a)PADH@Z"); @@ -158,6 +160,7 @@ static BOOL init(void) SET(p_streambuf_setb, "?setb(a)streambuf@@IAEXPAD0H(a)Z"); SET(p_streambuf_setbuf, "?setbuf(a)streambuf@@UAEPAV1(a)PADH@Z"); SET(p_streambuf_setlock, "?setlock(a)streambuf@@QAEXXZ"); + SET(p_streambuf_sync, "?sync(a)streambuf@@UAEHXZ"); SET(p_streambuf_unlock, "?unlock(a)streambuf@@QAEXXZ"); } @@ -341,6 +344,18 @@ static void test_streambuf(void) 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); + /* 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]); WaitForSingleObject(thread, INFINITE);
participants (1)
-
Alexandre Julliard