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

msvcrt: Added _stricmp_l implementation.

parent 7726e018
......@@ -1331,7 +1331,7 @@
@ stub _strerror_s
@ stub _strftime_l
@ cdecl _stricmp(str str) msvcrt._stricmp
@ stub _stricmp_l
@ cdecl _stricmp_l(str str ptr) msvcrt._stricmp_l
@ cdecl _stricoll(str str) msvcrt._stricoll
@ cdecl _stricoll_l(str str ptr) msvcrt._stricoll_l
@ cdecl _strlwr(str) msvcrt._strlwr
......
......@@ -993,7 +993,7 @@
@ stub _strerror_s
@ stub _strftime_l
@ cdecl _stricmp(str str) msvcrt._stricmp
@ stub _stricmp_l
@ cdecl _stricmp_l(str str ptr) msvcrt._stricmp_l
@ cdecl _stricoll(str str) msvcrt._stricoll
@ cdecl _stricoll_l(str str ptr) msvcrt._stricoll_l
@ cdecl _strlwr(str) msvcrt._strlwr
......
......@@ -986,7 +986,7 @@
@ stub _strerror_s
@ stub _strftime_l
@ cdecl _stricmp(str str) msvcrt._stricmp
@ stub _stricmp_l
@ cdecl _stricmp_l(str str ptr) msvcrt._stricmp_l
@ cdecl _stricoll(str str) msvcrt._stricoll
@ cdecl _stricoll_l(str str ptr) msvcrt._stricoll_l
@ cdecl _strlwr(str) msvcrt._strlwr
......
......@@ -863,6 +863,8 @@ typedef void (__cdecl *MSVCRT___sighandler_t)(int);
/* _get_output_format return code */
#define MSVCRT__TWO_DIGIT_EXPONENT 0x1
#define MSVCRT__NLSCMPERROR ((unsigned int)0x7fffffff)
void __cdecl MSVCRT_free(void*);
void* __cdecl MSVCRT_malloc(MSVCRT_size_t);
void* __cdecl MSVCRT_calloc(MSVCRT_size_t,MSVCRT_size_t);
......
......@@ -918,7 +918,7 @@
@ cdecl _stat64(str ptr) MSVCRT_stat64
@ cdecl _stati64(str ptr) MSVCRT_stati64
@ cdecl _statusfp()
@ cdecl _strcmpi(str str) ntdll._strcmpi
@ cdecl _strcmpi(str str) MSVCRT__stricmp
@ cdecl _strcoll_l(str str ptr) MSVCRT_strcoll_l
@ cdecl _strdate(ptr) MSVCRT__strdate
@ cdecl _strdate_s(ptr long)
......@@ -926,8 +926,8 @@
# stub _strdup_dbg(str long str long)
@ cdecl _strerror(long) MSVCRT__strerror
# stub _strerror_s(ptr long long)
@ cdecl _stricmp(str str) ntdll._stricmp
# stub _stricmp_l(str str ptr)
@ cdecl _stricmp(str str) MSVCRT__stricmp
@ cdecl _stricmp_l(str str ptr) MSVCRT__stricmp_l
@ cdecl _stricoll(str str) MSVCRT__stricoll
@ cdecl _stricoll_l(str str ptr) MSVCRT__stricoll_l
@ cdecl _strlwr(str) MSVCRT__strlwr
......
......@@ -1551,9 +1551,46 @@ int CDECL MSVCRT_I10_OUTPUT(MSVCRT__LDOUBLE ld80, int prec, int flag, struct _I1
#undef I10_OUTPUT_MAX_PREC
/*********************************************************************
* memcpy (NTDLL.@)
* memcpy (MSVCRT.@)
*/
void * __cdecl MSVCRT_memcpy( void *dst, const void *src, size_t n )
{
return memmove( dst, src, n );
}
/*********************************************************************
* _stricmp_l (MSVCRT.@)
*/
int __cdecl MSVCRT__stricmp_l(const char *s1, const char *s2, MSVCRT__locale_t locale)
{
MSVCRT_pthreadlocinfo locinfo;
char c1, c2;
if(!MSVCRT_CHECK_PMT(s1!=NULL && s2!=NULL))
return MSVCRT__NLSCMPERROR;
if(!locale)
locinfo = get_locinfo();
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_CTYPE])
return strcasecmp(s1, s2);
do {
c1 = MSVCRT__tolower_l(*s1++, locale);
c2 = MSVCRT__tolower_l(*s2++, locale);
if(c1 != c2)
break;
}while(c1 && c1==c2);
return c1-c2;
}
/*********************************************************************
* _stricmp (MSVCRT.@)
*/
int __cdecl MSVCRT__stricmp(const char *s1, const char *s2)
{
return MSVCRT__stricmp_l(s1, s2, NULL);
}
......@@ -2438,6 +2438,36 @@ static void test__atodbl(void)
ok(ret == _OVERFLOW, "_atodbl(&d, \"1e309\") returned %d, expected _OVERFLOW\n", ret);
}
static void test__stricmp(void)
{
int ret;
ret = _stricmp("test", "test");
ok(ret == 0, "_stricmp returned %d\n", ret);
ret = _stricmp("a", "z");
ok(ret < 0, "_stricmp returned %d\n", ret);
ret = _stricmp("z", "a");
ok(ret > 0, "_stricmp returned %d\n", ret);
ret = _stricmp("\xa5", "\xb9");
ok(ret < 0, "_stricmp returned %d\n", ret);
if(!setlocale(LC_ALL, "polish")) {
win_skip("stricmp tests");
return;
}
ret = _stricmp("test", "test");
ok(ret == 0, "_stricmp returned %d\n", ret);
ret = _stricmp("a", "z");
ok(ret < 0, "_stricmp returned %d\n", ret);
ret = _stricmp("z", "a");
ok(ret > 0, "_stricmp returned %d\n", ret);
ret = _stricmp("\xa5", "\xb9");
ok(ret == 0, "_stricmp returned %d\n", ret);
setlocale(LC_ALL, "C");
}
START_TEST(string)
{
char mem[100];
......@@ -2533,4 +2563,5 @@ START_TEST(string)
test_wctomb();
test_tolower();
test__atodbl();
test__stricmp();
}
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