=?UTF-8?Q?Iv=C3=A1n=20Matellanes=20?=: msvcirt: Add implementation of streambuf::sync.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jun 11 09:46:11 CDT 2015
Module: wine
Branch: master
Commit: 1f1cf8a68e38c68fbdfbcaaf60d89930fff2dbef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1f1cf8a68e38c68fbdfbcaaf60d89930fff2dbef
Author: Iván Matellanes <matellanesivan at 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 at streambuf@@IAEXH at 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 at streambuf@@IEAAXPEAD0H at Z");
SET(p_streambuf_setbuf, "?setbuf at streambuf@@UEAAPEAV1 at PEADH@Z");
SET(p_streambuf_setlock, "?setlock at streambuf@@QEAAXXZ");
+ SET(p_streambuf_sync, "?sync at streambuf@@UEAAHXZ");
SET(p_streambuf_unlock, "?unlock at streambuf@@QEAAXXZ");
} else {
SET(p_streambuf_reserve_ctor, "??0streambuf@@IAE at PADH@Z");
@@ -158,6 +160,7 @@ static BOOL init(void)
SET(p_streambuf_setb, "?setb at streambuf@@IAEXPAD0H at Z");
SET(p_streambuf_setbuf, "?setbuf at streambuf@@UAEPAV1 at PADH@Z");
SET(p_streambuf_setlock, "?setlock at streambuf@@QAEXXZ");
+ SET(p_streambuf_sync, "?sync at streambuf@@UAEHXZ");
SET(p_streambuf_unlock, "?unlock at 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);
More information about the wine-cvs
mailing list