[PATCH 1/5] d3dx9_36: Implement D3DXFileCreate. (try 3)

Christian Costa titan.costa at gmail.com
Wed Oct 24 04:45:54 CDT 2012


2012/10/24 Dmitry Timoshkov <dmitry at baikal.ru>

> Christian Costa <titan.costa at gmail.com> wrote:
>
> > +static HRESULT WINAPI ID3DXFileImpl_QueryInterface(ID3DXFile *iface,
> REFIID riid, void **ret_iface)
> > +{
> > +    TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
> > +
> > +    if (IsEqualGUID(riid, &IID_IUnknown) ||
> > +        IsEqualGUID(riid, &IID_ID3DXFile))
> > +    {
> > +        iface->lpVtbl->AddRef(iface);
>
> Isn't there an appropriate xxx_AddRef() macro?
>

No.


>
> > +        *ret_iface = iface;
> > +        return S_OK;
> > +    }
> > +
> > +    ERR("(%p)->(%s, %p), not found\n", iface, debugstr_guid(riid),
> ret_iface);
>
> FIXME seems more appropriate here.
>

No. All interfaces are implemented here.


>
> > +    *ret_iface = NULL;
> > +    return E_NOINTERFACE;
> > +}
>
> ...
>
> > +HRESULT WINAPI D3DXFileCreate(ID3DXFile **dxfile)
> > +{
> > +    ID3DXFileImpl *object;
> > +
> > +    TRACE("(%p)\n", dxfile);
> > +
> > +    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
> sizeof(*object));
>
> What's the reason for HEAP_ZERO_MEMORY here?
>

It's common to do it this way. Only non zero value are set on creation.
Usually several members are set in methods.


>
> > +    if (!object)
> > +    {
> > +        ERR("Out of memory\n");
> > +        return E_OUTOFMEMORY;
> > +    }
>
> The ERR() is useless here, just return E_OUTOFMEMORY in such situations.
>
>
>
It's done this way in many places in wine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20121024/8018cb57/attachment-0001.html>


More information about the wine-devel mailing list