msvcrt: Don't use strstrW in wcsstr.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-07-15 14:05:36 +02:00 committed by Alexandre Julliard
parent 071a71a866
commit ae9c385e13
1 changed files with 13 additions and 1 deletions

View File

@ -2652,7 +2652,19 @@ int CDECL MSVCRT_wcslen(const MSVCRT_wchar_t *str)
*/ */
MSVCRT_wchar_t* CDECL MSVCRT_wcsstr(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *sub) MSVCRT_wchar_t* CDECL MSVCRT_wcsstr(const MSVCRT_wchar_t *str, const MSVCRT_wchar_t *sub)
{ {
return strstrW(str, sub); while(*str)
{
const MSVCRT_wchar_t *p1 = str, *p2 = sub;
while(*p1 && *p2 && *p1 == *p2)
{
p1++;
p2++;
}
if(!*p2)
return (MSVCRT_wchar_t*)str;
str++;
}
return NULL;
} }
/********************************************************************* /*********************************************************************