Henri Verbeet : wined3d: Pass an IWineD3DResourceImpl pointer to resource_set_private_data().

Alexandre Julliard julliard at winehq.org
Fri Jan 7 09:36:26 CST 2011


Module: wine
Branch: master
Commit: a80749fd57dbe25c64787ba3bcc5811e5c4c1657
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a80749fd57dbe25c64787ba3bcc5811e5c4c1657

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Jan  7 10:16:38 2011 +0100

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 43fe20e..cdcecf3 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 89afcbf..c80e5ab 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 173fa58..c211572 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 c499d71..7ca5ba9 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 7759435..0697680 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 6334966..9b37c07 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 ed837a7..5cb67e8 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 d6de00e..be7feb8 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;
 




More information about the wine-cvs mailing list