[PATCH 5/5] winegstreamer: Use wg_sample to provide data in wg_parser_reply_read.

Zebediah Figura zfigura at codeweavers.com
Wed Jun 15 19:24:58 CDT 2022


On 6/14/22 02:27, Rémi Bernon wrote:
> diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c
> index ae8a2d4d0c7..eb46982fabf 100644
> --- a/dlls/winegstreamer/wg_sample.c
> +++ b/dlls/winegstreamer/wg_sample.c
> @@ -47,6 +47,11 @@ struct sample
>   
>       union
>       {
> +        struct
> +        {
> +            void *__pad[3];
> +            BYTE buffer[];
> +        } raw;
>           struct
>           {
>               IMFSample *sample;

Why the padding?

> +HRESULT wg_sample_create_raw(UINT32 size, struct wg_sample **out)
> +{
> +    struct sample *sample;
> +
> +    if (!(sample = calloc(1, offsetof(struct sample, u.raw.buffer[size]))))
> +        return E_OUTOFMEMORY;
> +
> +    sample->wg_sample.data = sample->u.raw.buffer;
> +    sample->wg_sample.size = 0;
> +    sample->wg_sample.max_size = size;
> +    sample->ops = &raw_sample_ops;
> +
> +    TRACE("Created wg_sample %p, size %u.\n", &sample->wg_sample, size);
> +    *out = &sample->wg_sample;
> +    return S_OK;
> +}

It strikes me as unnecessary to return HRESULT from this function, 
especially considering you're not actually using the HRESULT value (only 
testing for failure). It'd be simpler just to return "sample" in that case.



More information about the wine-devel mailing list