shlwapi: Fix invalid usage of CompareString in StrStr functions.
This commit is contained in:
parent
766f587f90
commit
5aec09e4d1
|
@ -364,7 +364,7 @@ int WINAPI StrCmpIW(LPCWSTR lpszStr, LPCWSTR lpszComp)
|
||||||
* PARAMS
|
* PARAMS
|
||||||
* lpszStr [I] First string to compare
|
* lpszStr [I] First string to compare
|
||||||
* lpszComp [I] Second string to compare
|
* lpszComp [I] Second string to compare
|
||||||
* iLen [I] Maximum number of chars to compare.
|
* iLen [I] Number of chars to compare
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* An integer less than, equal to or greater than 0, indicating that
|
* An integer less than, equal to or greater than 0, indicating that
|
||||||
|
@ -395,7 +395,7 @@ INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
|
||||||
* PARAMS
|
* PARAMS
|
||||||
* lpszStr [I] First string to compare
|
* lpszStr [I] First string to compare
|
||||||
* lpszComp [I] Second string to compare
|
* lpszComp [I] Second string to compare
|
||||||
* iLen [I] Maximum number of chars to compare.
|
* iLen [I] Number of chars to compare
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* An integer less than, equal to or greater than 0, indicating that
|
* An integer less than, equal to or greater than 0, indicating that
|
||||||
|
@ -521,13 +521,15 @@ static LPSTR SHLWAPI_StrStrHelperA(LPCSTR lpszStr, LPCSTR lpszSearch,
|
||||||
INT (WINAPI *pStrCmpFn)(LPCSTR,LPCSTR,INT))
|
INT (WINAPI *pStrCmpFn)(LPCSTR,LPCSTR,INT))
|
||||||
{
|
{
|
||||||
size_t iLen;
|
size_t iLen;
|
||||||
|
LPCSTR end;
|
||||||
|
|
||||||
if (!lpszStr || !lpszSearch || !*lpszSearch)
|
if (!lpszStr || !lpszSearch || !*lpszSearch)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
iLen = strlen(lpszSearch);
|
iLen = strlen(lpszSearch);
|
||||||
|
end = lpszStr + strlen(lpszStr);
|
||||||
|
|
||||||
while (*lpszStr)
|
while (lpszStr + iLen <= end)
|
||||||
{
|
{
|
||||||
if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
|
if (!pStrCmpFn(lpszStr, lpszSearch, iLen))
|
||||||
return (LPSTR)lpszStr;
|
return (LPSTR)lpszStr;
|
||||||
|
@ -670,6 +672,7 @@ LPSTR WINAPI StrStrIA(LPCSTR lpszStr, LPCSTR lpszSearch)
|
||||||
LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
|
LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
|
||||||
{
|
{
|
||||||
int iLen;
|
int iLen;
|
||||||
|
LPCWSTR end;
|
||||||
|
|
||||||
TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
|
TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
|
||||||
|
|
||||||
|
@ -677,8 +680,9 @@ LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
iLen = strlenW(lpszSearch);
|
iLen = strlenW(lpszSearch);
|
||||||
|
end = lpszStr + strlenW(lpszStr);
|
||||||
|
|
||||||
while (*lpszStr)
|
while (lpszStr + iLen <= end)
|
||||||
{
|
{
|
||||||
if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
|
if (!StrCmpNIW(lpszStr, lpszSearch, iLen))
|
||||||
return (LPWSTR)lpszStr;
|
return (LPWSTR)lpszStr;
|
||||||
|
|
Loading…
Reference in New Issue