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

Alexandre Julliard julliard at winehq.org
Thu Dec 23 11:28:04 CST 2010


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Thu Dec 23 02:17:39 2010 +0100

mshtml: COM cleanup for the IOleDocument iface.

---

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

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 0c0fb0a..c0aef86 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1746,7 +1746,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
         *ppv = &This->IOleObject_iface;
     }else if(IsEqualGUID(&IID_IOleDocument, riid)) {
         TRACE("(%p)->(IID_IOleDocument, %p)\n", This, ppv);
-        *ppv = OLEDOC(This);
+        *ppv = &This->IOleDocument_iface;
     }else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
         TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppv);
         *ppv = DOCVIEW(This);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 381939e..fa92722 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -352,7 +352,7 @@ struct HTMLDocument {
     IPersistHistory             IPersistHistory_iface;
     IMonikerProp                IMonikerProp_iface;
     IOleObject                  IOleObject_iface;
-    const IOleDocumentVtbl                *lpOleDocumentVtbl;
+    IOleDocument                IOleDocument_iface;
     const IOleDocumentViewVtbl            *lpOleDocumentViewVtbl;
     const IOleInPlaceActiveObjectVtbl     *lpOleInPlaceActiveObjectVtbl;
     const IViewObjectExVtbl               *lpViewObjectExVtbl;
@@ -626,7 +626,6 @@ struct HTMLDocumentNode {
 #define HTMLWINDOW3(x)   ((IHTMLWindow3*)                 &(x)->lpHTMLWindow3Vtbl)
 #define HTMLWINDOW4(x)   ((IHTMLWindow4*)                 &(x)->lpHTMLWindow4Vtbl)
 
-#define OLEDOC(x)        ((IOleDocument*)                 &(x)->lpOleDocumentVtbl)
 #define DOCVIEW(x)       ((IOleDocumentView*)             &(x)->lpOleDocumentViewVtbl)
 #define OLEWIN(x)        ((IOleWindow*)                   &(x)->lpOleInPlaceActiveObjectVtbl)
 #define ACTOBJ(x)        ((IOleInPlaceActiveObject*)      &(x)->lpOleInPlaceActiveObjectVtbl)
diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index 2dafbf8..7d63f5d 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -490,30 +490,33 @@ static const IOleObjectVtbl OleObjectVtbl = {
  * IOleDocument implementation
  */
 
-#define OLEDOC_THIS(iface) DEFINE_THIS(HTMLDocument, OleDocument, iface)
+static inline HTMLDocument *impl_from_IOleDocument(IOleDocument *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLDocument, IOleDocument_iface);
+}
 
 static HRESULT WINAPI OleDocument_QueryInterface(IOleDocument *iface, REFIID riid, void **ppv)
 {
-    HTMLDocument *This = OLEDOC_THIS(iface);
+    HTMLDocument *This = impl_from_IOleDocument(iface);
     return htmldoc_query_interface(This, riid, ppv);
 }
 
 static ULONG WINAPI OleDocument_AddRef(IOleDocument *iface)
 {
-    HTMLDocument *This = OLEDOC_THIS(iface);
+    HTMLDocument *This = impl_from_IOleDocument(iface);
     return htmldoc_addref(This);
 }
 
 static ULONG WINAPI OleDocument_Release(IOleDocument *iface)
 {
-    HTMLDocument *This = OLEDOC_THIS(iface);
+    HTMLDocument *This = impl_from_IOleDocument(iface);
     return htmldoc_release(This);
 }
 
 static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSite *pIPSite, IStream *pstm,
                                    DWORD dwReserved, IOleDocumentView **ppView)
 {
-    HTMLDocument *This = OLEDOC_THIS(iface);
+    HTMLDocument *This = impl_from_IOleDocument(iface);
     HRESULT hres;
 
     TRACE("(%p)->(%p %p %d %p)\n", This, pIPSite, pstm, dwReserved, ppView);
@@ -544,7 +547,7 @@ static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSit
 
 static HRESULT WINAPI OleDocument_GetDocMiscStatus(IOleDocument *iface, DWORD *pdwStatus)
 {
-    HTMLDocument *This = OLEDOC_THIS(iface);
+    HTMLDocument *This = impl_from_IOleDocument(iface);
     FIXME("(%p)->(%p)\n", This, pdwStatus);
     return E_NOTIMPL;
 }
@@ -552,13 +555,11 @@ static HRESULT WINAPI OleDocument_GetDocMiscStatus(IOleDocument *iface, DWORD *p
 static HRESULT WINAPI OleDocument_EnumViews(IOleDocument *iface, IEnumOleDocumentViews **ppEnum,
                                    IOleDocumentView **ppView)
 {
-    HTMLDocument *This = OLEDOC_THIS(iface);
+    HTMLDocument *This = impl_from_IOleDocument(iface);
     FIXME("(%p)->(%p %p)\n", This, ppEnum, ppView);
     return E_NOTIMPL;
 }
 
-#undef OLEDOC_THIS
-
 static const IOleDocumentVtbl OleDocumentVtbl = {
     OleDocument_QueryInterface,
     OleDocument_AddRef,
@@ -871,7 +872,7 @@ void HTMLDocument_LockContainer(HTMLDocumentObj *This, BOOL fLock)
 void HTMLDocument_OleObj_Init(HTMLDocument *This)
 {
     This->IOleObject_iface.lpVtbl = &OleObjectVtbl;
-    This->lpOleDocumentVtbl = &OleDocumentVtbl;
+    This->IOleDocument_iface.lpVtbl = &OleDocumentVtbl;
     This->lpOleControlVtbl = &OleControlVtbl;
     This->lpObjectWithSiteVtbl = &ObjectWithSiteVtbl;
     This->IOleContainer_iface.lpVtbl = &OleContainerVtbl;




More information about the wine-cvs mailing list