MSHTML: THIS macros clean up

Jacek Caban jack at itma.pwr.wroc.pl
Tue Jun 28 15:58:20 CDT 2005


This patch makes no progress, but it's
nice code clean up and it makes reading
logs easier.

Changelog:
    THIS macros clean up
-------------- next part --------------
Index: dlls/mshtml/oleobj.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/oleobj.c,v
retrieving revision 1.6
diff -u -p -r1.6 oleobj.c
--- dlls/mshtml/oleobj.c	28 Jun 2005 10:53:42 -0000	1.6
+++ dlls/mshtml/oleobj.c	28 Jun 2005 20:51:45 -0000
@@ -41,8 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
  * IOleObject implementation
  */
 
-#define OLEOBJ_THIS \
-    HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleObjectVtbl));
+#define OLEOBJ_THIS DEFINE_THIS(HTMLDocument, OleObject)
 
 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppvObject)
 {
@@ -266,6 +265,8 @@ static HRESULT WINAPI OleObject_SetColor
     return E_NOTIMPL;
 }
 
+#undef OLEOBJ_THIS
+
 static const IOleObjectVtbl OleObjectVtbl = {
     OleObject_QueryInterface,
     OleObject_AddRef,
@@ -297,8 +298,7 @@ static const IOleObjectVtbl OleObjectVtb
  * IOleDocument implementation
  */
 
-#define OLEDOC_THIS \
-    HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleDocumentVtbl));
+#define OLEDOC_THIS DEFINE_THIS(HTMLDocument, OleDocument)
 
 static HRESULT WINAPI OleDocument_QueryInterface(IOleDocument *iface, REFIID riid, void **ppvObject)
 {
@@ -364,6 +364,8 @@ static HRESULT WINAPI OleDocument_EnumVi
     FIXME("(%p)->(%p %p)\n", This, ppEnum, ppView);
     return E_NOTIMPL;
 }
+
+#undef OLEDOC_THIS
 
 static const IOleDocumentVtbl OleDocumentVtbl = {
     OleDocument_QueryInterface,
Index: dlls/mshtml/persist.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/persist.c,v
retrieving revision 1.3
diff -u -p -r1.3 persist.c
--- dlls/mshtml/persist.c	1 Jun 2005 19:57:42 -0000	1.3
+++ dlls/mshtml/persist.c	28 Jun 2005 20:51:45 -0000
@@ -41,8 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
  * IPersistMoniker implementation
  */
 
-#define PERSISTMON_THIS \
-    HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpPersistMonikerVtbl));
+#define PERSISTMON_THIS DEFINE_THIS(HTMLDocument, PersistMoniker)
 
 static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid,
                                                             void **ppvObject)
@@ -78,29 +77,35 @@ static HRESULT WINAPI PersistMoniker_IsD
 static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable,
         IMoniker *pimkName, LPBC pibc, DWORD grfMode)
 {
-    FIXME("(%p)->(%x %p %p %08lx)\n", iface, fFullyAvailable, pimkName, pibc, grfMode);
+    PERSISTMON_THIS
+    FIXME("(%p)->(%x %p %p %08lx)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
     return S_OK;
 }
 
 static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName,
         LPBC pbc, BOOL fRemember)
 {
-    FIXME("(%p)->(%p %p %x)\n", iface, pimkName, pbc, fRemember);
+    PERSISTMON_THIS
+    FIXME("(%p)->(%p %p %x)\n", This, pimkName, pbc, fRemember);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc)
 {
-    FIXME("(%p)->(%p %p)\n", iface, pimkName, pibc);
+    PERSISTMON_THIS
+    FIXME("(%p)->(%p %p)\n", This, pimkName, pibc);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName)
 {
-    FIXME("(%p)->(%p)\n", iface, ppimkName);
+    PERSISTMON_THIS
+    FIXME("(%p)->(%p)\n", This, ppimkName);
     return E_NOTIMPL;
 }
 
+#undef PERSISTMON_THIS
+
 static const IPersistMonikerVtbl PersistMonikerVtbl = {
     PersistMoniker_QueryInterface,
     PersistMoniker_AddRef,
@@ -117,8 +122,7 @@ static const IPersistMonikerVtbl Persist
  * IMonikerProp implementation
  */
 
-#define MONPROP_THIS \
-    HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpMonikerPropVtbl));
+#define MONPROP_THIS DEFINE_THIS(HTMLDocument, MonikerProp)
 
 static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppvObject)
 {
@@ -140,10 +144,13 @@ static ULONG WINAPI MonikerProp_Release(
 
 static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val)
 {
-    FIXME("(%p)->(%d %s)\n", iface, mkp, debugstr_w(val));
+    MONPROP_THIS
+    FIXME("(%p)->(%d %s)\n", This, mkp, debugstr_w(val));
     return E_NOTIMPL;
 }
 
+#undef MONPROP_THIS
+
 static const IMonikerPropVtbl MonikerPropVtbl = {
     MonikerProp_QueryInterface,
     MonikerProp_AddRef,
@@ -155,8 +162,7 @@ static const IMonikerPropVtbl MonikerPro
  * IPersistFile implementation
  */
 
-#define PERSISTFILE_THIS \
-        HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpPersistFileVtbl));
+#define PERSISTFILE_THIS DEFINE_THIS(HTMLDocument, PersistFile)
 
 static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppvObject)
 {
@@ -178,7 +184,9 @@ static ULONG WINAPI PersistFile_Release(
 
 static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID)
 {
-    TRACE("(%p)->(%p)\n", iface, pClassID);
+    PERSISTFILE_THIS
+
+    TRACE("(%p)->(%p)\n", This, pClassID);
 
     if(!pClassID)
         return E_INVALIDARG;
@@ -189,33 +197,40 @@ static HRESULT WINAPI PersistFile_GetCla
 
 static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface)
 {
-    FIXME("(%p)\n", iface);
+    PERSISTFILE_THIS
+    FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
 {
-    FIXME("(%p)->(%s %08lx)\n", iface, debugstr_w(pszFileName), dwMode);
+    PERSISTFILE_THIS
+    FIXME("(%p)->(%s %08lx)\n", This, debugstr_w(pszFileName), dwMode);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
 {
-    FIXME("(%p)->(%s %x)\n", iface, debugstr_w(pszFileName), fRemember);
+    PERSISTFILE_THIS
+    FIXME("(%p)->(%s %x)\n", This, debugstr_w(pszFileName), fRemember);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
 {
-    FIXME("(%p)->(%s)\n", iface, debugstr_w(pszFileName));
+    PERSISTFILE_THIS
+    FIXME("(%p)->(%s)\n", This, debugstr_w(pszFileName));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName)
 {
-    FIXME("(%p)->(%p)\n", iface, pszFileName);
+    PERSISTFILE_THIS
+    FIXME("(%p)->(%p)\n", This, pszFileName);
     return E_NOTIMPL;
 }
+
+#undef PERSISTFILE_THIS
 
 static const IPersistFileVtbl PersistFileVtbl = {
     PersistFile_QueryInterface,
Index: dlls/mshtml/protocol.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/protocol.c,v
retrieving revision 1.1
diff -u -p -r1.1 protocol.c
--- dlls/mshtml/protocol.c	27 Jun 2005 09:50:56 -0000	1.1
+++ dlls/mshtml/protocol.c	28 Jun 2005 20:51:45 -0000
@@ -49,9 +49,7 @@ typedef struct {
     const IClassFactoryVtbl         *lpClassFactoryVtbl;
 } ProtocolFactory;
 
-#define PROTOCOLINFO_THIS \
-        ProtocolFactory* const This= \
-            (ProtocolFactory*)((BYTE*)(iface)-offsetof(ProtocolFactory,lpInternetProtocolInfoVtbl));
+#define PROTOCOLINFO_THIS DEFINE_THIS(ProtocolFactory, InternetProtocolInfo)
 
 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv)
 {
@@ -80,19 +78,21 @@ static HRESULT WINAPI InternetProtocolIn
 
 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
 {
-    TRACE("(%p)\n", iface);
+    PROTOCOLINFO_THIS
+    TRACE("(%p)\n", This);
     return 2;
 }
 
 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
 {
-    TRACE("(%p)\n", iface);
+    PROTOCOLINFO_THIS
+    TRACE("(%p)\n", This);
     return 1;
 }
 
-#define CLASSFACTORY_THIS \
-    ProtocolFactory* const This= \
-        (ProtocolFactory*)((BYTE*)(iface)-offsetof(ProtocolFactory,lpClassFactoryVtbl));
+#undef PROTOCOLINFO_THIS
+
+#define CLASSFACTORY_THIS DEFINE_THIS(ProtocolFactory, ClassFactory)
 
 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
 {
@@ -114,9 +114,12 @@ static ULONG WINAPI ClassFactory_Release
 
 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
 {
-    FIXME("(%p)->(%x)\n", iface, dolock);
+    CLASSFACTORY_THIS
+    FIXME("(%p)->(%x)\n", This, dolock);
     return S_OK;
 }
+
+#undef CLASSFACTORY_THIS
 
 /********************************************************************
  * AboutProtocol implementation
Index: dlls/mshtml/view.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/view.c,v
retrieving revision 1.6
diff -u -p -r1.6 view.c
--- dlls/mshtml/view.c	23 Jun 2005 16:44:43 -0000	1.6
+++ dlls/mshtml/view.c	28 Jun 2005 20:51:45 -0000
@@ -95,8 +95,7 @@ static void register_serverwnd_class(voi
  * IOleDocumentView implementation
  */
 
-#define DOCVIEW_THIS \
-        HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleDocumentViewVtbl));
+#define DOCVIEW_THIS DEFINE_THIS(HTMLDocument, OleDocumentView)
 
 static HRESULT WINAPI OleDocumentView_QueryInterface(IOleDocumentView *iface, REFIID riid, void **ppvObject)
 {
@@ -355,6 +354,8 @@ static HRESULT WINAPI OleDocumentView_Cl
     return E_NOTIMPL;
 }
 
+#undef DOCVIEW_THIS
+
 static const IOleDocumentViewVtbl OleDocumentViewVtbl = {
     OleDocumentView_QueryInterface,
     OleDocumentView_AddRef,
@@ -378,8 +379,7 @@ static const IOleDocumentViewVtbl OleDoc
  * IViewObject implementation
  */
 
-#define VIEWOBJ_THIS \
-    HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpViewObject2Vtbl));
+#define VIEWOBJ_THIS DEFINE_THIS(HTMLDocument, ViewObject2)
 
 static HRESULT WINAPI ViewObject_QueryInterface(IViewObject2 *iface, REFIID riid, void **ppvObject)
 {
@@ -453,6 +453,8 @@ static HRESULT WINAPI ViewObject_GetExte
     FIXME("(%p)->(%ld %ld %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
     return E_NOTIMPL;
 }
+
+#undef VIEWOBJ_THIS
 
 static const IViewObject2Vtbl ViewObjectVtbl = {
     ViewObject_QueryInterface,


More information about the wine-patches mailing list