Commit 3f6751f4 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

msctf: Use an iface instead of a vtbl pointer in ClassFactory.

parent 242bd9e4
...@@ -95,11 +95,16 @@ static const struct { ...@@ -95,11 +95,16 @@ static const struct {
typedef struct tagClassFactory typedef struct tagClassFactory
{ {
const IClassFactoryVtbl *vtbl; IClassFactory IClassFactory_iface;
LONG ref; LONG ref;
LPFNCONSTRUCTOR ctor; LPFNCONSTRUCTOR ctor;
} ClassFactory; } ClassFactory;
static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
}
static void ClassFactory_Destructor(ClassFactory *This) static void ClassFactory_Destructor(ClassFactory *This)
{ {
TRACE("Destroying class factory %p\n", This); TRACE("Destroying class factory %p\n", This);
...@@ -122,13 +127,13 @@ static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID r ...@@ -122,13 +127,13 @@ static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID r
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
{ {
ClassFactory *This = (ClassFactory *)iface; ClassFactory *This = impl_from_IClassFactory(iface);
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
{ {
ClassFactory *This = (ClassFactory *)iface; ClassFactory *This = impl_from_IClassFactory(iface);
ULONG ret = InterlockedDecrement(&This->ref); ULONG ret = InterlockedDecrement(&This->ref);
if (ret == 0) if (ret == 0)
...@@ -138,7 +143,7 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) ...@@ -138,7 +143,7 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *punkOuter, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *punkOuter, REFIID iid, LPVOID *ppvOut)
{ {
ClassFactory *This = (ClassFactory *)iface; ClassFactory *This = impl_from_IClassFactory(iface);
HRESULT ret; HRESULT ret;
IUnknown *obj; IUnknown *obj;
...@@ -153,7 +158,7 @@ static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown ...@@ -153,7 +158,7 @@ static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock) static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
{ {
ClassFactory *This = (ClassFactory *)iface; ClassFactory *This = impl_from_IClassFactory(iface);
TRACE("(%p)->(%x)\n", This, fLock); TRACE("(%p)->(%x)\n", This, fLock);
...@@ -179,7 +184,7 @@ static const IClassFactoryVtbl ClassFactoryVtbl = { ...@@ -179,7 +184,7 @@ static const IClassFactoryVtbl ClassFactoryVtbl = {
static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut) static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
{ {
ClassFactory *This = HeapAlloc(GetProcessHeap(),0,sizeof(ClassFactory)); ClassFactory *This = HeapAlloc(GetProcessHeap(),0,sizeof(ClassFactory));
This->vtbl = &ClassFactoryVtbl; This->IClassFactory_iface.lpVtbl = &ClassFactoryVtbl;
This->ref = 1; This->ref = 1;
This->ctor = ctor; This->ctor = ctor;
*ppvOut = This; *ppvOut = This;
......
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