[02/10] msvcirt: Implement ostream constructors/destructors

Piotr Caban piotr.caban at gmail.com
Mon Jun 6 08:13:42 CDT 2016


On 06/06/16 13:52, Iván Matellanes wrote:
>  DEFINE_THISCALL_WRAPPER(ostream_copy_ctor, 12)
>  ostream* __thiscall ostream_copy_ctor(ostream *this, const ostream *copy, BOOL virt_init)
>  {
> -    FIXME("(%p %p %d) stub\n", this, copy, virt_init);
> +    ios *base, *copy_base;
> +
> +    TRACE("(%p %p %d)\n", this, copy, virt_init);
> +
> +    if (virt_init)
> +        this->vbtable = ostream_vbtable;
> +    base = ostream_get_ios(this);
> +    copy_base = ostream_get_ios(copy);
> +    ios_sb_ctor(base, copy_base->sb);
> +    base->vtable = &MSVCP_ostream_vtable;
This is wrong if virt_init == FALSE. There should be something like:
copy_base = ostream_get_ios(copy);
if (virt_init) {
     this->vbtable = ostream_vbtable;
     base = ostream_get_ios(thjs);
     ios_sb_ctor(base, copy_base->sb);
} else {
     base = ostream_get_ios(this);
     ios_init(base, copy_base->sb);
}

Keep in mind that this code was not tested. Please also add a test for 
ostream_copy_ctor(..., FALSE) call.

Thanks,
Piotr



More information about the wine-devel mailing list