msvcrt: Added _mbsnbicoll_l implementation.

This commit is contained in:
Piotr Caban 2012-12-12 11:16:57 +01:00 committed by Alexandre Julliard
parent 3b41fab0e9
commit a2b71b732a
6 changed files with 44 additions and 27 deletions

View File

@ -1105,7 +1105,7 @@
@ cdecl _mbsicmp(str str) msvcrt._mbsicmp
@ stub _mbsicmp_l
@ cdecl _mbsicoll(str str) msvcrt._mbsicoll
@ stub _mbsicoll_l
@ cdecl _mbsicoll_l(str str ptr) msvcrt._mbsicoll_l
@ cdecl _mbsinc(str) msvcrt._mbsinc
@ stub _mbsinc_l
@ cdecl _mbslen(str) msvcrt._mbslen
@ -1131,7 +1131,7 @@
@ cdecl _mbsnbicmp(str str long) msvcrt._mbsnbicmp
@ stub _mbsnbicmp_l
@ cdecl _mbsnbicoll(str str long) msvcrt._mbsnbicoll
@ stub _mbsnbicoll_l
@ cdecl _mbsnbicoll_l(str str long ptr) msvcrt._mbsnbicoll_l
@ cdecl _mbsnbset(ptr long long) msvcrt._mbsnbset
@ stub _mbsnbset_l
@ stub _mbsnbset_s

View File

@ -762,7 +762,7 @@
@ cdecl _mbsicmp(str str) msvcrt._mbsicmp
@ stub _mbsicmp_l
@ cdecl _mbsicoll(str str) msvcrt._mbsicoll
@ stub _mbsicoll_l
@ cdecl _mbsicoll_l(str str ptr) msvcrt._mbsicoll_l
@ cdecl _mbsinc(str) msvcrt._mbsinc
@ stub _mbsinc_l
@ cdecl _mbslen(str) msvcrt._mbslen
@ -788,7 +788,7 @@
@ cdecl _mbsnbicmp(str str long) msvcrt._mbsnbicmp
@ stub _mbsnbicmp_l
@ cdecl _mbsnbicoll(str str long) msvcrt._mbsnbicoll
@ stub _mbsnbicoll_l
@ cdecl _mbsnbicoll_l(str str long ptr) msvcrt._mbsnbicoll_l
@ cdecl _mbsnbset(ptr long long) msvcrt._mbsnbset
@ stub _mbsnbset_l
@ stub _mbsnbset_s

View File

@ -755,7 +755,7 @@
@ cdecl _mbsicmp(str str) msvcrt._mbsicmp
@ stub _mbsicmp_l
@ cdecl _mbsicoll(str str) msvcrt._mbsicoll
@ stub _mbsicoll_l
@ cdecl _mbsicoll_l(str str ptr) msvcrt._mbsicoll_l
@ cdecl _mbsinc(str) msvcrt._mbsinc
@ stub _mbsinc_l
@ cdecl _mbslen(str) msvcrt._mbslen
@ -781,7 +781,7 @@
@ cdecl _mbsnbicmp(str str long) msvcrt._mbsnbicmp
@ stub _mbsnbicmp_l
@ cdecl _mbsnbicoll(str str long) msvcrt._mbsnbicoll
@ stub _mbsnbicoll_l
@ cdecl _mbsnbicoll_l(str str long ptr) msvcrt._mbsnbicoll_l
@ cdecl _mbsnbset(ptr long long) msvcrt._mbsnbset
@ stub _mbsnbset_l
@ stub _mbsnbset_s

View File

@ -765,29 +765,45 @@ int CDECL _mbscmp(const unsigned char* str, const unsigned char* cmp)
return u_strcmp(str, cmp); /* ASCII CP */
}
/*********************************************************************
* _mbsnbicoll_l(MSVCRT.@)
*/
int CDECL _mbsnbicoll_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__strnicoll_l((const char*)str1, (const char*)str2, len, locale);
return CompareStringA(mbcinfo->mblcid, NORM_IGNORECASE, (const char*)str1, len, (const char*)str2, len)-CSTR_EQUAL;
}
/*********************************************************************
* _mbsicoll_l(MSVCRT.@)
*/
int CDECL _mbsicoll_l(const unsigned char *str1, const unsigned char *str2, MSVCRT__locale_t locale)
{
return _mbsnbicoll_l(str1, str2, -1, locale);
}
/*********************************************************************
* _mbsnbicoll(MSVCRT.@)
*/
int CDECL _mbsnbicoll(const unsigned char *str1, const unsigned char *str2, MSVCRT_size_t len)
{
return _mbsnbicoll_l(str1, str2, len, NULL);
}
/*********************************************************************
* _mbsicoll(MSVCRT.@)
* FIXME: handle locales.
*/
int CDECL _mbsicoll(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 = _mbctolower(_mbsnextc(str));
cmpc = _mbctolower(_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_strcasecmp(str, cmp); /* ASCII CP */
return _mbsnbicoll_l(str, cmp, -1, NULL);
}
/*********************************************************************

View File

@ -952,6 +952,7 @@ void __cdecl MSVCRT__invalid_parameter(const MSVCRT_wchar_t *expr, const MSVCRT_
const MSVCRT_wchar_t *file, unsigned int line, MSVCRT_uintptr_t arg);
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);
/* 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

@ -703,7 +703,7 @@
@ cdecl _mbsicmp(str str)
# stub _mbsicmp_l(str str ptr)
@ cdecl _mbsicoll(str str)
# stub _mbsicoll_l(str str ptr)
@ cdecl _mbsicoll_l(str str ptr)
@ cdecl _mbsinc(str)
# stub _mbsinc_l(str ptr)
@ cdecl _mbslen(str)
@ -728,8 +728,8 @@
# stub _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long)
# stub _mbsnbicmp_l(str str long ptr)
@ stub _mbsnbicoll(str str long)
# stub _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
# stub _mbsnbset_l(str long long ptr)
# stub _mbsnbset_s(ptr long long long)