Vincent Povirk : shlwapi: GetUrlPart can get the scheme of url's without a ://.

Alexandre Julliard julliard at winehq.org
Tue Feb 16 11:44:39 CST 2010


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Feb 15 15:09:55 2010 -0600

shlwapi: GetUrlPart can get the scheme of url's without a ://.

---

 dlls/shlwapi/tests/url.c |    7 +++++++
 dlls/shlwapi/url.c       |    3 ++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 4dd5d9c..3d86ae7 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -570,6 +570,7 @@ static void test_UrlGetPart(void)
 {
   const char* file_url = "file://h o s t/c:/windows/file";
   const char* http_url = "http://user:pass 123 at www.wine hq.org";
+  const char* about_url = "about:blank";
 
   CHAR szPart[INTERNET_MAX_URL_LENGTH];
   DWORD dwSize;
@@ -607,6 +608,12 @@ static void test_UrlGetPart(void)
   test_url_part(http_url, URL_PART_HOSTNAME, 0, "www.wine hq.org");
   test_url_part(http_url, URL_PART_PASSWORD, 0, "pass 123");
 
+  test_url_part(about_url, URL_PART_SCHEME, 0, "about");
+
+  dwSize = sizeof(szPart);
+  res = pUrlGetPartA(about_url, szPart, &dwSize, URL_PART_HOSTNAME, 0);
+  ok(res==E_FAIL, "returned %08x\n", res);
+
   dwSize = sizeof(szPart);
   res = pUrlGetPartA("file://c:\\index.htm", szPart, &dwSize, URL_PART_HOSTNAME, 0);
   ok(res==S_FALSE, "returned %08x\n", res);
diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c
index d3dea24..4a93b23 100644
--- a/dlls/shlwapi/url.c
+++ b/dlls/shlwapi/url.c
@@ -1938,7 +1938,7 @@ static LONG URL_ParseUrl(LPCWSTR pszUrl, WINE_PARSE_URL *pl)
     work = URL_ScanID(pl->pScheme, &pl->szScheme, SCHEME);
     if (!*work || (*work != ':')) goto ErrorExit;
     work++;
-    if ((*work != '/') || (*(work+1) != '/')) goto ErrorExit;
+    if ((*work != '/') || (*(work+1) != '/')) goto SuccessExit;
     pl->pUserName = work + 2;
     work = URL_ScanID(pl->pUserName, &pl->szUserName, USERPASS);
     if (*work == ':' ) {
@@ -1979,6 +1979,7 @@ static LONG URL_ParseUrl(LPCWSTR pszUrl, WINE_PARSE_URL *pl)
         pl->pQuery = strchrW(work, '?');
 	if (pl->pQuery) pl->szQuery = strlenW(pl->pQuery);
     }
+  SuccessExit:
     TRACE("parse successful: scheme=%p(%d), user=%p(%d), pass=%p(%d), host=%p(%d), port=%p(%d), query=%p(%d)\n",
 	  pl->pScheme, pl->szScheme,
 	  pl->pUserName, pl->szUserName,




More information about the wine-cvs mailing list