Michael Stefaniuc : quartz: COM cleanup for the IClassFactory iface.

Alexandre Julliard julliard at winehq.org
Mon Aug 20 14:16:19 CDT 2012


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Mon Aug 20 12:03:14 2012 +0200

quartz: COM cleanup for the IClassFactory iface.

---

 dlls/quartz/main.c |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c
index edb9cbc..2a4071c 100644
--- a/dlls/quartz/main.c
+++ b/dlls/quartz/main.c
@@ -46,12 +46,16 @@ static HRESULT SeekingPassThru_create(IUnknown *pUnkOuter, LPVOID *ppObj)
  * DirectShow ClassFactory
  */
 typedef struct {
-    IClassFactory ITF_IClassFactory;
-
+    IClassFactory IClassFactory_iface;
     LONG ref;
     HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
 } IClassFactoryImpl;
 
+static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
+{
+    return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
+}
+
 struct object_creation_info
 {
     const CLSID *clsid;
@@ -81,34 +85,30 @@ static const struct object_creation_info object_creation[] =
     { &CLSID_WAVEParser, WAVEParser_create }
 };
 
-static HRESULT WINAPI
-DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
+static HRESULT WINAPI DSCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
 {
-    IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
-
     if (IsEqualGUID(riid, &IID_IUnknown)
 	|| IsEqualGUID(riid, &IID_IClassFactory))
     {
 	IClassFactory_AddRef(iface);
-	*ppobj = This;
+        *ppobj = iface;
 	return S_OK;
     }
 
     *ppobj = NULL;
-    WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
+    WARN("(%p)->(%s,%p), not found\n", iface, debugstr_guid(riid), ppobj);
     return E_NOINTERFACE;
 }
 
-static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
+static ULONG WINAPI DSCF_AddRef(IClassFactory *iface)
 {
-    IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+    IClassFactoryImpl *This = impl_from_IClassFactory(iface);
     return InterlockedIncrement(&This->ref);
 }
 
-static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
+static ULONG WINAPI DSCF_Release(IClassFactory *iface)
 {
-    IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
-
+    IClassFactoryImpl *This = impl_from_IClassFactory(iface);
     ULONG ref = InterlockedDecrement(&This->ref);
 
     if (ref == 0)
@@ -118,10 +118,10 @@ static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
 }
 
 
-static HRESULT WINAPI DSCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
-					  REFIID riid, LPVOID *ppobj)
+static HRESULT WINAPI DSCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
+                                          REFIID riid, void **ppobj)
 {
-    IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+    IClassFactoryImpl *This = impl_from_IClassFactory(iface);
     HRESULT hres;
     LPUNKNOWN punk;
 
@@ -139,9 +139,9 @@ static HRESULT WINAPI DSCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter
     return hres;
 }
 
-static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
+static HRESULT WINAPI DSCF_LockServer(IClassFactory *iface, BOOL dolock)
 {
-    IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+    IClassFactoryImpl *This = impl_from_IClassFactory(iface);
     FIXME("(%p)->(%d),stub!\n",This,dolock);
     return S_OK;
 }
@@ -187,12 +187,12 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
                 IClassFactoryImpl *factory = CoTaskMemAlloc(sizeof(*factory));
                 if (factory == NULL) return E_OUTOFMEMORY;
 
-                factory->ITF_IClassFactory.lpVtbl = &DSCF_Vtbl;
+                factory->IClassFactory_iface.lpVtbl = &DSCF_Vtbl;
                 factory->ref = 1;
 
                 factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
 
-                *ppv = &factory->ITF_IClassFactory;
+                *ppv = &factory->IClassFactory_iface;
                 return S_OK;
             }
         }




More information about the wine-cvs mailing list