=?UTF-8?Q?Iv=C3=A1n=20Matellanes=20?=: msvcirt: Add implementation of streambuf::gbump/pbump.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jun 9 08:25:53 CDT 2015


Module: wine
Branch: master
Commit: a3150b95dffc9b06413e1941a33d44eba76b2364
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a3150b95dffc9b06413e1941a33d44eba76b2364

Author: Iván Matellanes <matellanesivan at gmail.com>
Date:   Mon Jun  8 21:26:51 2015 +0200

msvcirt: Add implementation of streambuf::gbump/pbump.

---

 dlls/msvcirt/msvcirt.c       | 18 ++++++++++++++++++
 dlls/msvcirt/msvcirt.spec    |  8 ++++----
 dlls/msvcirt/tests/msvcirt.c | 23 +++++++++++++++++++++++
 dlls/msvcrt20/msvcrt20.spec  |  8 ++++----
 dlls/msvcrt40/msvcrt40.spec  |  8 ++++----
 5 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c
index afb673d..a5b7141 100644
--- a/dlls/msvcirt/msvcirt.c
+++ b/dlls/msvcirt/msvcirt.c
@@ -317,6 +317,24 @@ CRITICAL_SECTION* __thiscall streambuf_lockptr(streambuf *this)
     return &this->lock;
 }
 
+/* ?gbump at streambuf@@IAEXH at Z */
+/* ?gbump at streambuf@@IEAAXH at Z */
+DEFINE_THISCALL_WRAPPER(streambuf_gbump, 8)
+void __thiscall streambuf_gbump(streambuf *this, int count)
+{
+    TRACE("(%p %d)\n", this, count);
+    this->gptr += count;
+}
+
+/* ?pbump at streambuf@@IAEXH at Z */
+/* ?pbump at streambuf@@IEAAXH at Z */
+DEFINE_THISCALL_WRAPPER(streambuf_pbump, 8)
+void __thiscall streambuf_pbump(streambuf *this, int count)
+{
+    TRACE("(%p %d)\n", this, count);
+    this->pptr += count;
+}
+
 /* Unexported */
 DEFINE_THISCALL_WRAPPER(streambuf_overflow, 8)
 int __thiscall streambuf_overflow(streambuf *this, int c)
diff --git a/dlls/msvcirt/msvcirt.spec b/dlls/msvcirt/msvcirt.spec
index d40ea47..576b905 100644
--- a/dlls/msvcirt/msvcirt.spec
+++ b/dlls/msvcirt/msvcirt.spec
@@ -491,8 +491,8 @@
 @ stub -arch=win64 ?flush at ostream@@QEAAAEAV1 at XZ
 @ stub -arch=win32 ?freeze at strstreambuf@@QAEXH at Z  # void __thiscall strstreambuf::freeze(int)
 @ stub -arch=win64 ?freeze at strstreambuf@@QEAAXH at Z
-@ stub -arch=win32 ?gbump at streambuf@@IAEXH at Z  # void __thiscall streambuf::gbump(int)
-@ stub -arch=win64 ?gbump at streambuf@@IEAAXH at Z
+@ thiscall -arch=win32 ?gbump at streambuf@@IAEXH at Z(ptr long) streambuf_gbump
+@ cdecl -arch=win64 ?gbump at streambuf@@IEAAXH at Z(ptr long) streambuf_gbump
 @ stub -arch=win32 ?gcount at istream@@QBEHXZ  # int __thiscall istream::gcount(void)const 
 @ stub -arch=win64 ?gcount at istream@@QEBAHXZ
 @ stub -arch=win32 ?get at istream@@IAEAAV1 at PADHH@Z  # class istream & __thiscall istream::get(char *,int,int)
@@ -589,8 +589,8 @@
 @ cdecl -arch=win64 ?pbackfail at streambuf@@UEAAHH at Z(ptr long) streambuf_pbackfail
 @ thiscall -arch=win32 ?pbase at streambuf@@IBEPADXZ(ptr) streambuf_pbase
 @ cdecl -arch=win64 ?pbase at streambuf@@IEBAPEADXZ(ptr) streambuf_pbase
-@ stub -arch=win32 ?pbump at streambuf@@IAEXH at Z  # void __thiscall streambuf::pbump(int)
-@ stub -arch=win64 ?pbump at streambuf@@IEAAXH at Z
+@ thiscall -arch=win32 ?pbump at streambuf@@IAEXH at Z(ptr long) streambuf_pbump
+@ cdecl -arch=win64 ?pbump at streambuf@@IEAAXH at Z(ptr long) streambuf_pbump
 @ stub -arch=win32 ?pcount at ostrstream@@QBEHXZ  # int __thiscall ostrstream::pcount(void)const 
 @ stub -arch=win64 ?pcount at ostrstream@@QEBAHXZ
 @ stub -arch=win32 ?pcount at strstream@@QBEHXZ  # int __thiscall strstream::pcount(void)const 
diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c
index 3c2c5ce..2a45b04 100644
--- a/dlls/msvcirt/tests/msvcirt.c
+++ b/dlls/msvcirt/tests/msvcirt.c
@@ -55,7 +55,9 @@ static void (*__thiscall p_streambuf_dtor)(streambuf*);
 static int (*__thiscall p_streambuf_allocate)(streambuf*);
 static void (*__thiscall p_streambuf_clrclock)(streambuf*);
 static int (*__thiscall p_streambuf_doallocate)(streambuf*);
+static void (*__thiscall p_streambuf_gbump)(streambuf*, int);
 static void (*__thiscall p_streambuf_lock)(streambuf*);
+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);
@@ -136,7 +138,9 @@ static BOOL init(void)
         SET(p_streambuf_allocate, "?allocate at streambuf@@IEAAHXZ");
         SET(p_streambuf_clrclock, "?clrlock at streambuf@@QEAAXXZ");
         SET(p_streambuf_doallocate, "?doallocate at streambuf@@MEAAHXZ");
+        SET(p_streambuf_gbump, "?gbump at streambuf@@IEAAXH at Z");
         SET(p_streambuf_lock, "?lock at streambuf@@QEAAXXZ");
+        SET(p_streambuf_pbump, "?pbump at streambuf@@IEAAXH at Z");
         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");
@@ -148,7 +152,9 @@ static BOOL init(void)
         SET(p_streambuf_allocate, "?allocate at streambuf@@IAEHXZ");
         SET(p_streambuf_clrclock, "?clrlock at streambuf@@QAEXXZ");
         SET(p_streambuf_doallocate, "?doallocate at streambuf@@MAEHXZ");
+        SET(p_streambuf_gbump, "?gbump at streambuf@@IAEXH at Z");
         SET(p_streambuf_lock, "?lock at streambuf@@QAEXXZ");
+        SET(p_streambuf_pbump, "?pbump at streambuf@@IAEXH at Z");
         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");
@@ -318,6 +324,23 @@ static void test_streambuf(void)
     ok(sb2.allocated == 1, "wrong allocate value, expected 1 got %d\n", sb2.allocated);
     ok(sb2.ebuf - sb2.base == 512 , "wrong reserve area size, expected 512 got %p-%p\n", sb2.ebuf, sb2.base);
 
+    /* gbump */
+    sb.eback = sb.base + 100;
+    sb.gptr = sb.base + 104;
+    sb.egptr = sb.base + 110;
+    call_func2(p_streambuf_gbump, &sb, 10);
+    ok(sb.gptr == sb.eback + 14, "advance get pointer failed, expected %p got %p\n", sb.eback + 14, sb.gptr);
+    call_func2(p_streambuf_gbump, &sb, -15);
+    ok(sb.gptr == sb.eback - 1, "advance get pointer failed, expected %p got %p\n", sb.eback - 1, sb.gptr);
+
+    /* pbump */
+    sb.pbase = sb.pptr = sb.base + 200;
+    sb.epptr = sb.base + 210;
+    call_func2(p_streambuf_pbump, &sb, -2);
+    ok(sb.pptr == sb.pbase - 2, "advance put pointer failed, expected %p got %p\n", sb.pbase - 2, sb.pptr);
+    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);
+
     SetEvent(lock_arg.test[3]);
     WaitForSingleObject(thread, INFINITE);
 
diff --git a/dlls/msvcrt20/msvcrt20.spec b/dlls/msvcrt20/msvcrt20.spec
index aff7bdc..5f43568 100644
--- a/dlls/msvcrt20/msvcrt20.spec
+++ b/dlls/msvcrt20/msvcrt20.spec
@@ -479,8 +479,8 @@
 @ stub -arch=win64 ?flush at ostream@@QEAAAEAV1 at XZ
 @ stub -arch=win32 ?freeze at strstreambuf@@QAEXH at Z
 @ stub -arch=win64 ?freeze at strstreambuf@@QEAAXH at Z
-@ stub -arch=win32 ?gbump at streambuf@@IAEXH at Z
-@ stub -arch=win64 ?gbump at streambuf@@IEAAXH at Z
+@ thiscall -arch=win32 ?gbump at streambuf@@IAEXH at Z(ptr long) msvcirt.?gbump at streambuf@@IAEXH at Z
+@ cdecl -arch=win64 ?gbump at streambuf@@IEAAXH at Z(ptr long) msvcirt.?gbump at streambuf@@IEAAXH at Z
 @ stub -arch=win32 ?gcount at istream@@QBEHXZ
 @ stub -arch=win64 ?gcount at istream@@QEBAHXZ
 @ stub -arch=win32 ?get at istream@@QAEAAV1 at AAC@Z
@@ -575,8 +575,8 @@
 @ cdecl -arch=win64 ?pbackfail at streambuf@@UEAAHH at Z(ptr long) msvcirt.?pbackfail at streambuf@@UEAAHH at Z
 @ thiscall -arch=win32 ?pbase at streambuf@@IBEPADXZ(ptr) msvcirt.?pbase at streambuf@@IBEPADXZ
 @ cdecl -arch=win64 ?pbase at streambuf@@IEBAPEADXZ(ptr) msvcirt.?pbase at streambuf@@IEBAPEADXZ
-@ stub -arch=win32 ?pbump at streambuf@@IAEXH at Z
-@ stub -arch=win64 ?pbump at streambuf@@IEAAXH at Z
+@ thiscall -arch=win32 ?pbump at streambuf@@IAEXH at Z(ptr long) msvcirt.?pbump at streambuf@@IAEXH at Z
+@ cdecl -arch=win64 ?pbump at streambuf@@IEAAXH at Z(ptr long) msvcirt.?pbump at streambuf@@IEAAXH at Z
 @ stub -arch=win32 ?pcount at ostrstream@@QBEHXZ
 @ stub -arch=win64 ?pcount at ostrstream@@QEBAHXZ
 @ stub -arch=win32 ?pcount at strstream@@QBEHXZ
diff --git a/dlls/msvcrt40/msvcrt40.spec b/dlls/msvcrt40/msvcrt40.spec
index 4574502..81cdcf9 100644
--- a/dlls/msvcrt40/msvcrt40.spec
+++ b/dlls/msvcrt40/msvcrt40.spec
@@ -544,8 +544,8 @@
 @ stub -arch=win64 ?flush at ostream@@QEAAAEAV1 at XZ
 @ stub -arch=win32 ?freeze at strstreambuf@@QAEXH at Z
 @ stub -arch=win64 ?freeze at strstreambuf@@QEAAXH at Z
-@ stub -arch=win32 ?gbump at streambuf@@IAEXH at Z
-@ stub -arch=win64 ?gbump at streambuf@@IEAAXH at Z
+@ thiscall -arch=win32 ?gbump at streambuf@@IAEXH at Z(ptr long) msvcirt.?gbump at streambuf@@IAEXH at Z
+@ cdecl -arch=win64 ?gbump at streambuf@@IEAAXH at Z(ptr long) msvcirt.?gbump at streambuf@@IEAAXH at Z
 @ stub -arch=win32 ?gcount at istream@@QBEHXZ
 @ stub -arch=win64 ?gcount at istream@@QEBAHXZ
 @ stub -arch=win32 ?get at istream@@IAEAAV1 at PADHH@Z
@@ -644,8 +644,8 @@
 @ cdecl -arch=win64 ?pbackfail at streambuf@@UEAAHH at Z(ptr long) msvcirt.?pbackfail at streambuf@@UEAAHH at Z
 @ thiscall -arch=win32 ?pbase at streambuf@@IBEPADXZ(ptr) msvcirt.?pbase at streambuf@@IBEPADXZ
 @ cdecl -arch=win64 ?pbase at streambuf@@IEBAPEADXZ(ptr) msvcirt.?pbase at streambuf@@IEBAPEADXZ
-@ stub -arch=win32 ?pbump at streambuf@@IAEXH at Z
-@ stub -arch=win64 ?pbump at streambuf@@IEAAXH at Z
+@ thiscall -arch=win32 ?pbump at streambuf@@IAEXH at Z(ptr long) msvcirt.?pbump at streambuf@@IAEXH at Z
+@ cdecl -arch=win64 ?pbump at streambuf@@IEAAXH at Z(ptr long) msvcirt.?pbump at streambuf@@IEAAXH at Z
 @ stub -arch=win32 ?pcount at ostrstream@@QBEHXZ
 @ stub -arch=win64 ?pcount at ostrstream@@QEBAHXZ
 @ stub -arch=win32 ?pcount at strstream@@QBEHXZ




More information about the wine-cvs mailing list