From dfeec5a2bf834ed2e6cc346973ba11d8923a978c Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 28 Dec 2011 13:09:51 +0100 Subject: [PATCH] mshtml: Use IURi for IHTMLLocation::get_hash implementation. --- dlls/mshtml/htmllocation.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index b3354f07f16..cd24f12058f 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(!url.dwExtraInfoLength){ - *p = NULL; - return S_OK; + if(!This->window || !This->window->uri) { + FIXME("No current URI\n"); + return E_NOTIMPL; } - hash_pos = strcspnW(url.lpszExtraInfo, hash); - url.dwExtraInfoLength -= hash_pos; + hres = IUri_GetFragment(This->window->uri, &hash); + if(hres == S_OK) { + *p = hash; + }else if(hres == S_FALSE) { + SysFreeString(hash); + *p = NULL; + }else { + return hres; + } - *p = SysAllocStringLen(url.lpszExtraInfo + hash_pos, url.dwExtraInfoLength); - - if(!*p) - return E_OUTOFMEMORY; return S_OK; }