Commit eaa1b706 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Added _strnicmp_l implementation.

parent 04f40b70
......@@ -1341,7 +1341,7 @@
@ cdecl _strncoll(str str long) msvcrt._strncoll
@ cdecl _strncoll_l(str str long ptr) msvcrt._strncoll_l
@ cdecl _strnicmp(str str long) msvcrt._strnicmp
@ stub _strnicmp_l
@ cdecl _strnicmp_l(str str long ptr) msvcrt._strnicmp_l
@ cdecl _strnicoll(str str long) msvcrt._strnicoll
@ cdecl _strnicoll_l(str str long ptr) msvcrt._strnicoll_l
@ cdecl _strnset(str long long) msvcrt._strnset
......
......@@ -1003,7 +1003,7 @@
@ cdecl _strncoll(str str long) msvcrt._strncoll
@ cdecl _strncoll_l(str str long ptr) msvcrt._strncoll_l
@ cdecl _strnicmp(str str long) msvcrt._strnicmp
@ stub _strnicmp_l
@ cdecl _strnicmp_l(str str long ptr) msvcrt._strnicmp_l
@ cdecl _strnicoll(str str long) msvcrt._strnicoll
@ cdecl _strnicoll_l(str str long ptr) msvcrt._strnicoll_l
@ cdecl _strnset(str long long) msvcrt._strnset
......
......@@ -996,7 +996,7 @@
@ cdecl _strncoll(str str long) msvcrt._strncoll
@ cdecl _strncoll_l(str str long ptr) msvcrt._strncoll_l
@ cdecl _strnicmp(str str long) msvcrt._strnicmp
@ stub _strnicmp_l
@ cdecl _strnicmp_l(str str long ptr) msvcrt._strnicmp_l
@ cdecl _strnicoll(str str long) msvcrt._strnicoll
@ cdecl _strnicoll_l(str str long ptr) msvcrt._strnicoll_l
@ cdecl _strnset(str long long) msvcrt._strnset
......
......@@ -936,8 +936,8 @@
@ cdecl _strlwr_s_l(ptr long ptr)
@ cdecl _strncoll(str str long) MSVCRT_strncoll_l
@ cdecl _strncoll_l(str str long ptr) MSVCRT_strncoll
@ cdecl _strnicmp(str str long) ntdll._strnicmp
# stub _strnicmp_l(str str long ptr)
@ cdecl _strnicmp(str str long) MSVCRT__strnicmp
@ cdecl _strnicmp_l(str str long ptr) MSVCRT__strnicmp_l
@ cdecl _strnicoll(str str long) MSVCRT__strnicoll
@ cdecl _strnicoll_l(str str long ptr) MSVCRT__strnicoll_l
@ cdecl _strnset(str long long) MSVCRT__strnset
......
......@@ -1559,9 +1559,10 @@ void * __cdecl MSVCRT_memcpy( void *dst, const void *src, size_t n )
}
/*********************************************************************
* _stricmp_l (MSVCRT.@)
* _strnicmp_l (MSVCRT.@)
*/
int __cdecl MSVCRT__stricmp_l(const char *s1, const char *s2, MSVCRT__locale_t locale)
int __cdecl MSVCRT__strnicmp_l(const char *s1, const char *s2,
MSVCRT_size_t count, MSVCRT__locale_t locale)
{
MSVCRT_pthreadlocinfo locinfo;
char c1, c2;
......@@ -1569,28 +1570,45 @@ int __cdecl MSVCRT__stricmp_l(const char *s1, const char *s2, MSVCRT__locale_t l
if(!MSVCRT_CHECK_PMT(s1!=NULL && s2!=NULL))
return MSVCRT__NLSCMPERROR;
if(!count)
return 0;
if(!locale)
locinfo = get_locinfo();
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_CTYPE])
return strcasecmp(s1, s2);
return strncasecmp(s1, s2, count);
do {
c1 = MSVCRT__tolower_l(*s1++, locale);
c2 = MSVCRT__tolower_l(*s2++, locale);
if(c1 != c2)
break;
}while(c1 && c1==c2);
}while(--count && c1 && c1==c2);
return c1-c2;
}
/*********************************************************************
* _stricmp_l (MSVCRT.@)
*/
int __cdecl MSVCRT__stricmp_l(const char *s1, const char *s2, MSVCRT__locale_t locale)
{
return MSVCRT__strnicmp_l(s1, s2, -1, locale);
}
/*********************************************************************
* _strnicmp (MSVCRT.@)
*/
int __cdecl MSVCRT__strnicmp(const char *s1, const char *s2, MSVCRT_size_t count)
{
return MSVCRT__strnicmp_l(s1, s2, count, NULL);
}
/*********************************************************************
* _stricmp (MSVCRT.@)
*/
int __cdecl MSVCRT__stricmp(const char *s1, const char *s2)
{
return MSVCRT__stricmp_l(s1, s2, NULL);
return MSVCRT__strnicmp_l(s1, s2, -1, NULL);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment