Andrew Eikum : mshtml: Implement IHTMLLocation::get_port.

Alexandre Julliard julliard at winehq.org
Thu Oct 15 08:54:28 CDT 2009


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Wed Oct 14 16:33:37 2009 -0500

mshtml: Implement IHTMLLocation::get_port.

---

 dlls/mshtml/htmllocation.c       |   23 +++++++++++++++++++++--
 dlls/mshtml/tests/htmllocation.c |   12 ++++++------
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index 4769f03..e86cee6 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -245,12 +245,31 @@ static HRESULT WINAPI HTMLLocation_put_port(IHTMLLocation *iface, BSTR v)
 static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p)
 {
     HTMLLocation *This = HTMLLOCATION_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
+    URL_COMPONENTSW url = {sizeof(URL_COMPONENTSW)};
+    HRESULT hres;
+
+    TRACE("(%p)->(%p)\n", This, p);
 
     if(!p)
         return E_POINTER;
 
-    return E_NOTIMPL;
+    hres = get_url_components(This, &url);
+    if(FAILED(hres))
+        return hres;
+
+    if(url.nPort) {
+        const WCHAR format[] = {'%','d',0};
+        WCHAR buf[6];
+        snprintfW(buf, 6, format, url.nPort);
+        *p = SysAllocString(buf);
+    }else {
+        const WCHAR empty[] = {0};
+        *p = SysAllocString(empty);
+    }
+
+    if(!*p)
+        return E_OUTOFMEMORY;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLLocation_put_pathname(IHTMLLocation *iface, BSTR v)
diff --git a/dlls/mshtml/tests/htmllocation.c b/dlls/mshtml/tests/htmllocation.c
index c245707..e271f00 100644
--- a/dlls/mshtml/tests/htmllocation.c
+++ b/dlls/mshtml/tests/htmllocation.c
@@ -60,7 +60,7 @@ static const struct location_test http_test = {
             "http:", FALSE,
             "www.winehq.org:80", FALSE,
             "www.winehq.org", FALSE,
-            "80", FALSE,
+            "80", TRUE,
             "", FALSE,
             "?search", FALSE,
             "#hash", FALSE
@@ -74,7 +74,7 @@ static const struct location_test http_file_test = {
             "http:", FALSE,
             "www.winehq.org:80", FALSE,
             "www.winehq.org", FALSE,
-            "80", FALSE,
+            "80", TRUE,
             "file", FALSE,
             "?search", FALSE,
             "#hash", FALSE
@@ -88,7 +88,7 @@ static const struct location_test ftp_test = {
             "ftp:", FALSE,
             "ftp.winehq.org:21", FALSE,
             "ftp.winehq.org", FALSE,
-            "21", FALSE,
+            "21", TRUE,
             "", FALSE,
             NULL, FALSE,
             NULL, FALSE
@@ -102,7 +102,7 @@ static const struct location_test ftp_file_test = {
             "ftp:", FALSE,
             "ftp.winehq.org:21", FALSE,
             "ftp.winehq.org", FALSE,
-            "21", FALSE,
+            "21", TRUE,
             "file", FALSE,
             NULL, FALSE,
             NULL, FALSE
@@ -116,7 +116,7 @@ static const struct location_test file_test = {
             "file:", FALSE,
             NULL, FALSE,
             NULL, FALSE,
-            "", FALSE,
+            "", TRUE,
             "C:\\windows\\win.ini", TRUE,
             NULL, FALSE,
             NULL, FALSE
@@ -243,7 +243,7 @@ static void test_port(IHTMLLocation *loc, const struct location_test *test)
             test->name, E_POINTER, hres);
 
     hres = IHTMLLocation_get_port(loc, &str);
-    todo_wine ok(hres == S_OK, "%s: get_port failed: 0x%08x\n", test->name, hres);
+    ok(hres == S_OK, "%s: get_port failed: 0x%08x\n", test->name, hres);
     if(hres == S_OK){
         if(test->port_ok)
             ok(str_eq_wa(str, test->port),




More information about the wine-cvs mailing list