Michael Stefaniuc : oledb32: Use an iface instead of a vtbl pointer in IClassFactoryImpl.

Alexandre Julliard julliard at winehq.org
Mon Dec 6 13:18:32 CST 2010


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Sun Dec  5 15:17:05 2010 +0100

oledb32: Use an iface instead of a vtbl pointer in IClassFactoryImpl.

---

 dlls/oledb32/main.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/oledb32/main.c b/dlls/oledb32/main.c
index ec39c2f..2669d3e 100644
--- a/dlls/oledb32/main.c
+++ b/dlls/oledb32/main.c
@@ -59,13 +59,18 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID lpv)
  */
 typedef struct
 {
-    const IClassFactoryVtbl *lpVtbl;
+    IClassFactory IClassFactory_iface;
     HRESULT (*create_object)( IUnknown*, LPVOID* );
 } cf;
 
+static inline cf *impl_from_IClassFactory(IClassFactory *iface)
+{
+    return CONTAINING_RECORD(iface, cf, IClassFactory_iface);
+}
+
 static HRESULT WINAPI CF_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
 {
-    cf *This = (cf *)iface;
+    cf *This = impl_from_IClassFactory(iface);
 
     TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), obj);
 
@@ -91,7 +96,7 @@ static ULONG WINAPI CF_Release(IClassFactory *iface)
 
 static HRESULT WINAPI CF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **obj)
 {
-    cf *This = (cf *)iface;
+    cf *This = impl_from_IClassFactory(iface);
     IUnknown *unk = NULL;
     HRESULT r;
 
@@ -121,7 +126,7 @@ static const IClassFactoryVtbl CF_Vtbl =
     CF_LockServer
 };
 
-static cf oledb_convert_cf = { &CF_Vtbl, create_oledb_convert };
+static cf oledb_convert_cf = { { &CF_Vtbl }, create_oledb_convert };
 
 /******************************************************************
  * DllGetClassObject




More information about the wine-cvs mailing list