Michael Stefaniuc : mshtml: COM cleanup for the IObjectWithSite iface.

Alexandre Julliard julliard at winehq.org
Mon Dec 27 10:03:56 CST 2010


Module: wine
Branch: master
Commit: b574f2fd9157e365ab77ee3011351dfd6e55105e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b574f2fd9157e365ab77ee3011351dfd6e55105e

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Mon Dec 27 01:49:48 2010 +0100

mshtml: COM cleanup for the IObjectWithSite iface.

---

 dlls/mshtml/htmldoc.c        |    2 +-
 dlls/mshtml/mshtml_private.h |    5 ++---
 dlls/mshtml/oleobj.c         |   19 ++++++++++---------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 466fc05..7fab469 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1821,7 +1821,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
         *ppv = NULL;
     }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
         TRACE("(%p)->(IID_IObjectWithSite %p)\n", This, ppv);
-        *ppv = OBJSITE(This);
+        *ppv = &This->IObjectWithSite_iface;
     }else if(IsEqualGUID(&IID_IOleContainer, riid)) {
         TRACE("(%p)->(IID_IOleContainer %p)\n", This, ppv);
         *ppv = &This->IOleContainer_iface;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 355c325..fa762ec 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -364,8 +364,8 @@ struct HTMLDocument {
     IPersistStreamInit          IPersistStreamInit_iface;
     const IDispatchExVtbl                 *lpIDispatchExVtbl;
     ISupportErrorInfo           ISupportErrorInfo_iface;
-    const IObjectWithSiteVtbl             *lpObjectWithSiteVtbl;
-    IOleContainer    IOleContainer_iface;
+    IObjectWithSite             IObjectWithSite_iface;
+    IOleContainer               IOleContainer_iface;
 
     IUnknown *unk_impl;
     IDispatchEx *dispex;
@@ -627,7 +627,6 @@ struct HTMLDocumentNode {
 #define HTMLWINDOW4(x)   ((IHTMLWindow4*)                 &(x)->lpHTMLWindow4Vtbl)
 #define CONPTCONT(x)     ((IConnectionPointContainer*)    &(x)->lpConnectionPointContainerVtbl)
 #define CUSTOMDOC(x)     ((ICustomDoc*)                   &(x)->lpCustomDocVtbl)
-#define OBJSITE(x)       ((IObjectWithSite*)              &(x)->lpObjectWithSiteVtbl)
 
 #define NSWBCHROME(x)    ((nsIWebBrowserChrome*)          &(x)->lpWebBrowserChromeVtbl)
 #define NSCML(x)         ((nsIContextMenuListener*)       &(x)->lpContextMenuListenerVtbl)
diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index 2aa30f1..91bf9ef 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -757,42 +757,43 @@ static const IOleControlVtbl OleControlVtbl = {
  * IObjectWithSite implementation
  */
 
-#define OBJSITE_THIS(iface) DEFINE_THIS(HTMLDocument, ObjectWithSite, iface)
+static inline HTMLDocument *impl_from_IObjectWithSite(IObjectWithSite *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLDocument, IObjectWithSite_iface);
+}
 
 static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppv)
 {
-    HTMLDocument *This = OBJSITE_THIS(iface);
+    HTMLDocument *This = impl_from_IObjectWithSite(iface);
     return htmldoc_query_interface(This, riid, ppv);
 }
 
 static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
 {
-    HTMLDocument *This = OBJSITE_THIS(iface);
+    HTMLDocument *This = impl_from_IObjectWithSite(iface);
     return htmldoc_addref(This);
 }
 
 static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
 {
-    HTMLDocument *This = OBJSITE_THIS(iface);
+    HTMLDocument *This = impl_from_IObjectWithSite(iface);
     return htmldoc_release(This);
 }
 
 static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *pUnkSite)
 {
-    HTMLDocument *This = OBJSITE_THIS(iface);
+    HTMLDocument *This = impl_from_IObjectWithSite(iface);
     FIXME("(%p)->(%p)\n", This, pUnkSite);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite* iface, REFIID riid, PVOID *ppvSite)
 {
-    HTMLDocument *This = OBJSITE_THIS(iface);
+    HTMLDocument *This = impl_from_IObjectWithSite(iface);
     FIXME("(%p)->(%p)\n", This, ppvSite);
     return E_NOTIMPL;
 }
 
-#undef OBJSITE_THIS
-
 static const IObjectWithSiteVtbl ObjectWithSiteVtbl = {
     ObjectWithSite_QueryInterface,
     ObjectWithSite_AddRef,
@@ -876,6 +877,6 @@ void HTMLDocument_OleObj_Init(HTMLDocument *This)
     This->IOleObject_iface.lpVtbl = &OleObjectVtbl;
     This->IOleDocument_iface.lpVtbl = &OleDocumentVtbl;
     This->IOleControl_iface.lpVtbl = &OleControlVtbl;
-    This->lpObjectWithSiteVtbl = &ObjectWithSiteVtbl;
+    This->IObjectWithSite_iface.lpVtbl = &ObjectWithSiteVtbl;
     This->IOleContainer_iface.lpVtbl = &OleContainerVtbl;
 }




More information about the wine-cvs mailing list