Rico Schüller : d3dcompiler: Use an iface instead of a vtbl pointer in d3dcompiler_blob.

Alexandre Julliard julliard at winehq.org
Tue Dec 21 14:32:19 CST 2010


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

Author: Rico Schüller <kgbricola at web.de>
Date:   Tue Dec 21 11:05:49 2010 +0100

d3dcompiler: Use an iface instead of a vtbl pointer in d3dcompiler_blob.

---

 dlls/d3dcompiler_43/blob.c                |   15 ++++++++++-----
 dlls/d3dcompiler_43/d3dcompiler_private.h |    2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/d3dcompiler_43/blob.c b/dlls/d3dcompiler_43/blob.c
index d7c8067..995ac41 100644
--- a/dlls/d3dcompiler_43/blob.c
+++ b/dlls/d3dcompiler_43/blob.c
@@ -26,6 +26,11 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
 
+static inline struct d3dcompiler_blob *impl_from_ID3DBlob(ID3DBlob *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3dcompiler_blob, ID3DBlob_iface);
+}
+
 /* IUnknown methods */
 
 static HRESULT STDMETHODCALLTYPE d3dcompiler_blob_QueryInterface(ID3DBlob *iface, REFIID riid, void **object)
@@ -48,7 +53,7 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_blob_QueryInterface(ID3DBlob *iface
 
 static ULONG STDMETHODCALLTYPE d3dcompiler_blob_AddRef(ID3DBlob *iface)
 {
-    struct d3dcompiler_blob *blob = (struct d3dcompiler_blob *)iface;
+    struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
     ULONG refcount = InterlockedIncrement(&blob->refcount);
 
     TRACE("%p increasing refcount to %u\n", blob, refcount);
@@ -58,7 +63,7 @@ static ULONG STDMETHODCALLTYPE d3dcompiler_blob_AddRef(ID3DBlob *iface)
 
 static ULONG STDMETHODCALLTYPE d3dcompiler_blob_Release(ID3DBlob *iface)
 {
-    struct d3dcompiler_blob *blob = (struct d3dcompiler_blob *)iface;
+    struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
     ULONG refcount = InterlockedDecrement(&blob->refcount);
 
     TRACE("%p decreasing refcount to %u\n", blob, refcount);
@@ -76,7 +81,7 @@ static ULONG STDMETHODCALLTYPE d3dcompiler_blob_Release(ID3DBlob *iface)
 
 static void * STDMETHODCALLTYPE d3dcompiler_blob_GetBufferPointer(ID3DBlob *iface)
 {
-    struct d3dcompiler_blob *blob = (struct d3dcompiler_blob *)iface;
+    struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
 
     TRACE("iface %p\n", iface);
 
@@ -85,7 +90,7 @@ static void * STDMETHODCALLTYPE d3dcompiler_blob_GetBufferPointer(ID3DBlob *ifac
 
 static SIZE_T STDMETHODCALLTYPE d3dcompiler_blob_GetBufferSize(ID3DBlob *iface)
 {
-    struct d3dcompiler_blob *blob = (struct d3dcompiler_blob *)iface;
+    struct d3dcompiler_blob *blob = impl_from_ID3DBlob(iface);
 
     TRACE("iface %p\n", iface);
 
@@ -105,7 +110,7 @@ static const struct ID3D10BlobVtbl d3dcompiler_blob_vtbl =
 
 HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
 {
-    blob->vtbl = &d3dcompiler_blob_vtbl;
+    blob->ID3DBlob_iface.lpVtbl = &d3dcompiler_blob_vtbl;
     blob->refcount = 1;
     blob->size = data_size;
 
diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h
index 33c51d7..1cbe561 100644
--- a/dlls/d3dcompiler_43/d3dcompiler_private.h
+++ b/dlls/d3dcompiler_43/d3dcompiler_private.h
@@ -44,7 +44,7 @@ const char *debug_d3dcompiler_d3d_blob_part(D3D_BLOB_PART part) DECLSPEC_HIDDEN;
 /* ID3DBlob */
 struct d3dcompiler_blob
 {
-    const struct ID3D10BlobVtbl *vtbl;
+    ID3DBlob ID3DBlob_iface;
     LONG refcount;
 
     SIZE_T size;




More information about the wine-cvs mailing list