Jacek Caban : mshtml: Use IURi for IHTMLLocation::get_hash implementation.

Alexandre Julliard julliard at winehq.org
Wed Dec 28 13:44:34 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Dec 28 13:09:51 2011 +0100

mshtml: Use IURi for IHTMLLocation::get_hash implementation.

---

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

diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index b3354f0..cd24f12 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -504,9 +504,7 @@ static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v)
 static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
 {
     HTMLLocation *This = impl_from_IHTMLLocation(iface);
-    URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)};
-    const WCHAR hash[] = {'#',0};
-    DWORD hash_pos = 0;
+    BSTR hash;
     HRESULT hres;
 
     TRACE("(%p)->(%p)\n", This, p);
@@ -514,23 +512,21 @@ static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p)
     if(!p)
         return E_POINTER;
 
-    url.dwExtraInfoLength = 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.dwExtraInfoLength){
+    hres = IUri_GetFragment(This->window->uri, &hash);
+    if(hres == S_OK) {
+        *p = hash;
+    }else if(hres == S_FALSE) {
+        SysFreeString(hash);
         *p = NULL;
-        return S_OK;
+    }else {
+        return hres;
     }
 
-    hash_pos = strcspnW(url.lpszExtraInfo, hash);
-    url.dwExtraInfoLength -= hash_pos;
-
-    *p = SysAllocStringLen(url.lpszExtraInfo + hash_pos, url.dwExtraInfoLength);
-
-    if(!*p)
-        return E_OUTOFMEMORY;
     return S_OK;
 }
 




More information about the wine-cvs mailing list