msvcrt: Add _ismbcalnum_l implementation.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-07-16 15:32:53 +02:00 committed by Alexandre Julliard
parent fbbcd3f8f8
commit 19c05e60a3
11 changed files with 49 additions and 30 deletions

View file

@ -25,7 +25,7 @@
@ cdecl _ismbbtrail(long) ucrtbase._ismbbtrail
@ cdecl _ismbbtrail_l(long ptr) ucrtbase._ismbbtrail_l
@ cdecl _ismbcalnum(long) ucrtbase._ismbcalnum
@ stub _ismbcalnum_l
@ cdecl _ismbcalnum_l(long ptr) ucrtbase._ismbcalnum_l
@ cdecl _ismbcalpha(long) ucrtbase._ismbcalpha
@ stub _ismbcalpha_l
@ stub _ismbcblank

View file

@ -398,7 +398,7 @@
@ cdecl _o__ismbbtrail(long) ucrtbase._o__ismbbtrail
@ cdecl _o__ismbbtrail_l(long ptr) ucrtbase._o__ismbbtrail_l
@ cdecl _o__ismbcalnum(long) ucrtbase._o__ismbcalnum
@ stub _o__ismbcalnum_l
@ cdecl _o__ismbcalnum_l(long ptr) ucrtbase._o__ismbcalnum_l
@ cdecl _o__ismbcalpha(long) ucrtbase._o__ismbcalpha
@ stub _o__ismbcalpha_l
@ stub _o__ismbcblank

View file

@ -975,7 +975,7 @@
@ cdecl _ismbbtrail(long)
@ cdecl _ismbbtrail_l(long ptr)
@ cdecl _ismbcalnum(long)
@ stub _ismbcalnum_l
@ cdecl _ismbcalnum_l(long ptr)
@ cdecl _ismbcalpha(long)
@ stub _ismbcalpha_l
@ cdecl _ismbcdigit(long)

View file

@ -1321,7 +1321,7 @@
@ cdecl _ismbbtrail(long)
@ cdecl _ismbbtrail_l(long ptr)
@ cdecl _ismbcalnum(long)
@ stub _ismbcalnum_l
@ cdecl _ismbcalnum_l(long ptr)
@ cdecl _ismbcalpha(long)
@ stub _ismbcalpha_l
@ cdecl _ismbcdigit(long)

View file

@ -1324,7 +1324,7 @@
@ cdecl _ismbbtrail(long)
@ cdecl _ismbbtrail_l(long ptr)
@ cdecl _ismbcalnum(long)
@ stub _ismbcalnum_l
@ cdecl _ismbcalnum_l(long ptr)
@ cdecl _ismbcalpha(long)
@ stub _ismbcalpha_l
@ stub _ismbcblank

View file

@ -647,7 +647,7 @@
@ cdecl _ismbbtrail(long)
@ cdecl _ismbbtrail_l(long ptr)
@ cdecl _ismbcalnum(long)
@ stub _ismbcalnum_l
@ cdecl _ismbcalnum_l(long ptr)
@ cdecl _ismbcalpha(long)
@ stub _ismbcalpha_l
@ cdecl _ismbcdigit(long)

View file

@ -625,7 +625,7 @@
@ cdecl _ismbbtrail(long)
@ cdecl _ismbbtrail_l(long ptr)
@ cdecl _ismbcalnum(long)
@ stub _ismbcalnum_l
@ cdecl _ismbcalnum_l(long ptr)
@ cdecl _ismbcalpha(long)
@ stub _ismbcalpha_l
@ cdecl _ismbcdigit(long)

View file

@ -84,26 +84,37 @@ static const unsigned char mbctombb_932_kana[] = {
0xd2,0xd3,0xac,0xd4,0xad,0xd5,0xae,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdc,0xb2,
0xb4,0xa6,0xdd,0xb3,0xb6,0xb9};
static MSVCRT_wchar_t msvcrt_mbc_to_wc_l(unsigned int ch, MSVCRT__locale_t locale)
{
MSVCRT_pthreadmbcinfo mbcinfo;
MSVCRT_wchar_t chW;
char mbch[2];
int n_chars;
if(locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if (ch <= 0xff) {
mbch[0] = ch;
n_chars = 1;
} else {
mbch[0] = (ch >> 8) & 0xff;
mbch[1] = ch & 0xff;
n_chars = 2;
}
if (!MultiByteToWideChar(mbcinfo->mbcodepage, 0, mbch, n_chars, &chW, 1))
{
WARN("MultiByteToWideChar failed on %x\n", ch);
return 0;
}
return chW;
}
static MSVCRT_wchar_t msvcrt_mbc_to_wc(unsigned int ch)
{
MSVCRT_wchar_t chW;
char mbch[2];
int n_chars;
if (ch <= 0xff) {
mbch[0] = ch;
n_chars = 1;
} else {
mbch[0] = (ch >> 8) & 0xff;
mbch[1] = ch & 0xff;
n_chars = 2;
}
if (!MultiByteToWideChar(get_mbcinfo()->mbcodepage, 0, mbch, n_chars, &chW, 1))
{
WARN("MultiByteToWideChar failed on %x\n", ch);
return 0;
}
return chW;
return msvcrt_mbc_to_wc_l(ch, NULL);
}
static inline MSVCRT_size_t u_strlen( const unsigned char *str )
@ -1476,13 +1487,20 @@ int CDECL _ismbcsymbol(unsigned int ch)
return ((ctype & C3_SYMBOL) != 0);
}
/*********************************************************************
* _ismbcalnum_l (MSVCRT.@)
*/
int CDECL _ismbcalnum_l(unsigned int ch, MSVCRT__locale_t locale)
{
return MSVCRT__iswalnum_l( msvcrt_mbc_to_wc_l(ch, locale), locale );
}
/*********************************************************************
* _ismbcalnum (MSVCRT.@)
*/
int CDECL _ismbcalnum(unsigned int ch)
{
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
return (get_char_typeW( wch ) & (C1_ALPHA | C1_DIGIT));
return _ismbcalnum_l( ch, NULL );
}
/*********************************************************************

View file

@ -1201,6 +1201,7 @@ int __cdecl MSVCRT_wcsncmp(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, MSVCRT_
int __cdecl MSVCRT__wcsnicmp(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, MSVCRT_size_t);
int __cdecl MSVCRT_towlower(MSVCRT_wint_t);
int __cdecl MSVCRT_towupper(MSVCRT_wint_t);
int __cdecl MSVCRT__iswalnum_l(MSVCRT_wchar_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

@ -593,7 +593,7 @@
@ cdecl _ismbbtrail(long)
@ cdecl _ismbbtrail_l(long ptr)
@ cdecl _ismbcalnum(long)
# stub _ismbcalnum_l(long ptr)
@ cdecl _ismbcalnum_l(long ptr)
@ cdecl _ismbcalpha(long)
# stub _ismbcalpha_l(long ptr)
@ cdecl _ismbcdigit(long)

View file

@ -463,7 +463,7 @@
@ cdecl _ismbbtrail(long)
@ cdecl _ismbbtrail_l(long ptr)
@ cdecl _ismbcalnum(long)
@ stub _ismbcalnum_l
@ cdecl _ismbcalnum_l(long ptr)
@ cdecl _ismbcalpha(long)
@ stub _ismbcalpha_l
@ stub _ismbcblank
@ -1062,7 +1062,7 @@
@ cdecl _o__ismbbtrail(long) _ismbbtrail
@ cdecl _o__ismbbtrail_l(long ptr) _ismbbtrail_l
@ cdecl _o__ismbcalnum(long) _ismbcalnum
@ stub _o__ismbcalnum_l
@ cdecl _o__ismbcalnum_l(long ptr) _ismbcalnum_l
@ cdecl _o__ismbcalpha(long) _ismbcalpha
@ stub _o__ismbcalpha_l
@ stub _o__ismbcblank