mshtml: Use ifaces instead of vtbl pointers in ProtocolFactory.

This commit is contained in:
Michael Stefaniuc 2011-01-05 00:43:29 +01:00 committed by Alexandre Julliard
parent 1ae51aa74a
commit 0eff947c09
1 changed files with 26 additions and 26 deletions

View File

@ -39,31 +39,32 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
* common ProtocolFactory implementation * common ProtocolFactory implementation
*/ */
#define CLASSFACTORY(x) (&(x)->lpClassFactoryVtbl)
#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
#define PROTOCOLINFO(x) ((IInternetProtocolInfo*) &(x)->lpInternetProtocolInfoVtbl)
typedef struct { typedef struct {
const IInternetProtocolInfoVtbl *lpInternetProtocolInfoVtbl; IInternetProtocolInfo IInternetProtocolInfo_iface;
const IClassFactoryVtbl *lpClassFactoryVtbl; IClassFactory IClassFactory_iface;
} ProtocolFactory; } ProtocolFactory;
#define PROTOCOLINFO_THIS(iface) DEFINE_THIS(ProtocolFactory, InternetProtocolInfo, iface) static inline ProtocolFactory *impl_from_IInternetProtocolInfo(IInternetProtocolInfo *iface)
{
return CONTAINING_RECORD(iface, ProtocolFactory, IInternetProtocolInfo_iface);
}
static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv) static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv)
{ {
ProtocolFactory *This = PROTOCOLINFO_THIS(iface); ProtocolFactory *This = impl_from_IInternetProtocolInfo(iface);
*ppv = NULL; *ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) { if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = PROTOCOLINFO(This); *ppv = &This->IInternetProtocolInfo_iface;
}else if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) { }else if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
TRACE("(%p)->(IID_IInternetProtocolInfo %p)\n", This, ppv); TRACE("(%p)->(IID_IInternetProtocolInfo %p)\n", This, ppv);
*ppv = PROTOCOLINFO(This); *ppv = &This->IInternetProtocolInfo_iface;
}else if(IsEqualGUID(&IID_IClassFactory, riid)) { }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
TRACE("(%p)->(IID_IClassFactory %p)\n", This, ppv); TRACE("(%p)->(IID_IClassFactory %p)\n", This, ppv);
*ppv = CLASSFACTORY(This); *ppv = &This->IClassFactory_iface;
} }
if(!*ppv) { if(!*ppv) {
@ -105,26 +106,27 @@ static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *ifa
return E_NOTIMPL; return E_NOTIMPL;
} }
#undef PROTOCOLINFO_THIS static inline ProtocolFactory *impl_from_IClassFactory(IClassFactory *iface)
{
#define CLASSFACTORY_THIS(iface) DEFINE_THIS(ProtocolFactory, ClassFactory, iface) return CONTAINING_RECORD(iface, ProtocolFactory, IClassFactory_iface);
}
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv) static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{ {
ProtocolFactory *This = CLASSFACTORY_THIS(iface); ProtocolFactory *This = impl_from_IClassFactory(iface);
return IInternetProtocolInfo_QueryInterface(PROTOCOLINFO(This), riid, ppv); return IInternetProtocolInfo_QueryInterface(&This->IInternetProtocolInfo_iface, riid, ppv);
} }
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
{ {
ProtocolFactory *This = CLASSFACTORY_THIS(iface); ProtocolFactory *This = impl_from_IClassFactory(iface);
return IInternetProtocolInfo_AddRef(PROTOCOLINFO(This)); return IInternetProtocolInfo_AddRef(&This->IInternetProtocolInfo_iface);
} }
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
{ {
ProtocolFactory *This = CLASSFACTORY_THIS(iface); ProtocolFactory *This = impl_from_IClassFactory(iface);
return IInternetProtocolInfo_Release(PROTOCOLINFO(This)); return IInternetProtocolInfo_Release(&This->IInternetProtocolInfo_iface);
} }
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
@ -133,8 +135,6 @@ static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
return S_OK; return S_OK;
} }
#undef CLASSFACTORY_THIS
/******************************************************************** /********************************************************************
* AboutProtocol implementation * AboutProtocol implementation
*/ */
@ -497,8 +497,8 @@ static const IClassFactoryVtbl AboutProtocolFactoryVtbl = {
}; };
static ProtocolFactory AboutProtocolFactory = { static ProtocolFactory AboutProtocolFactory = {
&AboutProtocolInfoVtbl, { &AboutProtocolInfoVtbl },
&AboutProtocolFactoryVtbl { &AboutProtocolFactoryVtbl }
}; };
/******************************************************************** /********************************************************************
@ -934,8 +934,8 @@ static const IClassFactoryVtbl ResProtocolFactoryVtbl = {
}; };
static ProtocolFactory ResProtocolFactory = { static ProtocolFactory ResProtocolFactory = {
&ResProtocolInfoVtbl, { &ResProtocolInfoVtbl },
&ResProtocolFactoryVtbl { &ResProtocolFactoryVtbl }
}; };
/******************************************************************** /********************************************************************
@ -1017,8 +1017,8 @@ static const IClassFactoryVtbl JSProtocolFactoryVtbl = {
}; };
static ProtocolFactory JSProtocolFactory = { static ProtocolFactory JSProtocolFactory = {
&JSProtocolInfoVtbl, { &JSProtocolInfoVtbl },
&JSProtocolFactoryVtbl { &JSProtocolFactoryVtbl }
}; };
HRESULT ProtocolFactory_Create(REFCLSID rclsid, REFIID riid, void **ppv) HRESULT ProtocolFactory_Create(REFCLSID rclsid, REFIID riid, void **ppv)