msvcrt: Added _mbsnbcoll_l implementation.

This commit is contained in:
Piotr Caban 2012-12-12 11:17:10 +01:00 committed by Alexandre Julliard
parent a2b71b732a
commit f5c8647919
6 changed files with 44 additions and 31 deletions

View File

@ -1095,7 +1095,7 @@
@ cdecl _mbscmp(str str) msvcrt._mbscmp
@ stub _mbscmp_l
@ cdecl _mbscoll(str str) msvcrt._mbscoll
@ stub _mbscoll_l
@ cdecl _mbscoll_l(str str ptr) msvcrt._mbscoll_l
@ stub _mbscpy_s
@ stub _mbscpy_s_l
@ cdecl _mbscspn(str str) msvcrt._mbscspn
@ -1123,7 +1123,7 @@
@ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt
@ stub _mbsnbcnt_l
@ 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
@ stub _mbsnbcpy_l
@ cdecl _mbsnbcpy_s(ptr long str long) msvcrt._mbsnbcpy_s

View File

@ -752,7 +752,7 @@
@ cdecl _mbscmp(str str) msvcrt._mbscmp
@ stub _mbscmp_l
@ cdecl _mbscoll(str str) msvcrt._mbscoll
@ stub _mbscoll_l
@ cdecl _mbscoll_l(str str ptr) msvcrt._mbscoll_l
@ stub _mbscpy_s
@ stub _mbscpy_s_l
@ cdecl _mbscspn(str str) msvcrt._mbscspn
@ -780,7 +780,7 @@
@ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt
@ stub _mbsnbcnt_l
@ 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
@ stub _mbsnbcpy_l
@ cdecl _mbsnbcpy_s(ptr long str long) msvcrt._mbsnbcpy_s

View File

@ -745,7 +745,7 @@
@ cdecl _mbscmp(str str) msvcrt._mbscmp
@ stub _mbscmp_l
@ cdecl _mbscoll(str str) msvcrt._mbscoll
@ stub _mbscoll_l
@ cdecl _mbscoll_l(str str ptr) msvcrt._mbscoll_l
@ stub _mbscpy_s
@ stub _mbscpy_s_l
@ cdecl _mbscspn(str str) msvcrt._mbscspn
@ -773,7 +773,7 @@
@ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt
@ stub _mbsnbcnt_l
@ 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
@ stub _mbsnbcpy_l
@ cdecl _mbsnbcpy_s(ptr long str long) msvcrt._mbsnbcpy_s

View File

@ -806,35 +806,47 @@ int CDECL _mbsicoll(const unsigned char* str, const unsigned char* cmp)
return _mbsnbicoll_l(str, cmp, -1, NULL);
}
/*********************************************************************
* _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.@)
* 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)
{
if(get_mbcinfo()->ismbcodepage)
{
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 */
return _mbsnbcoll_l(str, cmp, -1, NULL);
}
/*********************************************************************
* _mbsicmp(MSVCRT.@)
*/

View File

@ -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__tolower_l(int,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)
* #define MSVCRT_INVALID_PMT(x) MSVCRT_call_invalid_parameter_handler(x, __FUNCTION__, __FILE__, __LINE__, 0)

View File

@ -690,7 +690,7 @@
@ cdecl _mbscmp(str str)
# stub _mbscmp_l(str str ptr)
@ cdecl _mbscoll(str str)
# stub _mbscoll_l(str str ptr)
@ cdecl _mbscoll_l(str str ptr)
@ cdecl _mbscpy(ptr str)
# stub _mbscpy_s(ptr long str)
# stub _mbscpy_s_l(ptr long str ptr)
@ -720,8 +720,8 @@
# stub _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
# stub _mbsnbcnt_l(ptr long ptr)
@ stub _mbsnbcoll(str str long)
# stub _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long)
# stub _mbsnbcpy_l(ptr str long ptr)
@ cdecl _mbsnbcpy_s(ptr long str long)