shlwapi: UrlIs()'s check for the 'file:' protocol is case insensitive.

Francois Gouget fgouget at codeweavers.com
Tue Sep 25 21:20:00 CDT 2012


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

diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index b24a277..6cef9d6 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -450,7 +450,8 @@ static const struct {
     {	"file://e:/b/c",				FALSE,	TRUE	},
     {	"http:partial",					FALSE,	FALSE	},
     {	"mailto://www.winehq.org/test.html",		TRUE,	FALSE	},
-    {	"file:partial",					FALSE,	TRUE	}
+    {	"file:partial",					FALSE,	TRUE	},
+    {	"File:partial",					FALSE,	TRUE	},
 };
 
 /* ########################### */
diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c
index f483db3..70a0b87 100644
--- a/dlls/shlwapi/url.c
+++ b/dlls/shlwapi/url.c
@@ -1864,7 +1864,8 @@ BOOL WINAPI UrlIsA(LPCSTR pszUrl, URLIS Urlis)
 	return FALSE;
 
     case URLIS_FILEURL:
-        return !StrCmpNA("file:", pszUrl, 5);
+        return (CompareStringA(LOCALE_INVARIANT, NORM_IGNORECASE, pszUrl, 5,
+                               "file:", 5) == CSTR_EQUAL);
 
     case URLIS_DIRECTORY:
         last = pszUrl + strlen(pszUrl) - 1;
@@ -1889,7 +1890,7 @@ BOOL WINAPI UrlIsA(LPCSTR pszUrl, URLIS Urlis)
  */
 BOOL WINAPI UrlIsW(LPCWSTR pszUrl, URLIS Urlis)
 {
-    static const WCHAR stemp[] = { 'f','i','l','e',':',0 };
+    static const WCHAR file_colon[] = { 'f','i','l','e',':',0 };
     PARSEDURLW base;
     DWORD res1;
     LPCWSTR last;
@@ -1917,7 +1918,8 @@ BOOL WINAPI UrlIsW(LPCWSTR pszUrl, URLIS Urlis)
 	return FALSE;
 
     case URLIS_FILEURL:
-        return !strncmpW(stemp, pszUrl, 5);
+        return (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, pszUrl, 5,
+                               file_colon, 5) == CSTR_EQUAL);
 
     case URLIS_DIRECTORY:
         last = pszUrl + strlenW(pszUrl) - 1;
-- 
1.7.10.4



More information about the wine-patches mailing list