[03/10] msvcirt: Implement strstreambuf::freeze
Iván Matellanes
matellanesivan at gmail.com
Sun Sep 13 10:43:52 CDT 2015
---
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 c5bd7b5..fd5649f 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 at strstreambuf@@UAEHH at Z */
diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c
index 1aa780f..3919e6a 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 at PEAEH0@Z");
SET(p_strstreambuf_ctor, "??0strstreambuf@@QEAA at XZ");
SET(p_strstreambuf_dtor, "??1strstreambuf@@UEAA at XZ");
+ SET(p_strstreambuf_freeze, "?freeze at strstreambuf@@QEAAXH at Z");
SET(p_ios_copy_ctor, "??0ios@@IEAA at AEBV0@@Z");
SET(p_ios_ctor, "??0ios@@IEAA at XZ");
@@ -417,6 +419,7 @@ static BOOL init(void)
SET(p_strstreambuf_ubuffer_ctor, "??0strstreambuf@@QAE at PAEH0@Z");
SET(p_strstreambuf_ctor, "??0strstreambuf@@QAE at XZ");
SET(p_strstreambuf_dtor, "??1strstreambuf@@UAE at XZ");
+ SET(p_strstreambuf_freeze, "?freeze at strstreambuf@@QAEXH at Z");
SET(p_ios_copy_ctor, "??0ios@@IAE at ABV0@@Z");
SET(p_ios_ctor, "??0ios@@IAE at XZ");
@@ -1516,7 +1519,6 @@ static void test_strstreambuf(void)
ok(ssb1.base.epptr == buffer + 0x7fffffff, "wrong put end, expected %p + 0x7fffffff 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);
@@ -1525,6 +1527,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);
}
--
2.1.4
More information about the wine-patches
mailing list