[PATCH v6 1/2] jscript: implement Enumerator()

Dmitry Timoshkov dmitry at baikal.ru
Thu May 16 01:52:25 CDT 2019


Andreas Maier <staubim at quantentunnel.de> wrote:

> +static inline HRESULT enumvar_get_next_item(EnumeratorInstance *This)
> +{
> +    HRESULT hres;
> +    VARIANT nextitem;
> +
> +    if (This->atend)
> +    {
> +        This->item = jsval_undefined();
> +        return S_OK;
> +    }
> +
> +    /* dont leak pervious value */
> +    jsval_release(This->item);
> +
> +    /* not at end ... get next item */
> +    VariantInit(&nextitem);
> +    hres = IEnumVARIANT_Next(This->enumvar, 1, &nextitem, NULL);
> +    if (hres == S_OK)
> +    {
> +        hres = variant_to_jsval(&nextitem, &This->item);
> +        if (FAILED(hres))
> +        {
> +            ERR("failed to convert jsval to variant!");
> +            This->item = jsval_undefined();
> +        }
> +    }
> +    else
> +    {
> +        This->item = jsval_undefined();
> +        This->atend = TRUE;
> +    }
> +    VariantClear(&nextitem);
> +
> +    return S_OK;
> +}

It should be possible to get rid of the 'atend' variable.

>      default:
> -        FIXME("unimplemented flags: %x\n", flags);
> +        ERR("unimplemented flags: %x\n", flags);

It still should be FIXME. Also all the remaining ERR()s should be changed
either to a WARN() or a FIXME().

-- 
Dmitry.



More information about the wine-devel mailing list