Jacek Caban : mshtml: Use IUri in IHTMLLocation::put_port implementation.

Alexandre Julliard julliard at winehq.org
Fri Dec 30 10:27:04 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Dec 30 12:23:41 2011 +0100

mshtml: Use IUri in IHTMLLocation::put_port implementation.

---

 dlls/mshtml/htmllocation.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index b5d6b5e..e386d17 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -402,7 +402,7 @@ static HRESULT WINAPI HTMLLocation_put_port(IHTMLLocation *iface, BSTR v)
 static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
 {
     HTMLLocation *This = impl_from_IHTMLLocation(iface);
-    URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)};
+    DWORD port;
     HRESULT hres;
 
     TRACE("(%p)->(%p)\n", This, p);
@@ -410,18 +410,23 @@ static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
     if(!p)
         return E_POINTER;
 
-    hres = get_url_components(This, &url);
+    if(!This->window || !This->window->uri) {
+        FIXME("No current URI\n");
+        return E_NOTIMPL;
+    }
+
+    hres = IUri_GetPort(This->window->uri, &port);
     if(FAILED(hres))
         return hres;
 
-    if(url.nPort) {
-        const WCHAR format[] = {'%','u',0};
-        WCHAR buf[6];
-        snprintfW(buf, 6, format, url.nPort);
+    if(hres == S_OK) {
+        static const WCHAR formatW[] = {'%','u',0};
+        WCHAR buf[12];
+
+        sprintfW(buf, formatW, port);
         *p = SysAllocString(buf);
     }else {
-        const WCHAR empty[] = {0};
-        *p = SysAllocString(empty);
+        *p = SysAllocStringLen(NULL, 0);
     }
 
     if(!*p)




More information about the wine-cvs mailing list