shlwapi: Fix parameter check for UrlUnescapeA.

NULL pszUnescaped is okay if URL_UNESCAPE_INPLACE is set.
Add a corresponding test for UrlUnescape{A,W}.
This commit is contained in:
Hans Leidekker 2006-02-16 12:08:48 +01:00 committed by Alexandre Julliard
parent 8e7f30ef11
commit 7c9918338a
2 changed files with 9 additions and 1 deletions

View File

@ -585,6 +585,9 @@ static void test_UrlUnescape(void)
WCHAR *urlW, *expected_urlW; WCHAR *urlW, *expected_urlW;
DWORD dwEscaped; DWORD dwEscaped;
size_t i; size_t i;
static char inplace[] = "file:///C:/Program%20Files";
static WCHAR inplaceW[] = {'f','i','l','e',':','/','/','/','C',':','/',
'P','r','o','g','r','a','m','%','2','0','F','i','l','e','s',0};
for(i=0; i<sizeof(TEST_URL_UNESCAPE)/sizeof(TEST_URL_UNESCAPE[0]); i++) { for(i=0; i<sizeof(TEST_URL_UNESCAPE)/sizeof(TEST_URL_UNESCAPE[0]); i++) {
dwEscaped=INTERNET_MAX_URL_LENGTH; dwEscaped=INTERNET_MAX_URL_LENGTH;
@ -601,6 +604,11 @@ static void test_UrlUnescape(void)
FreeWideString(expected_urlW); FreeWideString(expected_urlW);
} }
dwEscaped = sizeof(inplace);
ok(UrlUnescapeA(inplace, NULL, &dwEscaped, URL_UNESCAPE_INPLACE) == S_OK, "UrlUnescapeA failed unexpectedly\n");
dwEscaped = sizeof(inplaceW);
ok(UrlUnescapeW(inplaceW, NULL, &dwEscaped, URL_UNESCAPE_INPLACE) == S_OK, "UrlUnescapeW failed unexpectedly\n");
} }
static void test_PathSearchAndQualify(void) static void test_PathSearchAndQualify(void)

View File

@ -1117,7 +1117,7 @@ HRESULT WINAPI UrlUnescapeA(
TRACE("(%s, %p, %p, 0x%08lx)\n", debugstr_a(pszUrl), pszUnescaped, TRACE("(%s, %p, %p, 0x%08lx)\n", debugstr_a(pszUrl), pszUnescaped,
pcchUnescaped, dwFlags); pcchUnescaped, dwFlags);
if(!pszUrl || !pszUnescaped || !pcchUnescaped) if(!pszUrl || (!pszUnescaped && !(dwFlags & URL_UNESCAPE_INPLACE)) || !pcchUnescaped)
return E_INVALIDARG; return E_INVALIDARG;
if(dwFlags & URL_UNESCAPE_INPLACE) if(dwFlags & URL_UNESCAPE_INPLACE)