From a80749fd57dbe25c64787ba3bcc5811e5c4c1657 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 7 Jan 2011 10:16:38 +0100 Subject: [PATCH] wined3d: Pass an IWineD3DResourceImpl pointer to resource_set_private_data(). --- dlls/wined3d/buffer.c | 2 +- dlls/wined3d/cubetexture.c | 2 +- dlls/wined3d/resource.c | 45 +++++++++++++++++----------------- dlls/wined3d/surface_base.c | 2 +- dlls/wined3d/texture.c | 2 +- dlls/wined3d/volume.c | 2 +- dlls/wined3d/volumetexture.c | 2 +- dlls/wined3d/wined3d_private.h | 2 +- 8 files changed, 29 insertions(+), 30 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 43fe20e2d44..cdcecf3412b 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -764,7 +764,7 @@ static void * STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface) static HRESULT STDMETHODCALLTYPE buffer_SetPrivateData(IWineD3DBuffer *iface, REFGUID guid, const void *data, DWORD data_size, DWORD flags) { - return resource_set_private_data((IWineD3DResource *)iface, guid, data, data_size, flags); + return resource_set_private_data((IWineD3DResourceImpl *)iface, guid, data, data_size, flags); } static HRESULT STDMETHODCALLTYPE buffer_GetPrivateData(IWineD3DBuffer *iface, diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c index 89afcbfd407..c80e5ab4829 100644 --- a/dlls/wined3d/cubetexture.c +++ b/dlls/wined3d/cubetexture.c @@ -215,7 +215,7 @@ static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface) static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface, REFGUID riid, const void *data, DWORD data_size, DWORD flags) { - return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags); + return resource_set_private_data((IWineD3DResourceImpl *)iface, riid, data, data_size, flags); } static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface, diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 173fa585272..c21157270b0 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -147,47 +147,46 @@ static struct private_data *resource_find_private_data(IWineD3DResourceImpl *Thi return NULL; } -HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID refguid, - const void *pData, DWORD SizeOfData, DWORD flags) +HRESULT resource_set_private_data(struct IWineD3DResourceImpl *resource, REFGUID guid, + const void *data, DWORD data_size, DWORD flags) { - IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; - struct private_data *data; + struct private_data *d; - TRACE("iface %p, riid %s, data %p, data_size %u, flags %#x.\n", - iface, debugstr_guid(refguid), pData, SizeOfData, flags); + TRACE("resource %p, riid %s, data %p, data_size %u, flags %#x.\n", + resource, debugstr_guid(guid), data, data_size, flags); - resource_free_private_data(This, refguid); + resource_free_private_data(resource, guid); - data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data)); - if (!data) return E_OUTOFMEMORY; + d = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d)); + if (!d) return E_OUTOFMEMORY; - data->tag = *refguid; - data->flags = flags; + d->tag = *guid; + d->flags = flags; if (flags & WINED3DSPD_IUNKNOWN) { - if (SizeOfData != sizeof(IUnknown *)) + if (data_size != sizeof(IUnknown *)) { - WARN("IUnknown data with size %d, returning WINED3DERR_INVALIDCALL\n", SizeOfData); - HeapFree(GetProcessHeap(), 0, data); + WARN("IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.\n", data_size); + HeapFree(GetProcessHeap(), 0, d); return WINED3DERR_INVALIDCALL; } - data->ptr.object = (LPUNKNOWN)pData; - data->size = sizeof(LPUNKNOWN); - IUnknown_AddRef(data->ptr.object); + d->ptr.object = (IUnknown *)data; + d->size = sizeof(IUnknown *); + IUnknown_AddRef(d->ptr.object); } else { - data->ptr.data = HeapAlloc(GetProcessHeap(), 0, SizeOfData); - if (!data->ptr.data) + d->ptr.data = HeapAlloc(GetProcessHeap(), 0, data_size); + if (!d->ptr.data) { - HeapFree(GetProcessHeap(), 0, data); + HeapFree(GetProcessHeap(), 0, d); return E_OUTOFMEMORY; } - data->size = SizeOfData; - memcpy(data->ptr.data, pData, SizeOfData); + d->size = data_size; + memcpy(d->ptr.data, data, data_size); } - list_add_tail(&This->resource.privateData, &data->entry); + list_add_tail(&resource->resource.privateData, &d->entry); return WINED3D_OK; } diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c index c499d7153b9..7ca5ba9e000 100644 --- a/dlls/wined3d/surface_base.c +++ b/dlls/wined3d/surface_base.c @@ -114,7 +114,7 @@ ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface) { HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, REFGUID riid, const void *data, DWORD data_size, DWORD flags) { - return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags); + return resource_set_private_data((IWineD3DResourceImpl *)iface, riid, data, data_size, flags); } HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 77594358f6a..06976808c46 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -240,7 +240,7 @@ static ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DTexture *iface) { static HRESULT WINAPI IWineD3DTextureImpl_SetPrivateData(IWineD3DTexture *iface, REFGUID riid, const void *data, DWORD data_size, DWORD flags) { - return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags); + return resource_set_private_data((IWineD3DResourceImpl *)iface, riid, data, data_size, flags); } static HRESULT WINAPI IWineD3DTextureImpl_GetPrivateData(IWineD3DTexture *iface, diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 6334966f8b3..9b37c076a0d 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -153,7 +153,7 @@ static void * WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface) static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID riid, const void *data, DWORD data_size, DWORD flags) { - return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags); + return resource_set_private_data((IWineD3DResourceImpl *)iface, riid, data, data_size, flags); } static HRESULT WINAPI IWineD3DVolumeImpl_GetPrivateData(IWineD3DVolume *iface, diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c index ed837a70a52..5cb67e8db13 100644 --- a/dlls/wined3d/volumetexture.c +++ b/dlls/wined3d/volumetexture.c @@ -160,7 +160,7 @@ static ULONG WINAPI IWineD3DVolumeTextureImpl_Release(IWineD3DVolumeTexture *ifa static HRESULT WINAPI IWineD3DVolumeTextureImpl_SetPrivateData(IWineD3DVolumeTexture *iface, REFGUID riid, const void *data, DWORD data_size, DWORD flags) { - return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags); + return resource_set_private_data((IWineD3DResourceImpl *)iface, riid, data, data_size, flags); } static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetPrivateData(IWineD3DVolumeTexture *iface, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d6de00e68a6..be7feb84876 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1838,7 +1838,7 @@ HRESULT resource_init(struct IWineD3DResourceImpl *resource, WINED3DRESOURCETYPE WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN; DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority) DECLSPEC_HIDDEN; -HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID guid, +HRESULT resource_set_private_data(struct IWineD3DResourceImpl *resource, REFGUID guid, const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN; void resource_unload(IWineD3DResourceImpl *resource) DECLSPEC_HIDDEN;