Jacek Caban : mshtml: Use IUriBuilder for nsIURI::SetPath implementation.

Alexandre Julliard julliard at winehq.org
Mon Nov 15 13:28:47 CST 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Nov 14 14:41:00 2010 +0100

mshtml: Use IUriBuilder for nsIURI::SetPath implementation.

---

 dlls/mshtml/nsio.c |   35 +++++++++++++++--------------------
 1 files changed, 15 insertions(+), 20 deletions(-)

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




More information about the wine-cvs mailing list