msvcirt: Implement ostrstream constructors.
Signed-off-by: Iván Matellanes <matellanesivan@gmail.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1c1df68724
commit
96633cda3f
|
@ -2951,12 +2951,28 @@ ostream* __thiscall ostream_withassign_ctor(ostream *this, BOOL virt_init)
|
|||
return this;
|
||||
}
|
||||
|
||||
static ostream* ostrstream_internal_sb_ctor(ostream *this, strstreambuf *ssb, BOOL virt_init)
|
||||
{
|
||||
ios *base;
|
||||
|
||||
if (ssb)
|
||||
ostream_sb_ctor(this, &ssb->base, virt_init);
|
||||
else
|
||||
ostream_ctor(this, virt_init);
|
||||
base = ostream_get_ios(this);
|
||||
base->vtable = &MSVCP_ostrstream_vtable;
|
||||
base->delbuf = 1;
|
||||
return this;
|
||||
}
|
||||
|
||||
/* ??0ostrstream@@QAE@ABV0@@Z */
|
||||
/* ??0ostrstream@@QEAA@AEBV0@@Z */
|
||||
DEFINE_THISCALL_WRAPPER(ostrstream_copy_ctor, 12)
|
||||
ostream* __thiscall ostrstream_copy_ctor(ostream *this, const ostream *copy, BOOL virt_init)
|
||||
{
|
||||
FIXME("(%p %p %d) stub\n", this, copy, virt_init);
|
||||
TRACE("(%p %p %d)\n", this, copy, virt_init);
|
||||
ostream_withassign_copy_ctor(this, copy, virt_init);
|
||||
ostream_get_ios(this)->vtable = &MSVCP_ostrstream_vtable;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -2965,8 +2981,16 @@ ostream* __thiscall ostrstream_copy_ctor(ostream *this, const ostream *copy, BOO
|
|||
DEFINE_THISCALL_WRAPPER(ostrstream_buffer_ctor, 20)
|
||||
ostream* __thiscall ostrstream_buffer_ctor(ostream *this, char *buffer, int length, int mode, BOOL virt_init)
|
||||
{
|
||||
FIXME("(%p %p %d %d %d) stub\n", this, buffer, length, mode, virt_init);
|
||||
return this;
|
||||
strstreambuf *ssb = MSVCRT_operator_new(sizeof(strstreambuf));
|
||||
|
||||
TRACE("(%p %p %d %d %d)\n", this, buffer, length, mode, virt_init);
|
||||
|
||||
if (ssb) {
|
||||
strstreambuf_buffer_ctor(ssb, buffer, length, buffer);
|
||||
if (mode & (OPENMODE_app|OPENMODE_ate))
|
||||
ssb->base.pptr = buffer + strlen(buffer);
|
||||
}
|
||||
return ostrstream_internal_sb_ctor(this, ssb, virt_init);
|
||||
}
|
||||
|
||||
/* ??0ostrstream@@QAE@XZ */
|
||||
|
@ -2974,8 +2998,13 @@ ostream* __thiscall ostrstream_buffer_ctor(ostream *this, char *buffer, int leng
|
|||
DEFINE_THISCALL_WRAPPER(ostrstream_ctor, 8)
|
||||
ostream* __thiscall ostrstream_ctor(ostream *this, BOOL virt_init)
|
||||
{
|
||||
FIXME("(%p %d) stub\n", this, virt_init);
|
||||
return this;
|
||||
strstreambuf *ssb = MSVCRT_operator_new(sizeof(strstreambuf));
|
||||
|
||||
TRACE("(%p %d)\n", this, virt_init);
|
||||
|
||||
if (ssb)
|
||||
strstreambuf_ctor(ssb);
|
||||
return ostrstream_internal_sb_ctor(this, ssb, virt_init);
|
||||
}
|
||||
|
||||
/* ?pcount@ostrstream@@QBEHXZ */
|
||||
|
|
|
@ -329,6 +329,14 @@ static ostream* (*__thiscall p_ostream_withassign_assign_sb)(ostream*, streambuf
|
|||
static ostream* (*__thiscall p_ostream_withassign_assign_os)(ostream*, const ostream*);
|
||||
static ostream* (*__thiscall p_ostream_withassign_assign)(ostream*, const ostream*);
|
||||
|
||||
/* ostrstream */
|
||||
static ostream* (*__thiscall p_ostrstream_copy_ctor)(ostream*, const ostream*, BOOL);
|
||||
static ostream* (*__thiscall p_ostrstream_buffer_ctor)(ostream*, char*, int, int, BOOL);
|
||||
static ostream* (*__thiscall p_ostrstream_ctor)(ostream*, BOOL);
|
||||
static void (*__thiscall p_ostrstream_dtor)(ios*);
|
||||
static void (*__thiscall p_ostrstream_vbase_dtor)(ostream*);
|
||||
static ostream* (*__thiscall p_ostrstream_assign)(ostream*, const ostream*);
|
||||
|
||||
/* istream */
|
||||
static istream* (*__thiscall p_istream_copy_ctor)(istream*, const istream*, BOOL);
|
||||
static istream* (*__thiscall p_istream_ctor)(istream*, BOOL);
|
||||
|
@ -594,6 +602,13 @@ static BOOL init(void)
|
|||
SET(p_ostream_withassign_assign_os, "??4ostream_withassign@@QEAAAEAVostream@@AEBV1@@Z");
|
||||
SET(p_ostream_withassign_assign, "??4ostream_withassign@@QEAAAEAV0@AEBV0@@Z");
|
||||
|
||||
SET(p_ostrstream_copy_ctor, "??0ostrstream@@QEAA@AEBV0@@Z");
|
||||
SET(p_ostrstream_buffer_ctor, "??0ostrstream@@QEAA@PEADHH@Z");
|
||||
SET(p_ostrstream_ctor, "??0ostrstream@@QEAA@XZ");
|
||||
SET(p_ostrstream_dtor, "??1ostrstream@@UEAA@XZ");
|
||||
SET(p_ostrstream_vbase_dtor, "??_Dostrstream@@QEAAXXZ");
|
||||
SET(p_ostrstream_assign, "??4ostrstream@@QEAAAEAV0@AEBV0@@Z");
|
||||
|
||||
SET(p_istream_copy_ctor, "??0istream@@IEAA@AEBV0@@Z");
|
||||
SET(p_istream_ctor, "??0istream@@IEAA@XZ");
|
||||
SET(p_istream_sb_ctor, "??0istream@@QEAA@PEAVstreambuf@@@Z");
|
||||
|
@ -773,6 +788,13 @@ static BOOL init(void)
|
|||
SET(p_ostream_withassign_assign_os, "??4ostream_withassign@@QAEAAVostream@@ABV1@@Z");
|
||||
SET(p_ostream_withassign_assign, "??4ostream_withassign@@QAEAAV0@ABV0@@Z");
|
||||
|
||||
SET(p_ostrstream_copy_ctor, "??0ostrstream@@QAE@ABV0@@Z");
|
||||
SET(p_ostrstream_buffer_ctor, "??0ostrstream@@QAE@PADHH@Z");
|
||||
SET(p_ostrstream_ctor, "??0ostrstream@@QAE@XZ");
|
||||
SET(p_ostrstream_dtor, "??1ostrstream@@UAE@XZ");
|
||||
SET(p_ostrstream_vbase_dtor, "??_Dostrstream@@QAEXXZ");
|
||||
SET(p_ostrstream_assign, "??4ostrstream@@QAEAAV0@ABV0@@Z");
|
||||
|
||||
SET(p_istream_copy_ctor, "??0istream@@IAE@ABV0@@Z");
|
||||
SET(p_istream_ctor, "??0istream@@IAE@XZ");
|
||||
SET(p_istream_sb_ctor, "??0istream@@QAE@PAVstreambuf@@@Z");
|
||||
|
@ -3969,6 +3991,270 @@ static void test_ostream_withassign(void)
|
|||
ok(osa1.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, osa1.base_ios.do_lock);
|
||||
}
|
||||
|
||||
static void test_ostrstream(void)
|
||||
{
|
||||
ostream os1, os2, *pos, *pos2;
|
||||
strstreambuf *pssb;
|
||||
char buffer[32];
|
||||
|
||||
memset(&os1, 0xab, sizeof(ostream));
|
||||
memset(&os2, 0xab, sizeof(ostream));
|
||||
|
||||
/* constructors/destructors */
|
||||
pos = call_func2(p_ostrstream_ctor, &os1, TRUE);
|
||||
pssb = (strstreambuf*) os1.base_ios.sb;
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb != NULL, "expected not %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 1, "expected 1 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == NULL, "expected %p got %p\n", NULL, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0, "expected 0 got %x\n", os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 6, "expected 6 got %d\n", os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == ' ', "expected 32 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0, "expected 0 got %d\n", os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == -1, "expected -1 got %d\n", os1.base_ios.do_lock);
|
||||
ok(pssb->dynamic == 1, "expected 1, got %d\n", pssb->dynamic);
|
||||
ok(pssb->increase == 1, "expected 1, got %d\n", pssb->increase);
|
||||
ok(pssb->constant == 0, "expected 0, got %d\n", pssb->constant);
|
||||
ok(pssb->f_alloc == NULL, "expected %p, got %p\n", NULL, pssb->f_alloc);
|
||||
ok(pssb->f_free == NULL, "expected %p, got %p\n", NULL, pssb->f_free);
|
||||
ok(pssb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pssb->base.allocated);
|
||||
ok(pssb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pssb->base.unbuffered);
|
||||
ok(pssb->base.base == NULL, "wrong buffer, expected %p got %p\n", NULL, pssb->base.base);
|
||||
ok(pssb->base.ebuf == NULL, "wrong buffer end, expected %p got %p\n", NULL, pssb->base.ebuf);
|
||||
ok(pssb->base.do_lock == -1, "expected -1 got %d\n", pssb->base.do_lock);
|
||||
call_func1(p_ostrstream_vbase_dtor, &os1);
|
||||
ok(os1.base_ios.sb == NULL, "expected %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os1.base_ios.state);
|
||||
os1.unknown = 0xabababab;
|
||||
memset(&os1.base_ios, 0xab, sizeof(ios));
|
||||
os1.base_ios.delbuf = 0;
|
||||
pos = call_func2(p_ostrstream_ctor, &os1, FALSE);
|
||||
pssb = (strstreambuf*) os1.base_ios.sb;
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb != NULL, "expected not %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 1, "expected 1 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == os2.base_ios.tie, "expected %p got %p\n", os2.base_ios.tie, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0xabababab, "expected %x got %x\n", 0xabababab, os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == (char) 0xab, "expected -85 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.do_lock);
|
||||
ok(pssb->dynamic == 1, "expected 1, got %d\n", pssb->dynamic);
|
||||
ok(pssb->increase == 1, "expected 1, got %d\n", pssb->increase);
|
||||
ok(pssb->constant == 0, "expected 0, got %d\n", pssb->constant);
|
||||
ok(pssb->f_alloc == NULL, "expected %p, got %p\n", NULL, pssb->f_alloc);
|
||||
ok(pssb->f_free == NULL, "expected %p, got %p\n", NULL, pssb->f_free);
|
||||
ok(pssb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pssb->base.allocated);
|
||||
ok(pssb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pssb->base.unbuffered);
|
||||
ok(pssb->base.base == NULL, "wrong buffer, expected %p got %p\n", NULL, pssb->base.base);
|
||||
ok(pssb->base.ebuf == NULL, "wrong buffer end, expected %p got %p\n", NULL, pssb->base.ebuf);
|
||||
ok(pssb->base.do_lock == -1, "expected -1 got %d\n", pssb->base.do_lock);
|
||||
call_func1(p_ostrstream_dtor, &os1.base_ios);
|
||||
ok(os1.base_ios.sb == &pssb->base, "expected %p got %p\n", &pssb->base, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.state);
|
||||
call_func1(p_strstreambuf_dtor, pssb);
|
||||
p_operator_delete(pssb);
|
||||
|
||||
memset(&os1, 0xab, sizeof(ostream));
|
||||
pos = call_func5(p_ostrstream_buffer_ctor, &os1, buffer, 32, OPENMODE_in|OPENMODE_out, TRUE);
|
||||
pssb = (strstreambuf*) os1.base_ios.sb;
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb != NULL, "expected not %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 1, "expected 1 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == NULL, "expected %p got %p\n", NULL, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0, "expected 0 got %x\n", os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 6, "expected 6 got %d\n", os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == ' ', "expected 32 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0, "expected 0 got %d\n", os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == -1, "expected -1 got %d\n", os1.base_ios.do_lock);
|
||||
ok(pssb->dynamic == 0, "expected 0, got %d\n", pssb->dynamic);
|
||||
ok(pssb->constant == 1, "expected 1, got %d\n", pssb->constant);
|
||||
ok(pssb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pssb->base.allocated);
|
||||
ok(pssb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pssb->base.unbuffered);
|
||||
ok(pssb->base.base == buffer, "wrong buffer, expected %p got %p\n", buffer, pssb->base.base);
|
||||
ok(pssb->base.ebuf == buffer + 32, "wrong buffer end, expected %p got %p\n", buffer + 32, pssb->base.ebuf);
|
||||
ok(pssb->base.eback == buffer, "wrong get base, expected %p got %p\n", buffer, pssb->base.eback);
|
||||
ok(pssb->base.gptr == buffer, "wrong get pointer, expected %p got %p\n", buffer, pssb->base.gptr);
|
||||
ok(pssb->base.egptr == buffer, "wrong get end, expected %p got %p\n", buffer, pssb->base.egptr);
|
||||
ok(pssb->base.pbase == buffer, "wrong put base, expected %p got %p\n", buffer, pssb->base.pbase);
|
||||
ok(pssb->base.pptr == buffer, "wrong put pointer, expected %p got %p\n", buffer, pssb->base.pptr);
|
||||
ok(pssb->base.epptr == buffer + 32, "wrong put end, expected %p got %p\n", buffer + 32, pssb->base.epptr);
|
||||
ok(pssb->base.do_lock == -1, "expected -1 got %d\n", pssb->base.do_lock);
|
||||
call_func1(p_ostrstream_vbase_dtor, &os1);
|
||||
ok(os1.base_ios.sb == NULL, "expected %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os1.base_ios.state);
|
||||
strcpy(buffer, "Test");
|
||||
memset(&os1, 0xab, sizeof(ostream));
|
||||
pos = call_func5(p_ostrstream_buffer_ctor, &os1, buffer, 16, OPENMODE_ate, TRUE);
|
||||
pssb = (strstreambuf*) os1.base_ios.sb;
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb != NULL, "expected not %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 1, "expected 1 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == NULL, "expected %p got %p\n", NULL, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0, "expected 0 got %x\n", os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 6, "expected 6 got %d\n", os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == ' ', "expected 32 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0, "expected 0 got %d\n", os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == -1, "expected -1 got %d\n", os1.base_ios.do_lock);
|
||||
ok(pssb->dynamic == 0, "expected 0, got %d\n", pssb->dynamic);
|
||||
ok(pssb->constant == 1, "expected 1, got %d\n", pssb->constant);
|
||||
ok(pssb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pssb->base.allocated);
|
||||
ok(pssb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pssb->base.unbuffered);
|
||||
ok(pssb->base.base == buffer, "wrong buffer, expected %p got %p\n", buffer, pssb->base.base);
|
||||
ok(pssb->base.ebuf == buffer + 16, "wrong buffer end, expected %p got %p\n", buffer + 16, pssb->base.ebuf);
|
||||
ok(pssb->base.eback == buffer, "wrong get base, expected %p got %p\n", buffer, pssb->base.eback);
|
||||
ok(pssb->base.gptr == buffer, "wrong get pointer, expected %p got %p\n", buffer, pssb->base.gptr);
|
||||
ok(pssb->base.egptr == buffer, "wrong get end, expected %p got %p\n", buffer, pssb->base.egptr);
|
||||
ok(pssb->base.pbase == buffer, "wrong put base, expected %p got %p\n", buffer, pssb->base.pbase);
|
||||
ok(pssb->base.pptr == buffer + 4, "wrong put pointer, expected %p got %p\n", buffer + 4, pssb->base.pptr);
|
||||
ok(pssb->base.epptr == buffer + 16, "wrong put end, expected %p got %p\n", buffer + 16, pssb->base.epptr);
|
||||
ok(pssb->base.do_lock == -1, "expected -1 got %d\n", pssb->base.do_lock);
|
||||
call_func1(p_ostrstream_vbase_dtor, &os1);
|
||||
ok(os1.base_ios.sb == NULL, "expected %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os1.base_ios.state);
|
||||
os1.unknown = 0xabababab;
|
||||
memset(&os1.base_ios, 0xab, sizeof(ios));
|
||||
os1.base_ios.delbuf = 0;
|
||||
pos = call_func5(p_ostrstream_buffer_ctor, &os1, buffer, -1, OPENMODE_app, FALSE);
|
||||
pssb = (strstreambuf*) os1.base_ios.sb;
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb != NULL, "expected not %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 1, "expected 1 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == os2.base_ios.tie, "expected %p got %p\n", os2.base_ios.tie, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0xabababab, "expected %x got %x\n", 0xabababab, os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == (char) 0xab, "expected -85 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.do_lock);
|
||||
ok(pssb->dynamic == 0, "expected 0, got %d\n", pssb->dynamic);
|
||||
ok(pssb->constant == 1, "expected 1, got %d\n", pssb->constant);
|
||||
ok(pssb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pssb->base.allocated);
|
||||
ok(pssb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pssb->base.unbuffered);
|
||||
ok(pssb->base.base == buffer, "wrong buffer, expected %p got %p\n", buffer, pssb->base.base);
|
||||
ok(pssb->base.ebuf == buffer + 0x7fffffff || pssb->base.ebuf == (char*) -1,
|
||||
"wrong buffer end, expected %p + 0x7fffffff or -1, got %p\n", buffer, pssb->base.ebuf);
|
||||
ok(pssb->base.eback == buffer, "wrong get base, expected %p got %p\n", buffer, pssb->base.eback);
|
||||
ok(pssb->base.gptr == buffer, "wrong get pointer, expected %p got %p\n", buffer, pssb->base.gptr);
|
||||
ok(pssb->base.egptr == buffer, "wrong get end, expected %p got %p\n", buffer, pssb->base.egptr);
|
||||
ok(pssb->base.pbase == buffer, "wrong put base, expected %p got %p\n", buffer, pssb->base.pbase);
|
||||
ok(pssb->base.pptr == buffer + 4, "wrong put pointer, expected %p got %p\n", buffer + 4, pssb->base.pptr);
|
||||
ok(pssb->base.epptr == buffer + 0x7fffffff || pssb->base.epptr == (char*) -1,
|
||||
"wrong buffer end, expected %p + 0x7fffffff or -1, got %p\n", buffer, pssb->base.epptr);
|
||||
ok(pssb->base.do_lock == -1, "expected -1 got %d\n", pssb->base.do_lock);
|
||||
call_func1(p_ostrstream_dtor, &os1.base_ios);
|
||||
ok(os1.base_ios.sb == &pssb->base, "expected %p got %p\n", &pssb->base, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == 0xabababab, "expected %d got %d\n", 0xabababab, os1.base_ios.state);
|
||||
call_func1(p_strstreambuf_dtor, pssb);
|
||||
p_operator_delete(pssb);
|
||||
memset(&os1, 0xab, sizeof(ostream));
|
||||
pos = call_func5(p_ostrstream_buffer_ctor, &os1, buffer, 0, OPENMODE_trunc, TRUE);
|
||||
pssb = (strstreambuf*) os1.base_ios.sb;
|
||||
ok(pos == &os1, "wrong return, expected %p got %p\n", &os1, pos);
|
||||
ok(os1.unknown == 0, "expected 0 got %d\n", os1.unknown);
|
||||
ok(os1.base_ios.sb != NULL, "expected not %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, os1.base_ios.state);
|
||||
ok(os1.base_ios.delbuf == 1, "expected 1 got %d\n", os1.base_ios.delbuf);
|
||||
ok(os1.base_ios.tie == NULL, "expected %p got %p\n", NULL, os1.base_ios.tie);
|
||||
ok(os1.base_ios.flags == 0, "expected 0 got %x\n", os1.base_ios.flags);
|
||||
ok(os1.base_ios.precision == 6, "expected 6 got %d\n", os1.base_ios.precision);
|
||||
ok(os1.base_ios.fill == ' ', "expected 32 got %d\n", os1.base_ios.fill);
|
||||
ok(os1.base_ios.width == 0, "expected 0 got %d\n", os1.base_ios.width);
|
||||
ok(os1.base_ios.do_lock == -1, "expected -1 got %d\n", os1.base_ios.do_lock);
|
||||
ok(pssb->dynamic == 0, "expected 0, got %d\n", pssb->dynamic);
|
||||
ok(pssb->constant == 1, "expected 1, got %d\n", pssb->constant);
|
||||
ok(pssb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pssb->base.allocated);
|
||||
ok(pssb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pssb->base.unbuffered);
|
||||
ok(pssb->base.base == buffer, "wrong buffer, expected %p got %p\n", buffer, pssb->base.base);
|
||||
ok(pssb->base.ebuf == buffer + 4, "wrong buffer end, expected %p got %p\n", buffer + 4, pssb->base.ebuf);
|
||||
ok(pssb->base.eback == buffer, "wrong get base, expected %p got %p\n", buffer, pssb->base.eback);
|
||||
ok(pssb->base.gptr == buffer, "wrong get pointer, expected %p got %p\n", buffer, pssb->base.gptr);
|
||||
ok(pssb->base.egptr == buffer, "wrong get end, expected %p got %p\n", buffer, pssb->base.egptr);
|
||||
ok(pssb->base.pbase == buffer, "wrong put base, expected %p got %p\n", buffer, pssb->base.pbase);
|
||||
ok(pssb->base.pptr == buffer, "wrong put pointer, expected %p got %p\n", buffer, pssb->base.pptr);
|
||||
ok(pssb->base.epptr == buffer + 4, "wrong put end, expected %p got %p\n", buffer + 4, pssb->base.epptr);
|
||||
ok(pssb->base.do_lock == -1, "expected -1 got %d\n", pssb->base.do_lock);
|
||||
call_func1(p_ostrstream_vbase_dtor, &os1);
|
||||
ok(os1.base_ios.sb == NULL, "expected %p got %p\n", NULL, os1.base_ios.sb);
|
||||
ok(os1.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os1.base_ios.state);
|
||||
|
||||
os1.unknown = 0xcdcdcdcd;
|
||||
memset(&os1.base_ios, 0xcd, sizeof(ios));
|
||||
pos = call_func3(p_ostrstream_copy_ctor, &os2, &os1, TRUE);
|
||||
ok(pos == &os2, "wrong return, expected %p got %p\n", &os2, pos);
|
||||
ok(os2.unknown == 0, "expected 0 got %d\n", os2.unknown);
|
||||
ok(os2.base_ios.sb == os1.base_ios.sb, "expected %p got %p\n", os1.base_ios.sb, os2.base_ios.sb);
|
||||
ok(os2.base_ios.state == 0xcdcdcdc9, "expected %d got %d\n", 0xcdcdcdc9, os2.base_ios.state);
|
||||
ok(os2.base_ios.delbuf == 0, "expected 0 got %d\n", os2.base_ios.delbuf);
|
||||
ok(os2.base_ios.tie == os1.base_ios.tie, "expected %p got %p\n", os1.base_ios.tie, os2.base_ios.tie);
|
||||
ok(os2.base_ios.flags == 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, os2.base_ios.flags);
|
||||
ok(os2.base_ios.precision == (char) 0xcd, "expected -51 got %d\n", os2.base_ios.precision);
|
||||
ok(os2.base_ios.fill == (char) 0xcd, "expected -51 got %d\n", os2.base_ios.fill);
|
||||
ok(os2.base_ios.width == (char) 0xcd, "expected -51 got %d\n", os2.base_ios.width);
|
||||
ok(os2.base_ios.do_lock == -1, "expected -1 got %d\n", os2.base_ios.do_lock);
|
||||
call_func1(p_ostrstream_vbase_dtor, &os2);
|
||||
ok(os2.base_ios.sb == NULL, "expected %p got %p\n", NULL, os2.base_ios.sb);
|
||||
ok(os2.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os2.base_ios.state);
|
||||
os2.unknown = 0xabababab;
|
||||
memset(&os2.base_ios, 0xab, sizeof(ios));
|
||||
os2.base_ios.delbuf = 0;
|
||||
pos2 = os2.base_ios.tie;
|
||||
pos = call_func3(p_ostrstream_copy_ctor, &os2, &os1, FALSE);
|
||||
ok(pos == &os2, "wrong return, expected %p got %p\n", &os2, pos);
|
||||
ok(os2.unknown == 0, "expected 0 got %d\n", os2.unknown);
|
||||
ok(os2.base_ios.sb == os1.base_ios.sb, "expected %p got %p\n", os1.base_ios.sb, os2.base_ios.sb);
|
||||
ok(os2.base_ios.state == 0xabababab, "expected %d got %d\n", 0xabababab, os2.base_ios.state);
|
||||
ok(os2.base_ios.delbuf == 0, "expected 0 got %d\n", os2.base_ios.delbuf);
|
||||
ok(os2.base_ios.tie == pos2, "expected %p got %p\n", pos2, os2.base_ios.tie);
|
||||
ok(os2.base_ios.flags == 0xabababab, "expected %x got %x\n", 0xabababab, os2.base_ios.flags);
|
||||
ok(os2.base_ios.precision == 0xabababab, "expected %d got %d\n", 0xabababab, os2.base_ios.precision);
|
||||
ok(os2.base_ios.fill == (char) 0xab, "expected -85 got %d\n", os2.base_ios.fill);
|
||||
ok(os2.base_ios.width == 0xabababab, "expected %d got %d\n", 0xabababab, os2.base_ios.width);
|
||||
ok(os2.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, os2.base_ios.do_lock);
|
||||
call_func1(p_ostrstream_dtor, &os2.base_ios);
|
||||
os1.base_ios.sb = NULL;
|
||||
memset(&os2, 0xab, sizeof(ostream));
|
||||
pos = call_func3(p_ostrstream_copy_ctor, &os2, &os1, TRUE);
|
||||
ok(pos == &os2, "wrong return, expected %p got %p\n", &os2, pos);
|
||||
ok(os2.unknown == 0, "expected 0 got %d\n", os2.unknown);
|
||||
ok(os2.base_ios.sb == NULL, "expected %p got %p\n", NULL, os2.base_ios.sb);
|
||||
ok(os2.base_ios.state == 0xcdcdcdcd, "expected %d got %d\n", 0xcdcdcdcd, os2.base_ios.state);
|
||||
ok(os2.base_ios.delbuf == 0, "expected 0 got %d\n", os2.base_ios.delbuf);
|
||||
ok(os2.base_ios.tie == os1.base_ios.tie, "expected %p got %p\n", os1.base_ios.tie, os2.base_ios.tie);
|
||||
ok(os2.base_ios.flags == 0xcdcdcdcd, "expected %x got %x\n", 0xcdcdcdcd, os2.base_ios.flags);
|
||||
ok(os2.base_ios.precision == (char) 0xcd, "expected -51 got %d\n", os2.base_ios.precision);
|
||||
ok(os2.base_ios.fill == (char) 0xcd, "expected -51 got %d\n", os2.base_ios.fill);
|
||||
ok(os2.base_ios.width == (char) 0xcd, "expected -51 got %d\n", os2.base_ios.width);
|
||||
ok(os2.base_ios.do_lock == -1, "expected -1 got %d\n", os2.base_ios.do_lock);
|
||||
call_func1(p_ostrstream_vbase_dtor, &os2);
|
||||
|
||||
/* assignment */
|
||||
os2.unknown = 0xabababab;
|
||||
memset(&os2.base_ios, 0xab, sizeof(ios));
|
||||
os2.base_ios.delbuf = 0;
|
||||
pos = call_func2(p_ostrstream_assign, &os2, &os1);
|
||||
ok(pos == &os2, "wrong return, expected %p got %p\n", &os2, pos);
|
||||
ok(os2.unknown == 0xabababab, "expected %d got %d\n", 0xabababab, os2.unknown);
|
||||
ok(os2.base_ios.sb == NULL, "expected %p got %p\n", NULL, os2.base_ios.sb);
|
||||
ok(os2.base_ios.state == IOSTATE_badbit, "expected %d got %d\n", IOSTATE_badbit, os2.base_ios.state);
|
||||
ok(os2.base_ios.delbuf == 0, "expected 0 got %d\n", os2.base_ios.delbuf);
|
||||
ok(os2.base_ios.tie == NULL, "expected %p got %p\n", NULL, os2.base_ios.tie);
|
||||
ok(os2.base_ios.flags == 0, "expected %x got %x\n", 0, os2.base_ios.flags);
|
||||
ok(os2.base_ios.precision == 6, "expected 6 got %d\n", os2.base_ios.precision);
|
||||
ok(os2.base_ios.fill == ' ', "expected 32 got %d\n", os2.base_ios.fill);
|
||||
ok(os2.base_ios.width == 0, "expected 0 got %d\n", os2.base_ios.width);
|
||||
ok(os2.base_ios.do_lock == 0xabababab, "expected %d got %d\n", 0xabababab, os2.base_ios.do_lock);
|
||||
}
|
||||
|
||||
static void test_istream(void)
|
||||
{
|
||||
istream is1, is2, *pis;
|
||||
|
@ -6375,6 +6661,7 @@ START_TEST(msvcirt)
|
|||
test_ostream();
|
||||
test_ostream_print();
|
||||
test_ostream_withassign();
|
||||
test_ostrstream();
|
||||
test_istream();
|
||||
test_istream_getint();
|
||||
test_istream_getdouble();
|
||||
|
|
Loading…
Reference in New Issue