Iván Matellanes : msvcirt: Add implementation of streambuf::gbump/pbump.
Module: wine Branch: master Commit: a3150b95dffc9b06413e1941a33d44eba76b2364 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a3150b95dffc9b06413e1941a3... Author: Iván Matellanes <matellanesivan(a)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(a)streambuf@@IAEXH(a)Z */ +/* ?gbump(a)streambuf@@IEAAXH(a)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(a)streambuf@@IAEXH(a)Z */ +/* ?pbump(a)streambuf@@IEAAXH(a)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(a)ostream@@QEAAAEAV1(a)XZ @ stub -arch=win32 ?freeze(a)strstreambuf@@QAEXH(a)Z # void __thiscall strstreambuf::freeze(int) @ stub -arch=win64 ?freeze(a)strstreambuf@@QEAAXH(a)Z -@ stub -arch=win32 ?gbump(a)streambuf@@IAEXH(a)Z # void __thiscall streambuf::gbump(int) -@ stub -arch=win64 ?gbump(a)streambuf@@IEAAXH(a)Z +@ thiscall -arch=win32 ?gbump(a)streambuf@@IAEXH(a)Z(ptr long) streambuf_gbump +@ cdecl -arch=win64 ?gbump(a)streambuf@@IEAAXH(a)Z(ptr long) streambuf_gbump @ stub -arch=win32 ?gcount(a)istream@@QBEHXZ # int __thiscall istream::gcount(void)const @ stub -arch=win64 ?gcount(a)istream@@QEBAHXZ @ stub -arch=win32 ?get(a)istream@@IAEAAV1(a)PADHH@Z # class istream & __thiscall istream::get(char *,int,int) @@ -589,8 +589,8 @@ @ cdecl -arch=win64 ?pbackfail(a)streambuf@@UEAAHH(a)Z(ptr long) streambuf_pbackfail @ thiscall -arch=win32 ?pbase(a)streambuf@@IBEPADXZ(ptr) streambuf_pbase @ cdecl -arch=win64 ?pbase(a)streambuf@@IEBAPEADXZ(ptr) streambuf_pbase -@ stub -arch=win32 ?pbump(a)streambuf@@IAEXH(a)Z # void __thiscall streambuf::pbump(int) -@ stub -arch=win64 ?pbump(a)streambuf@@IEAAXH(a)Z +@ thiscall -arch=win32 ?pbump(a)streambuf@@IAEXH(a)Z(ptr long) streambuf_pbump +@ cdecl -arch=win64 ?pbump(a)streambuf@@IEAAXH(a)Z(ptr long) streambuf_pbump @ stub -arch=win32 ?pcount(a)ostrstream@@QBEHXZ # int __thiscall ostrstream::pcount(void)const @ stub -arch=win64 ?pcount(a)ostrstream@@QEBAHXZ @ stub -arch=win32 ?pcount(a)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(a)streambuf@@IEAAHXZ"); SET(p_streambuf_clrclock, "?clrlock(a)streambuf@@QEAAXXZ"); SET(p_streambuf_doallocate, "?doallocate(a)streambuf@@MEAAHXZ"); + SET(p_streambuf_gbump, "?gbump(a)streambuf@@IEAAXH(a)Z"); SET(p_streambuf_lock, "?lock(a)streambuf@@QEAAXXZ"); + SET(p_streambuf_pbump, "?pbump(a)streambuf@@IEAAXH(a)Z"); 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"); @@ -148,7 +152,9 @@ static BOOL init(void) SET(p_streambuf_allocate, "?allocate(a)streambuf@@IAEHXZ"); SET(p_streambuf_clrclock, "?clrlock(a)streambuf@@QAEXXZ"); SET(p_streambuf_doallocate, "?doallocate(a)streambuf@@MAEHXZ"); + SET(p_streambuf_gbump, "?gbump(a)streambuf@@IAEXH(a)Z"); SET(p_streambuf_lock, "?lock(a)streambuf@@QAEXXZ"); + SET(p_streambuf_pbump, "?pbump(a)streambuf@@IAEXH(a)Z"); 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"); @@ -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(a)ostream@@QEAAAEAV1(a)XZ @ stub -arch=win32 ?freeze(a)strstreambuf@@QAEXH(a)Z @ stub -arch=win64 ?freeze(a)strstreambuf@@QEAAXH(a)Z -@ stub -arch=win32 ?gbump(a)streambuf@@IAEXH(a)Z -@ stub -arch=win64 ?gbump(a)streambuf@@IEAAXH(a)Z +@ thiscall -arch=win32 ?gbump(a)streambuf@@IAEXH(a)Z(ptr long) msvcirt.?gbump(a)streambuf@@IAEXH(a)Z +@ cdecl -arch=win64 ?gbump(a)streambuf@@IEAAXH(a)Z(ptr long) msvcirt.?gbump(a)streambuf@@IEAAXH(a)Z @ stub -arch=win32 ?gcount(a)istream@@QBEHXZ @ stub -arch=win64 ?gcount(a)istream@@QEBAHXZ @ stub -arch=win32 ?get(a)istream@@QAEAAV1(a)AAC@Z @@ -575,8 +575,8 @@ @ cdecl -arch=win64 ?pbackfail(a)streambuf@@UEAAHH(a)Z(ptr long) msvcirt.?pbackfail(a)streambuf@@UEAAHH(a)Z @ thiscall -arch=win32 ?pbase(a)streambuf@@IBEPADXZ(ptr) msvcirt.?pbase(a)streambuf@@IBEPADXZ @ cdecl -arch=win64 ?pbase(a)streambuf@@IEBAPEADXZ(ptr) msvcirt.?pbase(a)streambuf@@IEBAPEADXZ -@ stub -arch=win32 ?pbump(a)streambuf@@IAEXH(a)Z -@ stub -arch=win64 ?pbump(a)streambuf@@IEAAXH(a)Z +@ thiscall -arch=win32 ?pbump(a)streambuf@@IAEXH(a)Z(ptr long) msvcirt.?pbump(a)streambuf@@IAEXH(a)Z +@ cdecl -arch=win64 ?pbump(a)streambuf@@IEAAXH(a)Z(ptr long) msvcirt.?pbump(a)streambuf@@IEAAXH(a)Z @ stub -arch=win32 ?pcount(a)ostrstream@@QBEHXZ @ stub -arch=win64 ?pcount(a)ostrstream@@QEBAHXZ @ stub -arch=win32 ?pcount(a)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(a)ostream@@QEAAAEAV1(a)XZ @ stub -arch=win32 ?freeze(a)strstreambuf@@QAEXH(a)Z @ stub -arch=win64 ?freeze(a)strstreambuf@@QEAAXH(a)Z -@ stub -arch=win32 ?gbump(a)streambuf@@IAEXH(a)Z -@ stub -arch=win64 ?gbump(a)streambuf@@IEAAXH(a)Z +@ thiscall -arch=win32 ?gbump(a)streambuf@@IAEXH(a)Z(ptr long) msvcirt.?gbump(a)streambuf@@IAEXH(a)Z +@ cdecl -arch=win64 ?gbump(a)streambuf@@IEAAXH(a)Z(ptr long) msvcirt.?gbump(a)streambuf@@IEAAXH(a)Z @ stub -arch=win32 ?gcount(a)istream@@QBEHXZ @ stub -arch=win64 ?gcount(a)istream@@QEBAHXZ @ stub -arch=win32 ?get(a)istream@@IAEAAV1(a)PADHH@Z @@ -644,8 +644,8 @@ @ cdecl -arch=win64 ?pbackfail(a)streambuf@@UEAAHH(a)Z(ptr long) msvcirt.?pbackfail(a)streambuf@@UEAAHH(a)Z @ thiscall -arch=win32 ?pbase(a)streambuf@@IBEPADXZ(ptr) msvcirt.?pbase(a)streambuf@@IBEPADXZ @ cdecl -arch=win64 ?pbase(a)streambuf@@IEBAPEADXZ(ptr) msvcirt.?pbase(a)streambuf@@IEBAPEADXZ -@ stub -arch=win32 ?pbump(a)streambuf@@IAEXH(a)Z -@ stub -arch=win64 ?pbump(a)streambuf@@IEAAXH(a)Z +@ thiscall -arch=win32 ?pbump(a)streambuf@@IAEXH(a)Z(ptr long) msvcirt.?pbump(a)streambuf@@IAEXH(a)Z +@ cdecl -arch=win64 ?pbump(a)streambuf@@IEAAXH(a)Z(ptr long) msvcirt.?pbump(a)streambuf@@IEAAXH(a)Z @ stub -arch=win32 ?pcount(a)ostrstream@@QBEHXZ @ stub -arch=win64 ?pcount(a)ostrstream@@QEBAHXZ @ stub -arch=win32 ?pcount(a)strstream@@QBEHXZ
participants (1)
-
Alexandre Julliard