From 8310bd532802ff2a18d44e4492b33659cc3c7342 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 3 Jan 2005 17:08:40 +0000 Subject: [PATCH] Implement and test URLIS_URL flag in UrlIs(). --- dlls/shlwapi/tests/path.c | 17 ++++++++++++++++- dlls/shlwapi/url.c | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dlls/shlwapi/tests/path.c b/dlls/shlwapi/tests/path.c index d526338a65a..ad5461f1e60 100644 --- a/dlls/shlwapi/tests/path.c +++ b/dlls/shlwapi/tests/path.c @@ -235,7 +235,8 @@ struct { {"http://foo/bar", TRUE}, {"c:\\foo\\bar", FALSE}, {"foo://foo/bar", TRUE}, - {"foo\\bar", FALSE} + {"foo\\bar", FALSE}, + {"foo.bar", FALSE} }; static LPWSTR GetWideString(const char* szString) @@ -472,6 +473,19 @@ static void test_UrlCreateFromPath(void) } } +static void test_UrlIs(void) +{ + BOOL ret; + INT i; + + for(i = 0; i < sizeof(TEST_PATH_IS_URL) / sizeof(TEST_PATH_IS_URL[0]); i++) { + ret = UrlIsA( TEST_PATH_IS_URL[i].path, URLIS_URL ); + ok( ret == TEST_PATH_IS_URL[i].expect, + "returned %d from path %s, expected %d\n", ret, TEST_PATH_IS_URL[i].path, + TEST_PATH_IS_URL[i].expect ); + } +} + static void test_UrlUnescape(void) { CHAR szReturnUrl[INTERNET_MAX_URL_LENGTH]; @@ -600,6 +614,7 @@ START_TEST(path) test_UrlEscape(); test_UrlCombine(); test_UrlCreateFromPath(); + test_UrlIs(); test_UrlUnescape(); test_PathSearchAndQualify(); diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c index e156338864f..c05cfae52e5 100644 --- a/dlls/shlwapi/url.c +++ b/dlls/shlwapi/url.c @@ -1632,6 +1632,8 @@ BOOL WINAPI UrlIsA(LPCSTR pszUrl, URLIS Urlis) DWORD res1; LPCSTR last; + TRACE("(%s %d)\n", debugstr_a(pszUrl), Urlis); + switch (Urlis) { case URLIS_OPAQUE: @@ -1651,6 +1653,8 @@ BOOL WINAPI UrlIsA(LPCSTR pszUrl, URLIS Urlis) return (last >= pszUrl && (*last == '/' || *last == '\\' )); case URLIS_URL: + return PathIsURLA(pszUrl); + case URLIS_NOHISTORY: case URLIS_APPLIABLE: case URLIS_HASQUERY: @@ -1672,6 +1676,8 @@ BOOL WINAPI UrlIsW(LPCWSTR pszUrl, URLIS Urlis) DWORD res1; LPCWSTR last; + TRACE("(%s %d)\n", debugstr_w(pszUrl), Urlis); + switch (Urlis) { case URLIS_OPAQUE: @@ -1691,6 +1697,8 @@ BOOL WINAPI UrlIsW(LPCWSTR pszUrl, URLIS Urlis) return (last >= pszUrl && (*last == '/' || *last == '\\')); case URLIS_URL: + return PathIsURLW(pszUrl); + case URLIS_NOHISTORY: case URLIS_APPLIABLE: case URLIS_HASQUERY: