shlwapi: Don't copy valid scheme in UrlApplySchemeW.

This commit is contained in:
Sergey Khodych 2011-05-15 00:48:57 +03:00 committed by Alexandre Julliard
parent 2034439d66
commit 2e1bec528f
2 changed files with 4 additions and 14 deletions

View File

@ -85,6 +85,10 @@ static const TEST_URL_APPLY TEST_APPLY[] = {
{"winehq.org", URL_APPLY_GUESSSCHEME | URL_APPLY_DEFAULT, S_OK, 17, "http://winehq.org"},
{"winehq.org", URL_APPLY_GUESSSCHEME, S_FALSE, TEST_APPLY_MAX_LENGTH, untouchedA},
{"winehq.org", URL_APPLY_DEFAULT, S_OK, 17, "http://winehq.org"},
{"http://www.winehq.org", URL_APPLY_GUESSSCHEME , S_FALSE, TEST_APPLY_MAX_LENGTH, untouchedA},
{"http://www.winehq.org", URL_APPLY_GUESSSCHEME | URL_APPLY_FORCEAPPLY, S_FALSE, TEST_APPLY_MAX_LENGTH, untouchedA},
{"http://www.winehq.org", URL_APPLY_GUESSSCHEME | URL_APPLY_FORCEAPPLY | URL_APPLY_DEFAULT, S_OK, 28, "http://http://www.winehq.org"},
{"http://www.winehq.org", URL_APPLY_GUESSSCHEME | URL_APPLY_DEFAULT, S_FALSE, TEST_APPLY_MAX_LENGTH, untouchedA},
{"", URL_APPLY_GUESSSCHEME | URL_APPLY_DEFAULT, S_OK, 7, "http://"},
{"", URL_APPLY_GUESSSCHEME, S_FALSE, TEST_APPLY_MAX_LENGTH, untouchedA},
{"", URL_APPLY_DEFAULT, S_OK, 7, "http://"}

View File

@ -1764,20 +1764,6 @@ HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DW
return ret;
}
}
else {
/* we have a scheme, see if valid (known scheme) */
if (in_scheme.nScheme) {
/* have valid scheme, so just copy and exit */
if (strlenW(pszIn) + 1 > *pcchOut) {
*pcchOut = strlenW(pszIn) + 1;
return E_POINTER;
}
strcpyW(pszOut, pszIn);
*pcchOut = strlenW(pszOut);
TRACE("valid scheme, returning copy\n");
return S_OK;
}
}
/* If we are here, then either invalid scheme,
* or no scheme and can't/failed guess.