Jacek Caban : mshtml: Use a helper function for QueryService calls in hlink_frame_navigate.

Alexandre Julliard julliard at winehq.org
Thu Jan 5 15:24:43 CST 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jan  5 18:30:27 2012 +0100

mshtml: Use a helper function for QueryService calls in hlink_frame_navigate.

---

 dlls/mshtml/main.c           |   14 ++++++++++++++
 dlls/mshtml/mshtml_private.h |    2 ++
 dlls/mshtml/navigate.c       |    9 +--------
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/dlls/mshtml/main.c b/dlls/mshtml/main.c
index a00c274..e82e8e2 100644
--- a/dlls/mshtml/main.c
+++ b/dlls/mshtml/main.c
@@ -125,6 +125,20 @@ void set_statustext(HTMLDocumentObj* doc, INT id, LPCWSTR arg)
         heap_free(p);
 }
 
+HRESULT do_query_service(IUnknown *unk, REFGUID guid_service, REFIID riid, void **ppv)
+{
+    IServiceProvider *sp;
+    HRESULT hres;
+
+    hres = IUnknown_QueryInterface(unk, &IID_IServiceProvider, (void**)&sp);
+    if(FAILED(hres))
+        return hres;
+
+    hres = IServiceProvider_QueryService(sp, guid_service, riid, ppv);
+    IServiceProvider_Release(sp);
+    return hres;
+}
+
 HINSTANCE get_shdoclc(void)
 {
     static const WCHAR wszShdoclc[] =
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 8ca248a..0c6d73f 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -828,6 +828,8 @@ void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
 
+HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
+
 /* editor */
 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 9556a00..bfee591 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -1981,7 +1981,6 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url, nsChannel *nschanne
 {
     IHlinkFrame *hlink_frame;
     nsChannelBSC *callback;
-    IServiceProvider *sp;
     IBindCtx *bindctx;
     IMoniker *mon;
     IHlink *hlink;
@@ -1989,14 +1988,8 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url, nsChannel *nschanne
 
     *cancel = FALSE;
 
-    hres = IOleClientSite_QueryInterface(doc->doc_obj->client, &IID_IServiceProvider,
-            (void**)&sp);
-    if(FAILED(hres))
-        return S_OK;
-
-    hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame,
+    hres = do_query_service((IUnknown*)doc->doc_obj->client, &IID_IHlinkFrame, &IID_IHlinkFrame,
             (void**)&hlink_frame);
-    IServiceProvider_Release(sp);
     if(FAILED(hres))
         return S_OK;
 




More information about the wine-cvs mailing list