shlwapi: UrlCanonicalize should strip all the characters <= 32 from the end of the string.
This commit is contained in:
parent
f8a104f4a5
commit
9c030d4660
|
@ -579,6 +579,7 @@ static void test_UrlCanonicalizeW(void)
|
|||
DWORD dwSize;
|
||||
DWORD urllen;
|
||||
HRESULT hr;
|
||||
int i;
|
||||
|
||||
|
||||
if (!pUrlCanonicalizeW) {
|
||||
|
@ -628,6 +629,21 @@ static void test_UrlCanonicalizeW(void)
|
|||
"got 0x%x with %u and size %u for %u (expected 'S_OK' and size %u)\n",
|
||||
hr, GetLastError(), dwSize, lstrlenW(szReturnUrl), urllen);
|
||||
|
||||
/* check that the characters 1..32 are chopped from the end of the string */
|
||||
for (i = 1; i < 65536; i++)
|
||||
{
|
||||
WCHAR szUrl[128];
|
||||
BOOL choped;
|
||||
int pos;
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, "http://www.winehq.org/X", -1, szUrl, 128);
|
||||
pos = lstrlenW(szUrl) - 1;
|
||||
szUrl[pos] = i;
|
||||
urllen = INTERNET_MAX_URL_LENGTH;
|
||||
pUrlCanonicalizeW(szUrl, szReturnUrl, &urllen, 0);
|
||||
choped = lstrlenW(szReturnUrl) < lstrlenW(szUrl);
|
||||
ok(choped == (i <= 32), "Incorrect char chopping for char %d\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
/* ########################### */
|
||||
|
|
|
@ -502,7 +502,7 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
|
|||
debugstr_w(pszUrl), debugstr_w(lpszUrlCpy));
|
||||
}
|
||||
nLen = lstrlenW(lpszUrlCpy);
|
||||
while ((nLen > 0) && ((lpszUrlCpy[nLen-1] == '\r')||(lpszUrlCpy[nLen-1] == '\n')))
|
||||
while ((nLen > 0) && ((lpszUrlCpy[nLen-1] <= ' ')))
|
||||
lpszUrlCpy[--nLen]=0;
|
||||
|
||||
if(dwFlags & (URL_UNESCAPE | URL_FILE_USE_PATHURL))
|
||||
|
|
|
@ -113,6 +113,12 @@ static void test_InternetCanonicalizeUrlA(void)
|
|||
"got %u and %u with size %u for '%s' (%d)\n",
|
||||
res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
|
||||
|
||||
/* test with trailing space */
|
||||
dwSize = 256;
|
||||
res = InternetCanonicalizeUrlA("http://www.winehq.org/index.php?x= ", buffer, &dwSize, ICU_BROWSER_MODE);
|
||||
ok(res == 1, "InternetCanonicalizeUrlA failed\n");
|
||||
ok(!strcmp(buffer, "http://www.winehq.org/index.php?x="), "Trailing space should have been stripped even in ICU_BROWSER_MODE (%s)\n", buffer);
|
||||
|
||||
res = InternetSetOptionA(NULL, 0xdeadbeef, buffer, sizeof(buffer));
|
||||
ok(!res, "InternetSetOptionA succeeded\n");
|
||||
ok(GetLastError() == ERROR_INTERNET_INVALID_OPTION,
|
||||
|
|
Loading…
Reference in New Issue