Module: wine Branch: master Commit: a8b26a96b4d6d57052515d149f9ea35952af1737 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a8b26a96b4d6d57052515d149f...
Author: Iván Matellanes matellanesivan@gmail.com Date: Thu Sep 17 11:06:48 2015 +0200
msvcirt: Implement strstreambuf::freeze.
---
dlls/msvcirt/msvcirt.c | 4 +++- dlls/msvcirt/tests/msvcirt.c | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index b50745c..4d0f4f6 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -1289,7 +1289,9 @@ int __thiscall strstreambuf_doallocate(strstreambuf *this) DEFINE_THISCALL_WRAPPER(strstreambuf_freeze, 8) void __thiscall strstreambuf_freeze(strstreambuf *this, int frozen) { - FIXME("(%p %d) stub\n", this, frozen); + TRACE("(%p %d)\n", this, frozen); + if (!this->constant) + this->dynamic = !frozen; }
/* ?overflow@strstreambuf@@UAEHH@Z */ diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c index 932e6fb..aaa9f1c 100644 --- a/dlls/msvcirt/tests/msvcirt.c +++ b/dlls/msvcirt/tests/msvcirt.c @@ -193,6 +193,7 @@ static strstreambuf* (*__thiscall p_strstreambuf_buffer_ctor)(strstreambuf*, cha static strstreambuf* (*__thiscall p_strstreambuf_ubuffer_ctor)(strstreambuf*, unsigned char*, int, unsigned char*); static strstreambuf* (*__thiscall p_strstreambuf_ctor)(strstreambuf*); static void (*__thiscall p_strstreambuf_dtor)(strstreambuf*); +static void (*__thiscall p_strstreambuf_freeze)(strstreambuf*, int);
/* ios */ static ios* (*__thiscall p_ios_copy_ctor)(ios*, const ios*); @@ -345,6 +346,7 @@ static BOOL init(void) SET(p_strstreambuf_ubuffer_ctor, "??0strstreambuf@@QEAA@PEAEH0@Z"); SET(p_strstreambuf_ctor, "??0strstreambuf@@QEAA@XZ"); SET(p_strstreambuf_dtor, "??1strstreambuf@@UEAA@XZ"); + SET(p_strstreambuf_freeze, "?freeze@strstreambuf@@QEAAXH@Z");
SET(p_ios_copy_ctor, "??0ios@@IEAA@AEBV0@@Z"); SET(p_ios_ctor, "??0ios@@IEAA@XZ"); @@ -417,6 +419,7 @@ static BOOL init(void) SET(p_strstreambuf_ubuffer_ctor, "??0strstreambuf@@QAE@PAEH0@Z"); SET(p_strstreambuf_ctor, "??0strstreambuf@@QAE@XZ"); SET(p_strstreambuf_dtor, "??1strstreambuf@@UAE@XZ"); + SET(p_strstreambuf_freeze, "?freeze@strstreambuf@@QAEXH@Z");
SET(p_ios_copy_ctor, "??0ios@@IAE@ABV0@@Z"); SET(p_ios_ctor, "??0ios@@IAE@XZ"); @@ -1518,7 +1521,6 @@ static void test_strstreambuf(void) "wrong put end, expected %p + 0x7fffffff or -1, got %p\n", buffer, ssb1.base.epptr); ok(ssb1.dynamic == 0, "expected 0, got %d\n", ssb1.dynamic); ok(ssb1.constant == 1, "expected 1, got %d\n", ssb1.constant); - call_func1(p_strstreambuf_dtor, &ssb1); call_func1(p_strstreambuf_ctor, &ssb2); ok(ssb2.base.allocated == 0, "wrong allocate value, expected 0 got %d\n", ssb2.base.allocated); ok(ssb2.base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", ssb2.base.unbuffered); @@ -1527,6 +1529,22 @@ static void test_strstreambuf(void) ok(ssb2.constant == 0, "expected 0, got %d\n", ssb2.constant); ok(ssb2.f_alloc == NULL, "expected %p, got %p\n", NULL, ssb2.f_alloc); ok(ssb2.f_free == NULL, "expected %p, got %p\n", NULL, ssb2.f_free); + + /* freeze */ + call_func2(p_strstreambuf_freeze, &ssb1, 0); + ok(ssb1.dynamic == 0, "expected 0, got %d\n", ssb1.dynamic); + ssb1.constant = 0; + call_func2(p_strstreambuf_freeze, &ssb1, 0); + ok(ssb1.dynamic == 1, "expected 1, got %d\n", ssb1.dynamic); + call_func2(p_strstreambuf_freeze, &ssb1, 3); + ok(ssb1.dynamic == 0, "expected 0, got %d\n", ssb1.dynamic); + ssb1.constant = 1; + call_func2(p_strstreambuf_freeze, &ssb2, 5); + ok(ssb2.dynamic == 0, "expected 0, got %d\n", ssb2.dynamic); + call_func2(p_strstreambuf_freeze, &ssb2, 0); + ok(ssb2.dynamic == 1, "expected 1, got %d\n", ssb2.dynamic); + + call_func1(p_strstreambuf_dtor, &ssb1); call_func1(p_strstreambuf_dtor, &ssb2); }