Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/main.c | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/dlls/evr/main.c b/dlls/evr/main.c index b5bab74c4f6..702e4640831 100644 --- a/dlls/evr/main.c +++ b/dlls/evr/main.c @@ -48,16 +48,16 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) return TRUE; }
-typedef struct { +struct class_factory +{ IClassFactory IClassFactory_iface; - - LONG ref; + LONG refcount; HRESULT (*pfnCreateInstance)(IUnknown *unk_outer, void **ppobj); -} IClassFactoryImpl; +};
-static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) +static inline struct class_factory *impl_from_IClassFactory(IClassFactory *iface) { - return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface); + return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface); }
struct object_creation_info @@ -73,65 +73,65 @@ static const struct object_creation_info object_creation[] = { &CLSID_MFVideoPresenter9, evr_presenter_create }, };
-static HRESULT WINAPI classfactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj) +static HRESULT WINAPI classfactory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) { - IClassFactoryImpl *This = impl_from_IClassFactory(iface); + struct class_factory *factory = impl_from_IClassFactory(iface);
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory)) { IClassFactory_AddRef(iface); - *ppobj = &This->IClassFactory_iface; + *out = &factory->IClassFactory_iface; return S_OK; }
- WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); + WARN("Unimplemented interface %s.\n", debugstr_guid(riid)); return E_NOINTERFACE; }
static ULONG WINAPI classfactory_AddRef(IClassFactory *iface) { - IClassFactoryImpl *This = impl_from_IClassFactory(iface); - return InterlockedIncrement(&This->ref); + struct class_factory *factory = impl_from_IClassFactory(iface); + return InterlockedIncrement(&factory->refcount); }
static ULONG WINAPI classfactory_Release(IClassFactory *iface) { - IClassFactoryImpl *This = impl_from_IClassFactory(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct class_factory *factory = impl_from_IClassFactory(iface); + ULONG refcount = InterlockedDecrement(&factory->refcount);
- if (ref == 0) - HeapFree(GetProcessHeap(), 0, This); + if (!refcount) + free(factory);
- return ref; + return refcount; }
static HRESULT WINAPI classfactory_CreateInstance(IClassFactory *iface, IUnknown *outer_unk, REFIID riid, void **ppobj) { - IClassFactoryImpl *This = impl_from_IClassFactory(iface); - HRESULT hres; + struct class_factory *factory = impl_from_IClassFactory(iface); IUnknown *unk; + HRESULT hr;
- TRACE("(%p)->(%p,%s,%p)\n", This, outer_unk, debugstr_guid(riid), ppobj); + TRACE("%p, %p, %s, %p.\n", iface, outer_unk, debugstr_guid(riid), ppobj);
*ppobj = NULL;
if (outer_unk && !IsEqualGUID(riid, &IID_IUnknown)) return E_NOINTERFACE;
- hres = This->pfnCreateInstance(outer_unk, (void **) &unk); - if (SUCCEEDED(hres)) + hr = factory->pfnCreateInstance(outer_unk, (void **) &unk); + if (SUCCEEDED(hr)) { - hres = IUnknown_QueryInterface(unk, riid, ppobj); + hr = IUnknown_QueryInterface(unk, riid, ppobj); IUnknown_Release(unk); } - return hres; + return hr; }
static HRESULT WINAPI classfactory_LockServer(IClassFactory *iface, BOOL dolock) { - IClassFactoryImpl *This = impl_from_IClassFactory(iface); - FIXME("(%p)->(%d), stub!\n", This, dolock); + FIXME("%p, %d stub!\n", iface, dolock); + return S_OK; }
@@ -144,12 +144,12 @@ static const IClassFactoryVtbl classfactory_Vtbl = classfactory_LockServer };
-HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **out) { + struct class_factory *factory; unsigned int i; - IClassFactoryImpl *factory;
- TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + TRACE("%s, %s, %p.\n", debugstr_guid(rclsid), debugstr_guid(riid), out);
if (!IsEqualGUID(&IID_IClassFactory, riid) && !IsEqualGUID( &IID_IUnknown, riid)) @@ -167,16 +167,16 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) return CLASS_E_CLASSNOTAVAILABLE; }
- factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory)); - if (factory == NULL) + if (!(factory = malloc(sizeof(*factory)))) return E_OUTOFMEMORY;
factory->IClassFactory_iface.lpVtbl = &classfactory_Vtbl; - factory->ref = 1; + factory->refcount = 1;
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
- *ppv = &(factory->IClassFactory_iface); + *out = &factory->IClassFactory_iface; + return S_OK; }