shlwapi: Simplify UrlCombine case 2 with tests.
This commit is contained in:
parent
c18d69ef5f
commit
9339be641c
|
@ -263,7 +263,28 @@ 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/", "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 */
|
||||||
|
{"outbind://xxxxxxxxx","http://wine1/dir",0, S_OK,"http://wine1/dir"},
|
||||||
|
{"xxxx://xxxxxxxxx","http://wine2/dir",0, S_OK,"http://wine2/dir"},
|
||||||
|
{"ftp://xxxxxxxxx/","http://wine3/dir",0, S_OK,"http://wine3/dir"},
|
||||||
|
{"outbind://xxxxxxxxx","http://wine4/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"http://wine4/dir"},
|
||||||
|
{"xxx://xxxxxxxxx","http://wine5/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"http://wine5/dir"},
|
||||||
|
{"ftp://xxxxxxxxx/","http://wine6/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"http://wine6/dir"},
|
||||||
|
{"http://xxxxxxxxx","outbind://wine7/dir",0, S_OK,"outbind://wine7/dir"},
|
||||||
|
{"xxx://xxxxxxxxx","ftp://wine8/dir",0, S_OK,"ftp://wine8/dir"},
|
||||||
|
{"ftp://xxxxxxxxx/","xxx://wine9/dir",0, S_OK,"xxx://wine9/dir"},
|
||||||
|
{"http://xxxxxxxxx","outbind://wine10/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"outbind://wine10/dir"},
|
||||||
|
{"xxx://xxxxxxxxx","ftp://wine11/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"ftp://wine11/dir"},
|
||||||
|
{"ftp://xxxxxxxxx/","xxx://wine12/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"xxx://wine12/dir"},
|
||||||
|
{"http://xxxxxxxxx","outbind:wine13/dir",0, S_OK,"outbind:wine13/dir"},
|
||||||
|
{"xxx://xxxxxxxxx","ftp:wine14/dir",0, S_OK,"ftp:wine14/dir"},
|
||||||
|
{"ftp://xxxxxxxxx/","xxx:wine15/dir",0, S_OK,"xxx:wine15/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"},
|
||||||
|
{"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"},
|
||||||
|
{"outbind://xxxxxxxxx/","http:wine20/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"http:wine20/dir"}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ################ */
|
/* ################ */
|
||||||
|
|
|
@ -129,19 +129,6 @@ static DWORD get_scheme_code(LPCWSTR scheme, DWORD scheme_len)
|
||||||
return URL_SCHEME_UNKNOWN;
|
return URL_SCHEME_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL URL_JustLocation(LPCWSTR str)
|
|
||||||
{
|
|
||||||
while(*str && (*str == '/')) str++;
|
|
||||||
if (*str) {
|
|
||||||
while (*str && ((*str == '-') ||
|
|
||||||
(*str == '.') ||
|
|
||||||
isalnumW(*str))) str++;
|
|
||||||
if (*str == '/') return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* @ [SHLWAPI.1]
|
* @ [SHLWAPI.1]
|
||||||
*
|
*
|
||||||
|
@ -608,7 +595,6 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
|
||||||
DWORD len, res1, res2, process_case = 0;
|
DWORD 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'};
|
||||||
static const WCHAR single_slash[] = {'/','\0'};
|
|
||||||
HRESULT ret;
|
HRESULT ret;
|
||||||
|
|
||||||
TRACE("(base %s, Relative %s, Combine size %d, flags %08x)\n",
|
TRACE("(base %s, Relative %s, Combine size %d, flags %08x)\n",
|
||||||
|
@ -768,14 +754,8 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
|
||||||
strcatW(preliminary, mrelative);
|
strcatW(preliminary, mrelative);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /*
|
case 2: /* case where pszRelative replaces scheme, and location */
|
||||||
* Same as case 1, but if URL_PLUGGABLE_PROTOCOL was specified
|
|
||||||
* and pszRelative starts with "//", then append a "/"
|
|
||||||
*/
|
|
||||||
strcpyW(preliminary, mrelative);
|
strcpyW(preliminary, mrelative);
|
||||||
if (!(dwFlags & URL_PLUGGABLE_PROTOCOL) &&
|
|
||||||
URL_JustLocation(relative.pszSuffix))
|
|
||||||
strcatW(preliminary, single_slash);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: /*
|
case 3: /*
|
||||||
|
|
Loading…
Reference in New Issue