[PATCH 4/5] mshtml: COM cleanup for the IHTMLDocument6 iface.

Michael Stefaniuc mstefani at redhat.de
Wed Dec 22 03:45:14 CST 2010


---
 dlls/mshtml/htmldoc.c        |    2 +-
 dlls/mshtml/htmldoc5.c       |   39 ++++++++++++++++++++-------------------
 dlls/mshtml/mshtml_private.h |    3 +--
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 1f64917..bbd276b 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1728,7 +1728,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
         *ppv = &This->IHTMLDocument5_iface;
     }else if(IsEqualGUID(&IID_IHTMLDocument6, riid)) {
         TRACE("(%p)->(IID_IHTMLDocument6, %p)\n", This, ppv);
-        *ppv = HTMLDOC6(This);
+        *ppv = &This->IHTMLDocument6_iface;
     }else if(IsEqualGUID(&IID_IPersist, riid)) {
         TRACE("(%p)->(IID_IPersist, %p)\n", This, ppv);
         *ppv = PERSIST(This);
diff --git a/dlls/mshtml/htmldoc5.c b/dlls/mshtml/htmldoc5.c
index 2598642..bc31008 100644
--- a/dlls/mshtml/htmldoc5.c
+++ b/dlls/mshtml/htmldoc5.c
@@ -303,44 +303,47 @@ static const IHTMLDocument5Vtbl HTMLDocument5Vtbl = {
     HTMLDocument5_get_compatMode
 };
 
-#define HTMLDOC6_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument6, iface)
+static inline HTMLDocument *impl_from_IHTMLDocument6(IHTMLDocument6 *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument6_iface);
+}
 
 static HRESULT WINAPI HTMLDocument6_QueryInterface(IHTMLDocument6 *iface,
         REFIID riid, void **ppv)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     return htmldoc_query_interface(This, riid, ppv);
 }
 
 static ULONG WINAPI HTMLDocument6_AddRef(IHTMLDocument6 *iface)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     return htmldoc_addref(This);
 }
 
 static ULONG WINAPI HTMLDocument6_Release(IHTMLDocument6 *iface)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     return htmldoc_release(This);
 }
 
 static HRESULT WINAPI HTMLDocument6_GetTypeInfoCount(IHTMLDocument6 *iface, UINT *pctinfo)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
 }
 
 static HRESULT WINAPI HTMLDocument6_GetTypeInfo(IHTMLDocument6 *iface, UINT iTInfo,
         LCID lcid, ITypeInfo **ppTInfo)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
 }
 
 static HRESULT WINAPI HTMLDocument6_GetIDsOfNames(IHTMLDocument6 *iface, REFIID riid,
         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
 }
 
@@ -348,7 +351,7 @@ static HRESULT WINAPI HTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdM
                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
             pVarResult, pExcepInfo, puArgErr);
 }
@@ -356,7 +359,7 @@ static HRESULT WINAPI HTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdM
 static HRESULT WINAPI HTMLDocument6_get_compatible(IHTMLDocument6 *iface,
         IHTMLDocumentCompatibleInfoCollection **p)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -364,7 +367,7 @@ static HRESULT WINAPI HTMLDocument6_get_compatible(IHTMLDocument6 *iface,
 static HRESULT WINAPI HTMLDocument6_get_documentMode(IHTMLDocument6 *iface,
         VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -372,7 +375,7 @@ static HRESULT WINAPI HTMLDocument6_get_documentMode(IHTMLDocument6 *iface,
 static HRESULT WINAPI HTMLDocument6_get_onstorage(IHTMLDocument6 *iface,
         VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -380,7 +383,7 @@ static HRESULT WINAPI HTMLDocument6_get_onstorage(IHTMLDocument6 *iface,
 static HRESULT WINAPI HTMLDocument6_put_onstorage(IHTMLDocument6 *iface,
         VARIANT p)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     FIXME("(%p)->(v)\n", This);
     return E_NOTIMPL;
 }
@@ -388,7 +391,7 @@ static HRESULT WINAPI HTMLDocument6_put_onstorage(IHTMLDocument6 *iface,
 static HRESULT WINAPI HTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface,
         VARIANT *p)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -396,7 +399,7 @@ static HRESULT WINAPI HTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface,
 static HRESULT WINAPI HTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface,
         VARIANT p)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     FIXME("(%p)->(v)\n", This);
     return E_NOTIMPL;
 }
@@ -404,20 +407,18 @@ static HRESULT WINAPI HTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface,
 static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface,
         BSTR bstrId, IHTMLElement2 **p)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrId), p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLDocument6_updateSettings(IHTMLDocument6 *iface)
 {
-    HTMLDocument *This = HTMLDOC6_THIS(iface);
+    HTMLDocument *This = impl_from_IHTMLDocument6(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
-#undef HTMLDOC6_THIS
-
 static const IHTMLDocument6Vtbl HTMLDocument6Vtbl = {
     HTMLDocument6_QueryInterface,
     HTMLDocument6_AddRef,
@@ -439,5 +440,5 @@ static const IHTMLDocument6Vtbl HTMLDocument6Vtbl = {
 void HTMLDocument_HTMLDocument5_Init(HTMLDocument *This)
 {
     This->IHTMLDocument5_iface.lpVtbl = &HTMLDocument5Vtbl;
-    This->lpHTMLDocument6Vtbl = &HTMLDocument6Vtbl;
+    This->IHTMLDocument6_iface.lpVtbl = &HTMLDocument6Vtbl;
 }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index d868cf7..e83ba7b 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -346,7 +346,7 @@ struct HTMLDocument {
     IHTMLDocument3              IHTMLDocument3_iface;
     IHTMLDocument4              IHTMLDocument4_iface;
     IHTMLDocument5              IHTMLDocument5_iface;
-    const IHTMLDocument6Vtbl              *lpHTMLDocument6Vtbl;
+    IHTMLDocument6              IHTMLDocument6_iface;
     const IPersistMonikerVtbl             *lpPersistMonikerVtbl;
     const IPersistFileVtbl                *lpPersistFileVtbl;
     const IPersistHistoryVtbl             *lpPersistHistoryVtbl;
@@ -626,7 +626,6 @@ struct HTMLDocumentNode {
 #define HTMLWINDOW3(x)   ((IHTMLWindow3*)                 &(x)->lpHTMLWindow3Vtbl)
 #define HTMLWINDOW4(x)   ((IHTMLWindow4*)                 &(x)->lpHTMLWindow4Vtbl)
 
-#define HTMLDOC6(x)      ((IHTMLDocument6*)               &(x)->lpHTMLDocument6Vtbl)
 #define PERSIST(x)       ((IPersist*)                     &(x)->lpPersistFileVtbl)
 #define PERSISTMON(x)    ((IPersistMoniker*)              &(x)->lpPersistMonikerVtbl)
 #define PERSISTFILE(x)   ((IPersistFile*)                 &(x)->lpPersistFileVtbl)
-- 
1.7.2.3



More information about the wine-patches mailing list