Commit 99a0da24 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mshtml: Use an iface instead of a vtbl pointer in HTMLLoadOptions.

parent 0850b4e8
......@@ -44,37 +44,38 @@ typedef struct load_opt {
} load_opt;
typedef struct {
const IHtmlLoadOptionsVtbl *lpHtmlLoadOptionsVtbl;
IHtmlLoadOptions IHtmlLoadOptions_iface;
LONG ref;
load_opt *opts;
} HTMLLoadOptions;
#define LOADOPTS(x) ((IHtmlLoadOptions*) &(x)->lpHtmlLoadOptionsVtbl)
#define LOADOPTS_THIS(iface) DEFINE_THIS(HTMLLoadOptions, HtmlLoadOptions, iface)
static inline HTMLLoadOptions *impl_from_IHtmlLoadOptions(IHtmlLoadOptions *iface)
{
return CONTAINING_RECORD(iface, HTMLLoadOptions, IHtmlLoadOptions_iface);
}
static HRESULT WINAPI HtmlLoadOptions_QueryInterface(IHtmlLoadOptions *iface,
REFIID riid, void **ppv)
{
HTMLLoadOptions *This = LOADOPTS_THIS(iface);
HTMLLoadOptions *This = impl_from_IHtmlLoadOptions(iface);
*ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = LOADOPTS(This);
*ppv = &This->IHtmlLoadOptions_iface;
}else if(IsEqualGUID(&IID_IOptionArray, riid)) {
TRACE("(%p)->(IID_IOptionArray %p)\n", This, ppv);
*ppv = LOADOPTS(This);
*ppv = &This->IHtmlLoadOptions_iface;
}else if(IsEqualGUID(&IID_IHtmlLoadOptions, riid)) {
TRACE("(%p)->(IID_IHtmlLoadOptions %p)\n", This, ppv);
*ppv = LOADOPTS(This);
*ppv = &This->IHtmlLoadOptions_iface;
}
if(*ppv) {
IHtmlLoadOptions_AddRef(LOADOPTS(This));
IHtmlLoadOptions_AddRef(&This->IHtmlLoadOptions_iface);
return S_OK;
}
......@@ -84,7 +85,7 @@ static HRESULT WINAPI HtmlLoadOptions_QueryInterface(IHtmlLoadOptions *iface,
static ULONG WINAPI HtmlLoadOptions_AddRef(IHtmlLoadOptions *iface)
{
HTMLLoadOptions *This = LOADOPTS_THIS(iface);
HTMLLoadOptions *This = impl_from_IHtmlLoadOptions(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
......@@ -94,7 +95,7 @@ static ULONG WINAPI HtmlLoadOptions_AddRef(IHtmlLoadOptions *iface)
static ULONG WINAPI HtmlLoadOptions_Release(IHtmlLoadOptions *iface)
{
HTMLLoadOptions *This = LOADOPTS_THIS(iface);
HTMLLoadOptions *This = impl_from_IHtmlLoadOptions(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
......@@ -119,7 +120,7 @@ static ULONG WINAPI HtmlLoadOptions_Release(IHtmlLoadOptions *iface)
static HRESULT WINAPI HtmlLoadOptions_QueryOption(IHtmlLoadOptions *iface, DWORD dwOption,
LPVOID pBuffer, ULONG *pcbBuf)
{
HTMLLoadOptions *This = LOADOPTS_THIS(iface);
HTMLLoadOptions *This = impl_from_IHtmlLoadOptions(iface);
load_opt *iter;
TRACE("(%p)->(%d %p %p)\n", This, dwOption, pBuffer, pcbBuf);
......@@ -148,7 +149,7 @@ static HRESULT WINAPI HtmlLoadOptions_QueryOption(IHtmlLoadOptions *iface, DWORD
static HRESULT WINAPI HtmlLoadOptions_SetOption(IHtmlLoadOptions *iface, DWORD dwOption,
LPVOID pBuffer, ULONG cbBuf)
{
HTMLLoadOptions *This = LOADOPTS_THIS(iface);
HTMLLoadOptions *This = impl_from_IHtmlLoadOptions(iface);
load_opt *iter = NULL;
TRACE("(%p)->(%d %p %d)\n", This, dwOption, pBuffer, cbBuf);
......@@ -182,8 +183,6 @@ static HRESULT WINAPI HtmlLoadOptions_SetOption(IHtmlLoadOptions *iface, DWORD d
return S_OK;
}
#undef LOADOPTS_THIS
static const IHtmlLoadOptionsVtbl HtmlLoadOptionsVtbl = {
HtmlLoadOptions_QueryInterface,
HtmlLoadOptions_AddRef,
......@@ -201,12 +200,12 @@ HRESULT HTMLLoadOptions_Create(IUnknown *pUnkOuter, REFIID riid, void** ppv)
ret = heap_alloc(sizeof(HTMLLoadOptions));
ret->lpHtmlLoadOptionsVtbl = &HtmlLoadOptionsVtbl;
ret->IHtmlLoadOptions_iface.lpVtbl = &HtmlLoadOptionsVtbl;
ret->ref = 1;
ret->opts = NULL;
hres = IHtmlLoadOptions_QueryInterface(LOADOPTS(ret), riid, ppv);
IHtmlLoadOptions_Release(LOADOPTS(ret));
hres = IHtmlLoadOptions_QueryInterface(&ret->IHtmlLoadOptions_iface, riid, ppv);
IHtmlLoadOptions_Release(&ret->IHtmlLoadOptions_iface);
return hres;
}
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