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