Jacek Caban : mshtml: Added nsIURI::GetHostPort implementation.

Alexandre Julliard julliard at winehq.org
Tue Sep 28 11:13:40 CDT 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Sep 28 13:26:01 2010 +0200

mshtml: Added nsIURI::GetHostPort implementation.

---

 dlls/mshtml/nsio.c |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index bc377cf..64c5696 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -1837,14 +1837,38 @@ static nsresult NSAPI nsURI_SetPassword(nsIURL *iface, const nsACString *aPasswo
 static nsresult NSAPI nsURI_GetHostPort(nsIURL *iface, nsACString *aHostPort)
 {
     nsWineURI *This = NSURI_THIS(iface);
+    const WCHAR *ptr;
+    char *vala;
+    BSTR val;
+    HRESULT hres;
 
     TRACE("(%p)->(%p)\n", This, aHostPort);
 
     if(This->nsuri)
         return nsIURI_GetHostPort(This->nsuri, aHostPort);
 
-    FIXME("default action not implemented\n");
-    return NS_ERROR_NOT_IMPLEMENTED;
+    if(!ensure_uri(This))
+        return NS_ERROR_UNEXPECTED;
+
+    hres = IUri_GetAuthority(This->uri, &val);
+    if(FAILED(hres)) {
+        WARN("GetAuthority failed: %08x\n", hres);
+        return NS_ERROR_UNEXPECTED;
+    }
+
+    ptr = strchrW(val, '@');
+    if(!ptr)
+        ptr = val;
+
+    vala = heap_strdupWtoA(ptr);
+    SysFreeString(val);
+    if(!vala)
+        return NS_ERROR_OUT_OF_MEMORY;
+
+    TRACE("ret %s\n", debugstr_a(vala));
+    nsACString_SetData(aHostPort, vala);
+    heap_free(vala);
+    return NS_OK;
 }
 
 static nsresult NSAPI nsURI_SetHostPort(nsIURL *iface, const nsACString *aHostPort)




More information about the wine-cvs mailing list