d3dx9: Get rid of the ID3DXFileEnumObjectImpl typedef.
This commit is contained in:
parent
177aa5c26f
commit
38871d842f
|
@ -53,12 +53,13 @@ struct d3dx9_file
|
|||
IDirectXFile *dxfile;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct d3dx9_file_enum_object
|
||||
{
|
||||
ID3DXFileEnumObject ID3DXFileEnumObject_iface;
|
||||
LONG ref;
|
||||
ULONG nb_children;
|
||||
ID3DXFileData **children;
|
||||
} ID3DXFileEnumObjectImpl;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
ID3DXFileData ID3DXFileData_iface;
|
||||
|
@ -75,9 +76,9 @@ static inline struct d3dx9_file *impl_from_ID3DXFile(ID3DXFile *iface)
|
|||
return CONTAINING_RECORD(iface, struct d3dx9_file, ID3DXFile_iface);
|
||||
}
|
||||
|
||||
static inline ID3DXFileEnumObjectImpl* impl_from_ID3DXFileEnumObject(ID3DXFileEnumObject *iface)
|
||||
static inline struct d3dx9_file_enum_object *impl_from_ID3DXFileEnumObject(ID3DXFileEnumObject *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, ID3DXFileEnumObjectImpl, ID3DXFileEnumObject_iface);
|
||||
return CONTAINING_RECORD(iface, struct d3dx9_file_enum_object, ID3DXFileEnumObject_iface);
|
||||
}
|
||||
|
||||
static inline ID3DXFileDataImpl* impl_from_ID3DXFileData(ID3DXFileData *iface)
|
||||
|
@ -374,124 +375,119 @@ static HRESULT ID3DXFileDataImpl_Create(IDirectXFileObject *dxfile_object, ID3DX
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
/*** IUnknown methods ***/
|
||||
|
||||
static HRESULT WINAPI ID3DXFileEnumObjectImpl_QueryInterface(ID3DXFileEnumObject *iface, REFIID riid, void **ret_iface)
|
||||
static HRESULT WINAPI d3dx9_file_enum_object_QueryInterface(ID3DXFileEnumObject *iface, REFIID riid, void **out)
|
||||
{
|
||||
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
|
||||
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_ID3DXFileEnumObject))
|
||||
if (IsEqualGUID(riid, &IID_ID3DXFileEnumObject)
|
||||
|| IsEqualGUID(riid, &IID_IUnknown))
|
||||
{
|
||||
iface->lpVtbl->AddRef(iface);
|
||||
*ret_iface = iface;
|
||||
*out = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("(%p)->(%s, %p), not found\n", iface, debugstr_guid(riid), ret_iface);
|
||||
*ret_iface = NULL;
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
||||
|
||||
*out = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ID3DXFileEnumObjectImpl_AddRef(ID3DXFileEnumObject *iface)
|
||||
static ULONG WINAPI d3dx9_file_enum_object_AddRef(ID3DXFileEnumObject *iface)
|
||||
{
|
||||
ID3DXFileEnumObjectImpl *This = impl_from_ID3DXFileEnumObject(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface);
|
||||
ULONG refcount = InterlockedIncrement(&file_enum->ref);
|
||||
|
||||
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
||||
TRACE("%p increasing refcount to %u.\n", file_enum, refcount);
|
||||
|
||||
return ref;
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ID3DXFileEnumObjectImpl_Release(ID3DXFileEnumObject *iface)
|
||||
static ULONG WINAPI d3dx9_file_enum_object_Release(ID3DXFileEnumObject *iface)
|
||||
{
|
||||
ID3DXFileEnumObjectImpl *This = impl_from_ID3DXFileEnumObject(iface);
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface);
|
||||
ULONG refcount = InterlockedDecrement(&file_enum->ref);
|
||||
|
||||
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
||||
TRACE("%p decreasing refcount to %u.\n", file_enum, refcount);
|
||||
|
||||
if (!ref)
|
||||
if (!refcount)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
for (i = 0; i < This->nb_children; i++)
|
||||
(This->children[i])->lpVtbl->Release(This->children[i]);
|
||||
HeapFree(GetProcessHeap(), 0, This->children);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
for (i = 0; i < file_enum->nb_children; ++i)
|
||||
{
|
||||
ID3DXFileData *child = file_enum->children[i];
|
||||
child->lpVtbl->Release(child);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, file_enum->children);
|
||||
HeapFree(GetProcessHeap(), 0, file_enum);
|
||||
}
|
||||
|
||||
return ref;
|
||||
return refcount;
|
||||
}
|
||||
|
||||
|
||||
/*** ID3DXFileEnumObject methods ***/
|
||||
|
||||
static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetFile(ID3DXFileEnumObject *iface, ID3DXFile **file)
|
||||
static HRESULT WINAPI d3dx9_file_enum_object_GetFile(ID3DXFileEnumObject *iface, ID3DXFile **file)
|
||||
{
|
||||
FIXME("(%p)->(%p): stub\n", iface, file);
|
||||
FIXME("iface %p, file %p stub!\n", iface, file);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetChildren(ID3DXFileEnumObject *iface, SIZE_T *children)
|
||||
static HRESULT WINAPI d3dx9_file_enum_object_GetChildren(ID3DXFileEnumObject *iface, SIZE_T *children)
|
||||
{
|
||||
ID3DXFileEnumObjectImpl *This = impl_from_ID3DXFileEnumObject(iface);
|
||||
struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n", iface, children);
|
||||
TRACE("iface %p, children %p.\n", iface, children);
|
||||
|
||||
if (!children)
|
||||
return E_POINTER;
|
||||
|
||||
*children = This->nb_children;
|
||||
*children = file_enum->nb_children;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetChild(ID3DXFileEnumObject *iface, SIZE_T id, ID3DXFileData **object)
|
||||
static HRESULT WINAPI d3dx9_file_enum_object_GetChild(ID3DXFileEnumObject *iface, SIZE_T id, ID3DXFileData **object)
|
||||
{
|
||||
ID3DXFileEnumObjectImpl *This = impl_from_ID3DXFileEnumObject(iface);
|
||||
struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface);
|
||||
|
||||
TRACE("(%p)->(%lu, %p)\n", iface, id, object);
|
||||
TRACE("iface %p, id %#lx, object %p.\n", iface, id, object);
|
||||
|
||||
if (!object)
|
||||
return E_POINTER;
|
||||
|
||||
*object = This->children[id];
|
||||
*object = file_enum->children[id];
|
||||
(*object)->lpVtbl->AddRef(*object);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetDataObjectById(ID3DXFileEnumObject *iface, REFGUID guid, ID3DXFileData **object)
|
||||
static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectById(ID3DXFileEnumObject *iface,
|
||||
REFGUID guid, ID3DXFileData **object)
|
||||
{
|
||||
FIXME("(%p)->(%s, %p): stub\n", iface, debugstr_guid(guid), object);
|
||||
FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI ID3DXFileEnumObjectImpl_GetDataObjectByName(ID3DXFileEnumObject *iface, const char *name, ID3DXFileData **object)
|
||||
static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectByName(ID3DXFileEnumObject *iface,
|
||||
const char *name, ID3DXFileData **object)
|
||||
{
|
||||
FIXME("(%p)->(%s, %p): stub\n", iface, debugstr_a(name), object);
|
||||
FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
static const ID3DXFileEnumObjectVtbl ID3DXFileEnumObject_Vtbl =
|
||||
static const ID3DXFileEnumObjectVtbl d3dx9_file_enum_object_vtbl =
|
||||
{
|
||||
ID3DXFileEnumObjectImpl_QueryInterface,
|
||||
ID3DXFileEnumObjectImpl_AddRef,
|
||||
ID3DXFileEnumObjectImpl_Release,
|
||||
ID3DXFileEnumObjectImpl_GetFile,
|
||||
ID3DXFileEnumObjectImpl_GetChildren,
|
||||
ID3DXFileEnumObjectImpl_GetChild,
|
||||
ID3DXFileEnumObjectImpl_GetDataObjectById,
|
||||
ID3DXFileEnumObjectImpl_GetDataObjectByName
|
||||
d3dx9_file_enum_object_QueryInterface,
|
||||
d3dx9_file_enum_object_AddRef,
|
||||
d3dx9_file_enum_object_Release,
|
||||
d3dx9_file_enum_object_GetFile,
|
||||
d3dx9_file_enum_object_GetChildren,
|
||||
d3dx9_file_enum_object_GetChild,
|
||||
d3dx9_file_enum_object_GetDataObjectById,
|
||||
d3dx9_file_enum_object_GetDataObjectByName,
|
||||
};
|
||||
|
||||
static HRESULT WINAPI d3dx9_file_QueryInterface(ID3DXFile *iface, REFIID riid, void **out)
|
||||
|
@ -542,7 +538,7 @@ static HRESULT WINAPI d3dx9_file_CreateEnumObject(ID3DXFile *iface, const void *
|
|||
D3DXF_FILELOADOPTIONS options, ID3DXFileEnumObject **enum_object)
|
||||
{
|
||||
struct d3dx9_file *file = impl_from_ID3DXFile(iface);
|
||||
ID3DXFileEnumObjectImpl *object;
|
||||
struct d3dx9_file_enum_object *object;
|
||||
IDirectXFileEnumObject *dxfile_enum_object;
|
||||
void *dxfile_source;
|
||||
DXFILELOADOPTIONS dxfile_options;
|
||||
|
@ -592,7 +588,7 @@ static HRESULT WINAPI d3dx9_file_CreateEnumObject(ID3DXFile *iface, const void *
|
|||
if (!object)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
object->ID3DXFileEnumObject_iface.lpVtbl = &ID3DXFileEnumObject_Vtbl;
|
||||
object->ID3DXFileEnumObject_iface.lpVtbl = &d3dx9_file_enum_object_vtbl;
|
||||
object->ref = 1;
|
||||
|
||||
ret = IDirectXFile_CreateEnumObject(file->dxfile, dxfile_source, dxfile_options, &dxfile_enum_object);
|
||||
|
|
Loading…
Reference in New Issue