Michael Stefaniuc : d3d10core: COM cleanup for the ID3D10Query iface.

Alexandre Julliard julliard at winehq.org
Thu Jun 2 11:22:59 CDT 2011


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Thu Jun  2 11:24:44 2011 +0200

d3d10core: COM cleanup for the ID3D10Query iface.

---

 dlls/d3d10core/async.c             |   11 ++++++++---
 dlls/d3d10core/d3d10core_private.h |    2 +-
 dlls/d3d10core/device.c            |    2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/d3d10core/async.c b/dlls/d3d10core/async.c
index 4efde85..3f869a5 100644
--- a/dlls/d3d10core/async.c
+++ b/dlls/d3d10core/async.c
@@ -24,6 +24,11 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
 
+static inline struct d3d10_query *impl_from_ID3D10Query(ID3D10Query *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3d10_query, ID3D10Query_iface);
+}
+
 /* IUnknown methods */
 
 static HRESULT STDMETHODCALLTYPE d3d10_query_QueryInterface(ID3D10Query *iface, REFIID riid, void **object)
@@ -48,7 +53,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_query_QueryInterface(ID3D10Query *iface,
 
 static ULONG STDMETHODCALLTYPE d3d10_query_AddRef(ID3D10Query *iface)
 {
-    struct d3d10_query *This = (struct d3d10_query *)iface;
+    struct d3d10_query *This = impl_from_ID3D10Query(iface);
     ULONG refcount = InterlockedIncrement(&This->refcount);
 
     TRACE("%p increasing refcount to %u.\n", This, refcount);
@@ -58,7 +63,7 @@ static ULONG STDMETHODCALLTYPE d3d10_query_AddRef(ID3D10Query *iface)
 
 static ULONG STDMETHODCALLTYPE d3d10_query_Release(ID3D10Query *iface)
 {
-    struct d3d10_query *This = (struct d3d10_query *)iface;
+    struct d3d10_query *This = impl_from_ID3D10Query(iface);
     ULONG refcount = InterlockedDecrement(&This->refcount);
 
     TRACE("%p decreasing refcount to %u.\n", This, refcount);
@@ -159,7 +164,7 @@ static const struct ID3D10QueryVtbl d3d10_query_vtbl =
 
 HRESULT d3d10_query_init(struct d3d10_query *query)
 {
-    query->vtbl = &d3d10_query_vtbl;
+    query->ID3D10Query_iface.lpVtbl = &d3d10_query_vtbl;
     query->refcount = 1;
 
     return S_OK;
diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h
index 9811315..23c8823 100644
--- a/dlls/d3d10core/d3d10core_private.h
+++ b/dlls/d3d10core/d3d10core_private.h
@@ -245,7 +245,7 @@ HRESULT d3d10_sampler_state_init(struct d3d10_sampler_state *state) DECLSPEC_HID
 /* ID3D10Query */
 struct d3d10_query
 {
-    const struct ID3D10QueryVtbl *vtbl;
+    ID3D10Query ID3D10Query_iface;
     LONG refcount;
 };
 
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 6af93ae..d4e3d1c 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -1084,7 +1084,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
     }
 
     TRACE("Created query %p.\n", object);
-    *query = (ID3D10Query *)object;
+    *query = &object->ID3D10Query_iface;
 
     return S_OK;
 }




More information about the wine-cvs mailing list