[PATCH 4/4] d3d10: COM cleanup for the ID3D10ShaderReflection iface.

Michael Stefaniuc mstefani at redhat.de
Fri Jun 3 04:18:36 CDT 2011


---
 dlls/d3d10/d3d10_main.c    |    4 ++--
 dlls/d3d10/d3d10_private.h |    2 +-
 dlls/d3d10/shader.c        |    9 +++++++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c
index f153ed3..9076b0a 100644
--- a/dlls/d3d10/d3d10_main.c
+++ b/dlls/d3d10/d3d10_main.c
@@ -276,10 +276,10 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad
         return E_OUTOFMEMORY;
     }
 
-    object->vtbl = &d3d10_shader_reflection_vtbl;
+    object->ID3D10ShaderReflection_iface.lpVtbl = &d3d10_shader_reflection_vtbl;
     object->refcount = 1;
 
-    *reflector = (ID3D10ShaderReflection *)object;
+    *reflector = &object->ID3D10ShaderReflection_iface;
 
     TRACE("Created ID3D10ShaderReflection %p\n", object);
 
diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index 1df4611..df525ca 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -217,7 +217,7 @@ struct d3d10_effect
 extern const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl DECLSPEC_HIDDEN;
 struct d3d10_shader_reflection
 {
-    const struct ID3D10ShaderReflectionVtbl *vtbl;
+    ID3D10ShaderReflection ID3D10ShaderReflection_iface;
     LONG refcount;
 };
 
diff --git a/dlls/d3d10/shader.c b/dlls/d3d10/shader.c
index 29d7897..499da12 100644
--- a/dlls/d3d10/shader.c
+++ b/dlls/d3d10/shader.c
@@ -27,6 +27,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
 
 /* IUnknown methods */
 
+static inline struct d3d10_shader_reflection *impl_from_ID3D10ShaderReflection(ID3D10ShaderReflection *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3d10_shader_reflection, ID3D10ShaderReflection_iface);
+}
+
 static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_QueryInterface(ID3D10ShaderReflection *iface, REFIID riid, void **object)
 {
     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
@@ -47,7 +52,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_QueryInterface(ID3D10Sh
 
 static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_AddRef(ID3D10ShaderReflection *iface)
 {
-    struct d3d10_shader_reflection *This = (struct d3d10_shader_reflection *)iface;
+    struct d3d10_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface);
     ULONG refcount = InterlockedIncrement(&This->refcount);
 
     TRACE("%p increasing refcount to %u\n", This, refcount);
@@ -57,7 +62,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_AddRef(ID3D10ShaderReflec
 
 static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderReflection *iface)
 {
-    struct d3d10_shader_reflection *This = (struct d3d10_shader_reflection *)iface;
+    struct d3d10_shader_reflection *This = impl_from_ID3D10ShaderReflection(iface);
     ULONG refcount = InterlockedDecrement(&This->refcount);
 
     TRACE("%p decreasing refcount to %u\n", This, refcount);
-- 
1.7.4.4



More information about the wine-patches mailing list