Module: wine Branch: master Commit: 1c35951f9fa07bc058fbd025cd0b5c2373ccc33d URL: http://source.winehq.org/git/wine.git/?a=commit;h=1c35951f9fa07bc058fbd025cd...
Author: Michael Stefaniuc mstefani@redhat.de Date: Fri Jan 14 00:39:39 2011 +0100
sxs: COM cleanup for the IAssemblyCache iface.
---
dlls/sxs/cache.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/dlls/sxs/cache.c b/dlls/sxs/cache.c index 8f9238d..af19e60 100644 --- a/dlls/sxs/cache.c +++ b/dlls/sxs/cache.c @@ -45,16 +45,21 @@ static inline WCHAR *strdupW( const WCHAR *s )
struct cache { - const IAssemblyCacheVtbl *vtbl; + IAssemblyCache IAssemblyCache_iface; LONG refs; };
+static inline struct cache *impl_from_IAssemblyCache(IAssemblyCache *iface) +{ + return CONTAINING_RECORD(iface, struct cache, IAssemblyCache_iface); +} + static HRESULT WINAPI cache_QueryInterface( IAssemblyCache *iface, REFIID riid, void **obj ) { - struct cache *cache = (struct cache *)iface; + struct cache *cache = impl_from_IAssemblyCache(iface);
TRACE("%p, %s, %p\n", cache, debugstr_guid(riid), obj);
@@ -73,13 +78,13 @@ static HRESULT WINAPI cache_QueryInterface(
static ULONG WINAPI cache_AddRef( IAssemblyCache *iface ) { - struct cache *cache = (struct cache *)iface; + struct cache *cache = impl_from_IAssemblyCache(iface); return InterlockedIncrement( &cache->refs ); }
static ULONG WINAPI cache_Release( IAssemblyCache *iface ) { - struct cache *cache = (struct cache *)iface; + struct cache *cache = impl_from_IAssemblyCache(iface); ULONG refs = InterlockedDecrement( &cache->refs );
if (!refs) @@ -605,9 +610,9 @@ HRESULT WINAPI CreateAssemblyCache( IAssemblyCache **obj, DWORD reserved ) if (!cache) return E_OUTOFMEMORY;
- cache->vtbl = &cache_vtbl; + cache->IAssemblyCache_iface.lpVtbl = &cache_vtbl; cache->refs = 1;
- *obj = (IAssemblyCache *)cache; + *obj = &cache->IAssemblyCache_iface; return S_OK; }