shlwapi: Lowercase schemes in UrlCombine function.

This commit is contained in:
Piotr Caban 2012-03-08 13:48:01 +01:00 committed by Alexandre Julliard
parent bb06ec7789
commit 3f6142e00d
2 changed files with 12 additions and 4 deletions

View File

@ -343,7 +343,7 @@ static const TEST_URL_COMBINE TEST_COMBINE[] = {
{"foo:today", "foo:calendar", 0, S_OK, "foo:calendar"}, {"foo:today", "foo:calendar", 0, S_OK, "foo:calendar"},
{"foo:today", "bar:calendar", 0, S_OK, "bar:calendar"}, {"foo:today", "bar:calendar", 0, S_OK, "bar:calendar"},
{"foo:/today", "foo:calendar", 0, S_OK, "foo:/calendar"}, {"foo:/today", "foo:calendar", 0, S_OK, "foo:/calendar"},
{"foo:/today/", "foo:calendar", 0, S_OK, "foo:/today/calendar"}, {"Foo:/today/", "fOo:calendar", 0, S_OK, "foo:/today/calendar"},
{"mk:@MSITStore:dir/test.chm::dir/index.html", "image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"}, {"mk:@MSITStore:dir/test.chm::dir/index.html", "image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"},
{"mk:@MSITStore:dir/test.chm::dir/dir2/index.html", "../image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"}, {"mk:@MSITStore:dir/test.chm::dir/dir2/index.html", "../image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"},
/* UrlCombine case 2 tests. Schemes do not match */ /* UrlCombine case 2 tests. Schemes do not match */
@ -365,7 +365,7 @@ static const TEST_URL_COMBINE TEST_COMBINE[] = {
{"outbind://xxxxxxxxx/","http:wine16/dir",0, S_OK,"http:wine16/dir"}, {"outbind://xxxxxxxxx/","http:wine16/dir",0, S_OK,"http:wine16/dir"},
{"http://xxxxxxxxx","outbind:wine17/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"outbind:wine17/dir"}, {"http://xxxxxxxxx","outbind:wine17/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"outbind:wine17/dir"},
{"xxx://xxxxxxxxx","ftp:wine18/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"ftp:wine18/dir"}, {"xxx://xxxxxxxxx","ftp:wine18/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"ftp:wine18/dir"},
{"ftp://xxxxxxxxx/","xxx:wine19/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"xxx:wine19/dir"}, {"ftp://xxxxxxxxx/","xXx:wine19/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"xxx:wine19/dir"},
{"outbind://xxxxxxxxx/","http:wine20/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"http:wine20/dir"}, {"outbind://xxxxxxxxx/","http:wine20/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"http:wine20/dir"},
{"file:///c:/dir/file.txt","index.html?test=c:/abc",URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,S_OK,"file:///c:/dir/index.html?test=c:/abc"} {"file:///c:/dir/file.txt","index.html?test=c:/abc",URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,S_OK,"file:///c:/dir/index.html?test=c:/abc"}
}; };

View File

@ -662,7 +662,7 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
{ {
PARSEDURLW base, relative; PARSEDURLW base, relative;
DWORD myflags, sizeloc = 0; DWORD myflags, sizeloc = 0;
DWORD len, res1, res2, process_case = 0; DWORD i, len, res1, res2, process_case = 0;
LPWSTR work, preliminary, mbase, mrelative; LPWSTR work, preliminary, mbase, mrelative;
static const WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'}; static const WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'};
HRESULT ret; HRESULT ret;
@ -703,6 +703,10 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
else do { else do {
BOOL manual_search = FALSE; BOOL manual_search = FALSE;
work = (LPWSTR)base.pszProtocol;
for(i=0; i<base.cchProtocol; i++)
work[i] = tolowerW(work[i]);
/* mk is a special case */ /* mk is a special case */
if(base.nScheme == URL_SCHEME_MK) { if(base.nScheme == URL_SCHEME_MK) {
static const WCHAR wsz[] = {':',':',0}; static const WCHAR wsz[] = {':',':',0};
@ -826,7 +830,11 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
} }
process_case = (*base.pszSuffix == '/' || base.nScheme == URL_SCHEME_MK) ? 5 : 3; process_case = (*base.pszSuffix == '/' || base.nScheme == URL_SCHEME_MK) ? 5 : 3;
break; break;
} }else {
work = (LPWSTR)relative.pszProtocol;
for(i=0; i<relative.cchProtocol; i++)
work[i] = tolowerW(work[i]);
}
/* handle cases where pszRelative has scheme */ /* handle cases where pszRelative has scheme */
if ((base.cchProtocol == relative.cchProtocol) && if ((base.cchProtocol == relative.cchProtocol) &&