msvcrt: Implement _mbsnextc_l().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2020-09-23 22:54:27 +03:00 committed by Alexandre Julliard
parent 69ba059dcb
commit 082de781f0
12 changed files with 30 additions and 14 deletions

View File

@ -154,7 +154,7 @@
@ stub _mbsncpy_s
@ stub _mbsncpy_s_l
@ cdecl _mbsnextc(str) ucrtbase._mbsnextc
@ stub _mbsnextc_l
@ cdecl _mbsnextc_l(str ptr) ucrtbase._mbsnextc_l
@ cdecl _mbsnicmp(str str long) ucrtbase._mbsnicmp
@ stub _mbsnicmp_l
@ cdecl _mbsnicoll(str str long) ucrtbase._mbsnicoll

View File

@ -578,7 +578,7 @@
@ stub _o__mbsncpy_s
@ stub _o__mbsncpy_s_l
@ cdecl _o__mbsnextc(str) ucrtbase._o__mbsnextc
@ stub _o__mbsnextc_l
@ cdecl _o__mbsnextc_l(str ptr) ucrtbase._o__mbsnextc_l
@ cdecl _o__mbsnicmp(str str long) ucrtbase._o__mbsnicmp
@ stub _o__mbsnicmp_l
@ stub _o__mbsnicoll

View File

@ -1160,7 +1160,7 @@
@ stub _mbsncpy_s
@ stub _mbsncpy_s_l
@ cdecl _mbsnextc(str)
@ stub _mbsnextc_l
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ stub _mbsnicoll(str str long)

View File

@ -1517,7 +1517,7 @@
@ stub _mbsncpy_s
@ stub _mbsncpy_s_l
@ cdecl _mbsnextc(str)
@ stub _mbsnextc_l
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ stub _mbsnicoll(str str long)

View File

@ -1527,7 +1527,7 @@
@ stub _mbsncpy_s
@ stub _mbsncpy_s_l
@ cdecl _mbsnextc(str)
@ stub _mbsnextc_l
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ stub _mbsnicoll(str str long)

View File

@ -832,7 +832,7 @@
@ stub _mbsncpy_s
@ stub _mbsncpy_s_l
@ cdecl _mbsnextc(str)
@ stub _mbsnextc_l
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ stub _mbsnicoll(str str long)

View File

@ -810,7 +810,7 @@
@ stub _mbsncpy_s
@ stub _mbsncpy_s_l
@ cdecl _mbsnextc(str)
@ stub _mbsnextc_l
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ stub _mbsnicoll(str str long)

View File

@ -392,14 +392,22 @@ int CDECL _getmbcp(void)
return get_mbcinfo()->mbcodepage;
}
/*********************************************************************
* _mbsnextc_l(MSVCRT.@)
*/
unsigned int CDECL _mbsnextc_l(const unsigned char* str, MSVCRT__locale_t locale)
{
if(_ismbblead_l(*str, locale))
return *str << 8 | str[1];
return *str;
}
/*********************************************************************
* _mbsnextc(MSVCRT.@)
*/
unsigned int CDECL _mbsnextc(const unsigned char* str)
{
if(_ismbblead(*str))
return *str << 8 | str[1];
return *str;
return _mbsnextc_l(str, NULL);
}
/*********************************************************************

View File

@ -778,7 +778,7 @@
# stub _mbsncpy_s(ptr long str long)
# stub _mbsncpy_s_l(ptr long str long ptr)
@ cdecl _mbsnextc(str)
# stub _mbsnextc_l(str ptr)
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
# stub _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long)

View File

@ -114,6 +114,7 @@ static int (__cdecl *p__mbccpy_s)(unsigned char*, size_t, int*, const unsigned c
static int (__cdecl *p__memicmp)(const char*, const char*, size_t);
static int (__cdecl *p__memicmp_l)(const char*, const char*, size_t, _locale_t);
static size_t (__cdecl *p___strncnt)(const char*, size_t);
static unsigned int (__cdecl *p_mbsnextc_l)(const unsigned char*, _locale_t);
int CDECL __STRINGTOLD(_LDOUBLE*, char**, const char*, int);
@ -351,6 +352,11 @@ static void test_mbcp(void)
expect_eq(_mbsnextc(&mbstring[2]), 0xb220, int, "%x"); /* lead + invalid tail */
expect_eq(_mbsnextc(&mbstring[3]), 0x20, int, "%x"); /* single char */
if (!p_mbsnextc_l)
win_skip("_mbsnextc_l tests\n");
else
expect_eq(p_mbsnextc_l(mbstring, NULL), 0xb0b1, int, "%x");
/* _mbclen/_mbslen */
expect_eq(_mbclen(mbstring), 2, int, "%d");
expect_eq(_mbclen(&mbstring[2]), 2, int, "%d");
@ -4451,6 +4457,7 @@ START_TEST(string)
p__memicmp = (void*)GetProcAddress(hMsvcrt, "_memicmp");
p__memicmp_l = (void*)GetProcAddress(hMsvcrt, "_memicmp_l");
p___strncnt = (void*)GetProcAddress(hMsvcrt, "__strncnt");
p_mbsnextc_l = (void*)GetProcAddress(hMsvcrt, "_mbsnextc_l");
/* MSVCRT memcpy behaves like memmove for overlapping moves,
MFC42 CString::Insert seems to rely on that behaviour */

View File

@ -673,7 +673,7 @@
@ stub _mbsncpy_s
@ stub _mbsncpy_s_l
@ cdecl _mbsnextc(str)
@ stub _mbsnextc_l
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ stub _mbsnicoll(str str long)
@ -1242,7 +1242,7 @@
@ stub _o__mbsncpy_s
@ stub _o__mbsncpy_s_l
@ cdecl _o__mbsnextc(str) _mbsnextc
@ stub _o__mbsnextc_l
@ cdecl _o__mbsnextc_l(str ptr) _mbsnextc_l
@ cdecl _o__mbsnicmp(str str long) _mbsnicmp
@ stub _o__mbsnicmp_l
@ stub _o__mbsnicoll

View File

@ -90,7 +90,8 @@ size_t __cdecl _mbsnccnt(const unsigned char*,size_t);
int __cdecl _mbsncmp(const unsigned char*,const unsigned char*,size_t);
int __cdecl _mbsncoll(const unsigned char*,const unsigned char*,size_t);
unsigned char* __cdecl _mbsncpy(unsigned char*,const unsigned char*,size_t);
unsigned int __cdecl _mbsnextc (const unsigned char*);
unsigned int __cdecl _mbsnextc(const unsigned char*);
unsigned int __cdecl _mbsnextc_l(const unsigned char*,_locale_t);
int __cdecl _mbsnicmp(const unsigned char*,const unsigned char*,size_t);
int __cdecl _mbsnicoll(const unsigned char*,const unsigned char*,size_t);
unsigned char* __cdecl _mbsninc(const unsigned char*,size_t);