Jacek Caban : mshtml: Use IUri for IHTMLLocation:: get_hostname implementation.

Alexandre Julliard julliard at winehq.org
Wed Nov 23 13:40:07 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Nov 23 15:30:06 2011 +0100

mshtml: Use IUri for IHTMLLocation::get_hostname implementation.

---

 dlls/mshtml/htmllocation.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index cf591d7..b3354f0 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -359,7 +359,7 @@ static HRESULT WINAPI HTMLLocation_put_hostname(IHTMLLocation *iface, BSTR v)
 static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p)
 {
     HTMLLocation *This = impl_from_IHTMLLocation(iface);
-    URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)};
+    BSTR hostname;
     HRESULT hres;
 
     TRACE("(%p)->(%p)\n", This, p);
@@ -367,19 +367,21 @@ static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p)
     if(!p)
         return E_POINTER;
 
-    url.dwHostNameLength = 1;
-    hres = get_url_components(This, &url);
-    if(FAILED(hres))
-        return hres;
+    if(!This->window || !This->window->uri) {
+        FIXME("No current URI\n");
+        return E_NOTIMPL;
+    }
 
-    if(!url.dwHostNameLength){
+    hres = IUri_GetHost(This->window->uri, &hostname);
+    if(hres == S_OK) {
+        *p = hostname;
+    }else if(hres == S_FALSE) {
+        SysFreeString(hostname);
         *p = NULL;
-        return S_OK;
+    }else {
+        return hres;
     }
 
-    *p = SysAllocStringLen(url.lpszHostName, url.dwHostNameLength);
-    if(!*p)
-        return E_OUTOFMEMORY;
     return S_OK;
 }
 




More information about the wine-cvs mailing list