mshtml: Use IUriBuilder for nsIURI::SetPath implementation.

This commit is contained in:
Jacek Caban 2010-11-14 14:41:00 +01:00 committed by Alexandre Julliard
parent e21115187e
commit 3f383bac3b
1 changed files with 15 additions and 20 deletions

View File

@ -1986,32 +1986,27 @@ static nsresult NSAPI nsURI_GetPath(nsIURL *iface, nsACString *aPath)
static nsresult NSAPI nsURI_SetPath(nsIURL *iface, const nsACString *aPath) static nsresult NSAPI nsURI_SetPath(nsIURL *iface, const nsACString *aPath)
{ {
nsWineURI *This = NSURI_THIS(iface); nsWineURI *This = NSURI_THIS(iface);
const char *path; const char *patha;
WCHAR *path;
HRESULT hres;
TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aPath)); TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aPath));
invalidate_uri(This); if(!ensure_uri_builder(This))
return NS_ERROR_UNEXPECTED;
nsACString_GetData(aPath, &path); nsACString_GetData(aPath, &patha);
if(This->wine_url) { path = heap_strdupAtoW(patha);
WCHAR new_url[INTERNET_MAX_URL_LENGTH]; if(!path)
DWORD size = sizeof(new_url)/sizeof(WCHAR); return NS_ERROR_OUT_OF_MEMORY;
LPWSTR pathw;
HRESULT hres;
pathw = heap_strdupAtoW(path); hres = IUriBuilder_SetPath(This->uri_builder, path);
hres = UrlCombineW(This->wine_url, pathw, new_url, &size, 0); heap_free(path);
heap_free(pathw); if(FAILED(hres))
if(SUCCEEDED(hres)) return NS_ERROR_UNEXPECTED;
set_wine_url(This, new_url);
else
WARN("UrlCombine failed: %08x\n", hres);
}
if(!This->nsuri) sync_wine_url(This);
return NS_OK; return NS_OK;
return nsIURI_SetPath(This->nsuri, aPath);
} }
static nsresult NSAPI nsURI_Equals(nsIURL *iface, nsIURI *other, PRBool *_retval) static nsresult NSAPI nsURI_Equals(nsIURL *iface, nsIURI *other, PRBool *_retval)