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

msvcrt: Added _mbsnbcoll_l implementation.

parent a2b71b73
...@@ -1095,7 +1095,7 @@ ...@@ -1095,7 +1095,7 @@
@ cdecl _mbscmp(str str) msvcrt._mbscmp @ cdecl _mbscmp(str str) msvcrt._mbscmp
@ stub _mbscmp_l @ stub _mbscmp_l
@ cdecl _mbscoll(str str) msvcrt._mbscoll @ cdecl _mbscoll(str str) msvcrt._mbscoll
@ stub _mbscoll_l @ cdecl _mbscoll_l(str str ptr) msvcrt._mbscoll_l
@ stub _mbscpy_s @ stub _mbscpy_s
@ stub _mbscpy_s_l @ stub _mbscpy_s_l
@ cdecl _mbscspn(str str) msvcrt._mbscspn @ cdecl _mbscspn(str str) msvcrt._mbscspn
...@@ -1123,7 +1123,7 @@ ...@@ -1123,7 +1123,7 @@
@ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt @ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt
@ stub _mbsnbcnt_l @ stub _mbsnbcnt_l
@ cdecl _mbsnbcoll(str str long) msvcrt._mbsnbcoll @ cdecl _mbsnbcoll(str str long) msvcrt._mbsnbcoll
@ stub _mbsnbcoll_l @ cdecl _mbsnbcoll_l(str str long ptr) msvcrt._mbsnbcoll_l
@ cdecl _mbsnbcpy(ptr str long) msvcrt._mbsnbcpy @ cdecl _mbsnbcpy(ptr str long) msvcrt._mbsnbcpy
@ stub _mbsnbcpy_l @ stub _mbsnbcpy_l
@ cdecl _mbsnbcpy_s(ptr long str long) msvcrt._mbsnbcpy_s @ cdecl _mbsnbcpy_s(ptr long str long) msvcrt._mbsnbcpy_s
......
...@@ -752,7 +752,7 @@ ...@@ -752,7 +752,7 @@
@ cdecl _mbscmp(str str) msvcrt._mbscmp @ cdecl _mbscmp(str str) msvcrt._mbscmp
@ stub _mbscmp_l @ stub _mbscmp_l
@ cdecl _mbscoll(str str) msvcrt._mbscoll @ cdecl _mbscoll(str str) msvcrt._mbscoll
@ stub _mbscoll_l @ cdecl _mbscoll_l(str str ptr) msvcrt._mbscoll_l
@ stub _mbscpy_s @ stub _mbscpy_s
@ stub _mbscpy_s_l @ stub _mbscpy_s_l
@ cdecl _mbscspn(str str) msvcrt._mbscspn @ cdecl _mbscspn(str str) msvcrt._mbscspn
...@@ -780,7 +780,7 @@ ...@@ -780,7 +780,7 @@
@ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt @ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt
@ stub _mbsnbcnt_l @ stub _mbsnbcnt_l
@ cdecl _mbsnbcoll(str str long) msvcrt._mbsnbcoll @ cdecl _mbsnbcoll(str str long) msvcrt._mbsnbcoll
@ stub _mbsnbcoll_l @ cdecl _mbsnbcoll_l(str str long ptr) msvcrt._mbsnbcoll_l
@ cdecl _mbsnbcpy(ptr str long) msvcrt._mbsnbcpy @ cdecl _mbsnbcpy(ptr str long) msvcrt._mbsnbcpy
@ stub _mbsnbcpy_l @ stub _mbsnbcpy_l
@ cdecl _mbsnbcpy_s(ptr long str long) msvcrt._mbsnbcpy_s @ cdecl _mbsnbcpy_s(ptr long str long) msvcrt._mbsnbcpy_s
......
...@@ -745,7 +745,7 @@ ...@@ -745,7 +745,7 @@
@ cdecl _mbscmp(str str) msvcrt._mbscmp @ cdecl _mbscmp(str str) msvcrt._mbscmp
@ stub _mbscmp_l @ stub _mbscmp_l
@ cdecl _mbscoll(str str) msvcrt._mbscoll @ cdecl _mbscoll(str str) msvcrt._mbscoll
@ stub _mbscoll_l @ cdecl _mbscoll_l(str str ptr) msvcrt._mbscoll_l
@ stub _mbscpy_s @ stub _mbscpy_s
@ stub _mbscpy_s_l @ stub _mbscpy_s_l
@ cdecl _mbscspn(str str) msvcrt._mbscspn @ cdecl _mbscspn(str str) msvcrt._mbscspn
...@@ -773,7 +773,7 @@ ...@@ -773,7 +773,7 @@
@ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt @ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt
@ stub _mbsnbcnt_l @ stub _mbsnbcnt_l
@ cdecl _mbsnbcoll(str str long) msvcrt._mbsnbcoll @ cdecl _mbsnbcoll(str str long) msvcrt._mbsnbcoll
@ stub _mbsnbcoll_l @ cdecl _mbsnbcoll_l(str str long ptr) msvcrt._mbsnbcoll_l
@ cdecl _mbsnbcpy(ptr str long) msvcrt._mbsnbcpy @ cdecl _mbsnbcpy(ptr str long) msvcrt._mbsnbcpy
@ stub _mbsnbcpy_l @ stub _mbsnbcpy_l
@ cdecl _mbsnbcpy_s(ptr long str long) msvcrt._mbsnbcpy_s @ cdecl _mbsnbcpy_s(ptr long str long) msvcrt._mbsnbcpy_s
......
...@@ -807,34 +807,46 @@ int CDECL _mbsicoll(const unsigned char* str, const unsigned char* cmp) ...@@ -807,34 +807,46 @@ int CDECL _mbsicoll(const unsigned char* str, const unsigned char* cmp)
} }
/********************************************************************* /*********************************************************************
* _mbsnbcoll_l(MSVCRT.@)
*/
int CDECL _mbsnbcoll_l(const unsigned char *str1, const unsigned char *str2, MSVCRT_size_t len, MSVCRT__locale_t locale)
{
MSVCRT_pthreadmbcinfo mbcinfo;
if(!locale)
mbcinfo = get_mbcinfo();
else
mbcinfo = locale->mbcinfo;
if(!mbcinfo->ismbcodepage)
return MSVCRT_strncoll_l((const char*)str1, (const char*)str2, len, locale);
return CompareStringA(mbcinfo->mblcid, 0, (const char*)str1, len, (const char*)str2, len)-CSTR_EQUAL;
}
/*********************************************************************
* _mbscoll_l(MSVCRT.@)
*/
int CDECL _mbscoll_l(const unsigned char *str1, const unsigned char *str2, MSVCRT__locale_t locale)
{
return _mbsnbcoll_l(str1, str2, -1, locale);
}
/*********************************************************************
* _mbsnbcoll(MSVCRT.@)
*/
int CDECL _mbsnbcoll(const unsigned char *str1, const unsigned char *str2, MSVCRT_size_t len)
{
return _mbsnbcoll_l(str1, str2, len, NULL);
}
/*********************************************************************
* _mbscoll(MSVCRT.@) * _mbscoll(MSVCRT.@)
* Performs a case-sensitive comparison according to the current code page
* RETURN
* _NLSCMPERROR if error
* FIXME: handle locales.
*/ */
int CDECL _mbscoll(const unsigned char* str, const unsigned char* cmp) int CDECL _mbscoll(const unsigned char* str, const unsigned char* cmp)
{ {
if(get_mbcinfo()->ismbcodepage) return _mbsnbcoll_l(str, cmp, -1, NULL);
{
unsigned int strc, cmpc;
do {
if(!*str)
return *cmp ? -1 : 0;
if(!*cmp)
return 1;
strc = _mbsnextc(str);
cmpc = _mbsnextc(cmp);
if(strc != cmpc)
return strc < cmpc ? -1 : 1;
str +=(strc > 255) ? 2 : 1;
cmp +=(strc > 255) ? 2 : 1; /* equal, use same increment */
} while(1);
}
return u_strcmp(str, cmp); /* ASCII CP */
} }
/********************************************************************* /*********************************************************************
* _mbsicmp(MSVCRT.@) * _mbsicmp(MSVCRT.@)
*/ */
......
...@@ -953,6 +953,7 @@ void __cdecl MSVCRT__invalid_parameter(const MSVCRT_wchar_t *expr, const MSVCRT_ ...@@ -953,6 +953,7 @@ void __cdecl MSVCRT__invalid_parameter(const MSVCRT_wchar_t *expr, const MSVCRT_
int __cdecl MSVCRT__toupper_l(int,MSVCRT__locale_t); int __cdecl MSVCRT__toupper_l(int,MSVCRT__locale_t);
int __cdecl MSVCRT__tolower_l(int,MSVCRT__locale_t); int __cdecl MSVCRT__tolower_l(int,MSVCRT__locale_t);
int __cdecl MSVCRT__strnicoll_l(const char*, const char*, MSVCRT_size_t, MSVCRT__locale_t); int __cdecl MSVCRT__strnicoll_l(const char*, const char*, MSVCRT_size_t, MSVCRT__locale_t);
int __cdecl MSVCRT_strncoll_l(const char*, const char*, MSVCRT_size_t, MSVCRT__locale_t);
/* Maybe one day we'll enable the invalid parameter handlers with the full set of information (msvcrXXd) /* Maybe one day we'll enable the invalid parameter handlers with the full set of information (msvcrXXd)
* #define MSVCRT_INVALID_PMT(x) MSVCRT_call_invalid_parameter_handler(x, __FUNCTION__, __FILE__, __LINE__, 0) * #define MSVCRT_INVALID_PMT(x) MSVCRT_call_invalid_parameter_handler(x, __FUNCTION__, __FILE__, __LINE__, 0)
......
...@@ -690,7 +690,7 @@ ...@@ -690,7 +690,7 @@
@ cdecl _mbscmp(str str) @ cdecl _mbscmp(str str)
# stub _mbscmp_l(str str ptr) # stub _mbscmp_l(str str ptr)
@ cdecl _mbscoll(str str) @ cdecl _mbscoll(str str)
# stub _mbscoll_l(str str ptr) @ cdecl _mbscoll_l(str str ptr)
@ cdecl _mbscpy(ptr str) @ cdecl _mbscpy(ptr str)
# stub _mbscpy_s(ptr long str) # stub _mbscpy_s(ptr long str)
# stub _mbscpy_s_l(ptr long str ptr) # stub _mbscpy_s_l(ptr long str ptr)
...@@ -720,8 +720,8 @@ ...@@ -720,8 +720,8 @@
# stub _mbsnbcmp_l(str str long ptr) # stub _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long) @ cdecl _mbsnbcnt(ptr long)
# stub _mbsnbcnt_l(ptr long ptr) # stub _mbsnbcnt_l(ptr long ptr)
@ stub _mbsnbcoll(str str long) @ cdecl _mbsnbcoll(str str long)
# stub _mbsnbcoll_l(str str long ptr) @ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long) @ cdecl _mbsnbcpy(ptr str long)
# stub _mbsnbcpy_l(ptr str long ptr) # stub _mbsnbcpy_l(ptr str long ptr)
@ cdecl _mbsnbcpy_s(ptr long str long) @ cdecl _mbsnbcpy_s(ptr long str long)
......
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