comctl32: Allow broken behaviour in StrRStr functions.
This commit is contained in:
parent
1b672e55ce
commit
735e2cd774
|
@ -674,18 +674,20 @@ LPSTR WINAPI StrRStrIA(LPCSTR lpszStr, LPCSTR lpszEnd, LPCSTR lpszSearch)
|
||||||
if (!lpszStr || !lpszSearch || !*lpszSearch)
|
if (!lpszStr || !lpszSearch || !*lpszSearch)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!lpszEnd)
|
|
||||||
lpszEnd = lpszStr + lstrlenA(lpszStr);
|
|
||||||
|
|
||||||
if (IsDBCSLeadByte(*lpszSearch))
|
if (IsDBCSLeadByte(*lpszSearch))
|
||||||
ch1 = *lpszSearch << 8 | lpszSearch[1];
|
ch1 = *lpszSearch << 8 | (UCHAR)lpszSearch[1];
|
||||||
else
|
else
|
||||||
ch1 = *lpszSearch;
|
ch1 = *lpszSearch;
|
||||||
iLen = lstrlenA(lpszSearch);
|
iLen = lstrlenA(lpszSearch);
|
||||||
|
|
||||||
|
if (!lpszEnd)
|
||||||
|
lpszEnd = lpszStr + lstrlenA(lpszStr);
|
||||||
|
else /* reproduce the broken behaviour on Windows */
|
||||||
|
lpszEnd += min(iLen - 1, lstrlenA(lpszEnd));
|
||||||
|
|
||||||
while (lpszStr + iLen <= lpszEnd && *lpszStr)
|
while (lpszStr + iLen <= lpszEnd && *lpszStr)
|
||||||
{
|
{
|
||||||
ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
|
ch2 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | (UCHAR)lpszStr[1] : *lpszStr;
|
||||||
if (!COMCTL32_ChrCmpIA(ch1, ch2))
|
if (!COMCTL32_ChrCmpIA(ch1, ch2))
|
||||||
{
|
{
|
||||||
if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
|
if (!StrCmpNIA(lpszStr, lpszSearch, iLen))
|
||||||
|
@ -711,10 +713,13 @@ LPWSTR WINAPI StrRStrIW(LPCWSTR lpszStr, LPCWSTR lpszEnd, LPCWSTR lpszSearch)
|
||||||
if (!lpszStr || !lpszSearch || !*lpszSearch)
|
if (!lpszStr || !lpszSearch || !*lpszSearch)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
iLen = strlenW(lpszSearch);
|
||||||
|
|
||||||
if (!lpszEnd)
|
if (!lpszEnd)
|
||||||
lpszEnd = lpszStr + strlenW(lpszStr);
|
lpszEnd = lpszStr + strlenW(lpszStr);
|
||||||
|
else /* reproduce the broken behaviour on Windows */
|
||||||
|
lpszEnd += min(iLen - 1, lstrlenW(lpszEnd));
|
||||||
|
|
||||||
iLen = strlenW(lpszSearch);
|
|
||||||
|
|
||||||
while (lpszStr + iLen <= lpszEnd && *lpszStr)
|
while (lpszStr + iLen <= lpszEnd && *lpszStr)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue