Commit 0d7b3247 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

fusion: Standardize the COM usage in asmcache.c.

parent 21c1cbf3
...@@ -123,15 +123,20 @@ static BOOL get_assembly_directory(LPWSTR dir, DWORD size, BYTE architecture) ...@@ -123,15 +123,20 @@ static BOOL get_assembly_directory(LPWSTR dir, DWORD size, BYTE architecture)
/* IAssemblyCache */ /* IAssemblyCache */
typedef struct { typedef struct {
const IAssemblyCacheVtbl *lpIAssemblyCacheVtbl; IAssemblyCache IAssemblyCache_iface;
LONG ref; LONG ref;
} IAssemblyCacheImpl; } IAssemblyCacheImpl;
static inline IAssemblyCacheImpl *impl_from_IAssemblyCache(IAssemblyCache *iface)
{
return CONTAINING_RECORD(iface, IAssemblyCacheImpl, IAssemblyCache_iface);
}
static HRESULT WINAPI IAssemblyCacheImpl_QueryInterface(IAssemblyCache *iface, static HRESULT WINAPI IAssemblyCacheImpl_QueryInterface(IAssemblyCache *iface,
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
IAssemblyCacheImpl *This = (IAssemblyCacheImpl *)iface; IAssemblyCacheImpl *This = impl_from_IAssemblyCache(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj); TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
...@@ -151,7 +156,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_QueryInterface(IAssemblyCache *iface, ...@@ -151,7 +156,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_QueryInterface(IAssemblyCache *iface,
static ULONG WINAPI IAssemblyCacheImpl_AddRef(IAssemblyCache *iface) static ULONG WINAPI IAssemblyCacheImpl_AddRef(IAssemblyCache *iface)
{ {
IAssemblyCacheImpl *This = (IAssemblyCacheImpl *)iface; IAssemblyCacheImpl *This = impl_from_IAssemblyCache(iface);
ULONG refCount = InterlockedIncrement(&This->ref); ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before = %u)\n", This, refCount - 1); TRACE("(%p)->(ref before = %u)\n", This, refCount - 1);
...@@ -161,7 +166,7 @@ static ULONG WINAPI IAssemblyCacheImpl_AddRef(IAssemblyCache *iface) ...@@ -161,7 +166,7 @@ static ULONG WINAPI IAssemblyCacheImpl_AddRef(IAssemblyCache *iface)
static ULONG WINAPI IAssemblyCacheImpl_Release(IAssemblyCache *iface) static ULONG WINAPI IAssemblyCacheImpl_Release(IAssemblyCache *iface)
{ {
IAssemblyCacheImpl *This = (IAssemblyCacheImpl *)iface; IAssemblyCacheImpl *This = impl_from_IAssemblyCache(iface);
ULONG refCount = InterlockedDecrement(&This->ref); ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before = %u)\n", This, refCount + 1); TRACE("(%p)->(ref before = %u)\n", This, refCount + 1);
...@@ -364,10 +369,10 @@ HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved ...@@ -364,10 +369,10 @@ HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved
if (!cache) if (!cache)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
cache->lpIAssemblyCacheVtbl = &AssemblyCacheVtbl; cache->IAssemblyCache_iface.lpVtbl = &AssemblyCacheVtbl;
cache->ref = 1; cache->ref = 1;
*ppAsmCache = (IAssemblyCache *)cache; *ppAsmCache = &cache->IAssemblyCache_iface;
return S_OK; return S_OK;
} }
...@@ -375,15 +380,20 @@ HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved ...@@ -375,15 +380,20 @@ HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved
/* IAssemblyCacheItem */ /* IAssemblyCacheItem */
typedef struct { typedef struct {
const IAssemblyCacheItemVtbl *lpIAssemblyCacheItemVtbl; IAssemblyCacheItem IAssemblyCacheItem_iface;
LONG ref; LONG ref;
} IAssemblyCacheItemImpl; } IAssemblyCacheItemImpl;
static inline IAssemblyCacheItemImpl *impl_from_IAssemblyCacheItem(IAssemblyCacheItem *iface)
{
return CONTAINING_RECORD(iface, IAssemblyCacheItemImpl, IAssemblyCacheItem_iface);
}
static HRESULT WINAPI IAssemblyCacheItemImpl_QueryInterface(IAssemblyCacheItem *iface, static HRESULT WINAPI IAssemblyCacheItemImpl_QueryInterface(IAssemblyCacheItem *iface,
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
IAssemblyCacheItemImpl *This = (IAssemblyCacheItemImpl *)iface; IAssemblyCacheItemImpl *This = impl_from_IAssemblyCacheItem(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj); TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj);
...@@ -403,7 +413,7 @@ static HRESULT WINAPI IAssemblyCacheItemImpl_QueryInterface(IAssemblyCacheItem * ...@@ -403,7 +413,7 @@ static HRESULT WINAPI IAssemblyCacheItemImpl_QueryInterface(IAssemblyCacheItem *
static ULONG WINAPI IAssemblyCacheItemImpl_AddRef(IAssemblyCacheItem *iface) static ULONG WINAPI IAssemblyCacheItemImpl_AddRef(IAssemblyCacheItem *iface)
{ {
IAssemblyCacheItemImpl *This = (IAssemblyCacheItemImpl *)iface; IAssemblyCacheItemImpl *This = impl_from_IAssemblyCacheItem(iface);
ULONG refCount = InterlockedIncrement(&This->ref); ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before = %u)\n", This, refCount - 1); TRACE("(%p)->(ref before = %u)\n", This, refCount - 1);
...@@ -413,7 +423,7 @@ static ULONG WINAPI IAssemblyCacheItemImpl_AddRef(IAssemblyCacheItem *iface) ...@@ -413,7 +423,7 @@ static ULONG WINAPI IAssemblyCacheItemImpl_AddRef(IAssemblyCacheItem *iface)
static ULONG WINAPI IAssemblyCacheItemImpl_Release(IAssemblyCacheItem *iface) static ULONG WINAPI IAssemblyCacheItemImpl_Release(IAssemblyCacheItem *iface)
{ {
IAssemblyCacheItemImpl *This = (IAssemblyCacheItemImpl *)iface; IAssemblyCacheItemImpl *This = impl_from_IAssemblyCacheItem(iface);
ULONG refCount = InterlockedDecrement(&This->ref); ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before = %u)\n", This, refCount + 1); TRACE("(%p)->(ref before = %u)\n", This, refCount + 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment