[PATCH 4/4] vbscript: Implemented Abs(try 4)

Piotr Caban piotr.caban at gmail.com
Fri Jun 27 04:45:13 CDT 2014


On 06/27/14 04:44, Shuai Meng wrote:
>   static HRESULT Global_Abs(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
>   {
> -    FIXME("\n");
> -    return E_NOTIMPL;
> +    double v;
> +    HRESULT hres;
> +
> +    TRACE("(%s)\n", debugstr_variant(arg));
> +
> +    assert(args_cnt == 1);
> +
> +
> +    if(V_VT(arg) == VT_NULL)
> +        return return_null(res);
> +
> +    hres = to_double(arg, &v);
> +    if (FAILED(hres))
> +        return hres;
> +
> +    if(res) {
> +        V_VT(res) = VT_R8;
> +        V_R8(res) = v >= 0 ? v : -v;
> +    }
> +    return S_OK;
>   }
You can use return_double helper here. Also there are 2 newlines after 
assert.



More information about the wine-devel mailing list