Michael Stefaniuc : sti: Use an iface instead of a vtbl pointer in sti_cf.

Alexandre Julliard julliard at winehq.org
Wed Dec 29 11:14:52 CST 2010


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Dec 29 02:53:33 2010 +0100

sti: Use an iface instead of a vtbl pointer in sti_cf.

---

 dlls/sti/sti_main.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/sti/sti_main.c b/dlls/sti/sti_main.c
index 30d9d3d..c532ffb 100644
--- a/dlls/sti/sti_main.c
+++ b/dlls/sti/sti_main.c
@@ -43,13 +43,13 @@ typedef HRESULT (*fnCreateInstance)(REFIID riid, IUnknown *pUnkOuter, LPVOID *pp
 
 typedef struct
 {
-    const struct IClassFactoryVtbl *vtbl;
+    IClassFactory IClassFactory_iface;
     fnCreateInstance pfnCreateInstance;
 } sti_cf;
 
 static inline sti_cf *impl_from_IClassFactory( IClassFactory *iface )
 {
-    return (sti_cf *)((char *)iface - FIELD_OFFSET( sti_cf, vtbl ));
+    return CONTAINING_RECORD(iface, sti_cf, IClassFactory_iface);
 }
 
 static HRESULT sti_create( REFIID riid, IUnknown *pUnkOuter, LPVOID *ppObj )
@@ -131,7 +131,7 @@ static const struct IClassFactoryVtbl sti_cf_vtbl =
     sti_cf_LockServer
 };
 
-static sti_cf the_sti_cf = { &sti_cf_vtbl, sti_create };
+static sti_cf the_sti_cf = { { &sti_cf_vtbl }, sti_create };
 
 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
 {
@@ -153,7 +153,7 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
 
     if (IsEqualGUID( rclsid, &CLSID_Sti ))
     {
-       cf = (IClassFactory *)&the_sti_cf.vtbl;
+       cf = &the_sti_cf.IClassFactory_iface;
     }
 
     if (cf)




More information about the wine-cvs mailing list