Michael Stefaniuc : windowscodecs: Use an iface instead of a vtbl pointer in ImagingFactory.
Module: wine Branch: master Commit: e97fb5036d58f076f49ce909fd5d208da8799606 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e97fb5036d58f076f49ce909fd... Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Mon Nov 29 01:00:50 2010 +0100 windowscodecs: Use an iface instead of a vtbl pointer in ImagingFactory. --- dlls/windowscodecs/imgfactory.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index 5c81b98..a2e8e7f 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -36,14 +36,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); typedef struct { - const IWICImagingFactoryVtbl *lpIWICImagingFactoryVtbl; + IWICImagingFactory IWICImagingFactory_iface; LONG ref; } ImagingFactory; +static inline ImagingFactory *impl_from_IWICImagingFactory(IWICImagingFactory *iface) +{ + return CONTAINING_RECORD(iface, ImagingFactory, IWICImagingFactory_iface); +} + static HRESULT WINAPI ImagingFactory_QueryInterface(IWICImagingFactory *iface, REFIID iid, void **ppv) { - ImagingFactory *This = (ImagingFactory*)iface; + ImagingFactory *This = impl_from_IWICImagingFactory(iface); TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); if (!ppv) return E_INVALIDARG; @@ -64,7 +69,7 @@ static HRESULT WINAPI ImagingFactory_QueryInterface(IWICImagingFactory *iface, R static ULONG WINAPI ImagingFactory_AddRef(IWICImagingFactory *iface) { - ImagingFactory *This = (ImagingFactory*)iface; + ImagingFactory *This = impl_from_IWICImagingFactory(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) refcount=%u\n", iface, ref); @@ -74,7 +79,7 @@ static ULONG WINAPI ImagingFactory_AddRef(IWICImagingFactory *iface) static ULONG WINAPI ImagingFactory_Release(IWICImagingFactory *iface) { - ImagingFactory *This = (ImagingFactory*)iface; + ImagingFactory *This = impl_from_IWICImagingFactory(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) refcount=%u\n", iface, ref); @@ -428,7 +433,7 @@ HRESULT ImagingFactory_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** pp This = HeapAlloc(GetProcessHeap(), 0, sizeof(ImagingFactory)); if (!This) return E_OUTOFMEMORY; - This->lpIWICImagingFactoryVtbl = &ImagingFactory_Vtbl; + This->IWICImagingFactory_iface.lpVtbl = &ImagingFactory_Vtbl; This->ref = 1; ret = IUnknown_QueryInterface((IUnknown*)This, iid, ppv);
participants (1)
-
Alexandre Julliard