Commit a80749fd authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass an IWineD3DResourceImpl pointer to resource_set_private_data().

parent d512ccdf
...@@ -764,7 +764,7 @@ static void * STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface) ...@@ -764,7 +764,7 @@ static void * STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface)
static HRESULT STDMETHODCALLTYPE buffer_SetPrivateData(IWineD3DBuffer *iface, static HRESULT STDMETHODCALLTYPE buffer_SetPrivateData(IWineD3DBuffer *iface,
REFGUID guid, const void *data, DWORD data_size, DWORD flags) 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, static HRESULT STDMETHODCALLTYPE buffer_GetPrivateData(IWineD3DBuffer *iface,
......
...@@ -215,7 +215,7 @@ static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface) ...@@ -215,7 +215,7 @@ static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface)
static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface, static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface,
REFGUID riid, const void *data, DWORD data_size, DWORD flags) 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, static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface,
......
...@@ -147,47 +147,46 @@ static struct private_data *resource_find_private_data(IWineD3DResourceImpl *Thi ...@@ -147,47 +147,46 @@ static struct private_data *resource_find_private_data(IWineD3DResourceImpl *Thi
return NULL; return NULL;
} }
HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID refguid, HRESULT resource_set_private_data(struct IWineD3DResourceImpl *resource, REFGUID guid,
const void *pData, DWORD SizeOfData, DWORD flags) const void *data, DWORD data_size, DWORD flags)
{ {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; struct private_data *d;
struct private_data *data;
TRACE("iface %p, riid %s, data %p, data_size %u, flags %#x.\n", TRACE("resource %p, riid %s, data %p, data_size %u, flags %#x.\n",
iface, debugstr_guid(refguid), pData, SizeOfData, flags); 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)); d = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d));
if (!data) return E_OUTOFMEMORY; if (!d) return E_OUTOFMEMORY;
data->tag = *refguid; d->tag = *guid;
data->flags = flags; d->flags = flags;
if (flags & WINED3DSPD_IUNKNOWN) if (flags & WINED3DSPD_IUNKNOWN)
{ {
if (SizeOfData != sizeof(IUnknown *)) if (data_size != sizeof(IUnknown *))
{ {
WARN("IUnknown data with size %d, returning WINED3DERR_INVALIDCALL\n", SizeOfData); WARN("IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.\n", data_size);
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, d);
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
data->ptr.object = (LPUNKNOWN)pData; d->ptr.object = (IUnknown *)data;
data->size = sizeof(LPUNKNOWN); d->size = sizeof(IUnknown *);
IUnknown_AddRef(data->ptr.object); IUnknown_AddRef(d->ptr.object);
} }
else else
{ {
data->ptr.data = HeapAlloc(GetProcessHeap(), 0, SizeOfData); d->ptr.data = HeapAlloc(GetProcessHeap(), 0, data_size);
if (!data->ptr.data) if (!d->ptr.data)
{ {
HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, d);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
data->size = SizeOfData; d->size = data_size;
memcpy(data->ptr.data, pData, SizeOfData); 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; return WINED3D_OK;
} }
......
...@@ -114,7 +114,7 @@ ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface) { ...@@ -114,7 +114,7 @@ ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface) {
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface,
REFGUID riid, const void *data, DWORD data_size, DWORD flags) 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, HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface,
......
...@@ -240,7 +240,7 @@ static ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DTexture *iface) { ...@@ -240,7 +240,7 @@ static ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DTexture *iface) {
static HRESULT WINAPI IWineD3DTextureImpl_SetPrivateData(IWineD3DTexture *iface, static HRESULT WINAPI IWineD3DTextureImpl_SetPrivateData(IWineD3DTexture *iface,
REFGUID riid, const void *data, DWORD data_size, DWORD flags) 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, static HRESULT WINAPI IWineD3DTextureImpl_GetPrivateData(IWineD3DTexture *iface,
......
...@@ -153,7 +153,7 @@ static void * WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface) ...@@ -153,7 +153,7 @@ static void * WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface)
static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface,
REFGUID riid, const void *data, DWORD data_size, DWORD flags) 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, static HRESULT WINAPI IWineD3DVolumeImpl_GetPrivateData(IWineD3DVolume *iface,
......
...@@ -160,7 +160,7 @@ static ULONG WINAPI IWineD3DVolumeTextureImpl_Release(IWineD3DVolumeTexture *ifa ...@@ -160,7 +160,7 @@ static ULONG WINAPI IWineD3DVolumeTextureImpl_Release(IWineD3DVolumeTexture *ifa
static HRESULT WINAPI IWineD3DVolumeTextureImpl_SetPrivateData(IWineD3DVolumeTexture *iface, static HRESULT WINAPI IWineD3DVolumeTextureImpl_SetPrivateData(IWineD3DVolumeTexture *iface,
REFGUID riid, const void *data, DWORD data_size, DWORD flags) 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, static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetPrivateData(IWineD3DVolumeTexture *iface,
......
...@@ -1838,7 +1838,7 @@ HRESULT resource_init(struct IWineD3DResourceImpl *resource, WINED3DRESOURCETYPE ...@@ -1838,7 +1838,7 @@ HRESULT resource_init(struct IWineD3DResourceImpl *resource, WINED3DRESOURCETYPE
WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN; WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN;
DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority) 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; const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN;
void resource_unload(IWineD3DResourceImpl *resource) DECLSPEC_HIDDEN; void resource_unload(IWineD3DResourceImpl *resource) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment