"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dlls/msvcrt/mbcs.c" between
wine-5.12.tar.xz and wine-5.13.tar.xz

About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs. Development release.

mbcs.c  (wine-5.12.tar.xz):mbcs.c  (wine-5.13.tar.xz)
skipping to change at line 87 skipping to change at line 87
/* Maps multibyte cp932 hiragana/katakana to single-byte equivalents */ /* Maps multibyte cp932 hiragana/katakana to single-byte equivalents */
static const unsigned char mbctombb_932_kana[] = { static const unsigned char mbctombb_932_kana[] = {
0xa7,0xb1,0xa8,0xb2,0xa9,0xb3,0xaa,0xb4,0xab,0xb5,0xb6,0xb6,0xb7,0xb7,0xb8,0xb 8, 0xa7,0xb1,0xa8,0xb2,0xa9,0xb3,0xaa,0xb4,0xab,0xb5,0xb6,0xb6,0xb7,0xb7,0xb8,0xb 8,
0xb9,0xb9,0xba,0xba,0xbb,0xbb,0xbc,0xbc,0xbd,0xbd,0xbe,0xbe,0xbf,0xbf,0xc0,0xc 0, 0xb9,0xb9,0xba,0xba,0xbb,0xbb,0xbc,0xbc,0xbd,0xbd,0xbe,0xbe,0xbf,0xbf,0xc0,0xc 0,
0xc1,0xc1,0xaf,0xc2,0xc2,0xc3,0xc3,0xc4,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xc a, 0xc1,0xc1,0xaf,0xc2,0xc2,0xc3,0xc3,0xc4,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xc a,
0xca,0xcb,0xcb,0xcb,0xcc,0xcc,0xcc,0xcd,0xcd,0xcd,0xce,0xce,0xce,0xcf,0xd0,0xd 1, 0xca,0xcb,0xcb,0xcb,0xcc,0xcc,0xcc,0xcd,0xcd,0xcd,0xce,0xce,0xce,0xcf,0xd0,0xd 1,
0xd2,0xd3,0xac,0xd4,0xad,0xd5,0xae,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdc,0xb 2, 0xd2,0xd3,0xac,0xd4,0xad,0xd5,0xae,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdc,0xb 2,
0xb4,0xa6,0xdd,0xb3,0xb6,0xb9}; 0xb4,0xa6,0xdd,0xb3,0xb6,0xb9};
static MSVCRT_wchar_t msvcrt_mbc_to_wc_l(unsigned int ch, MSVCRT__locale_t local
e)
{
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) static MSVCRT_wchar_t msvcrt_mbc_to_wc(unsigned int ch)
{ {
MSVCRT_wchar_t chW; return msvcrt_mbc_to_wc_l(ch, NULL);
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;
} }
static inline MSVCRT_size_t u_strlen( const unsigned char *str ) static inline MSVCRT_size_t u_strlen( const unsigned char *str )
{ {
return strlen( (const char*) str ); return strlen( (const char*) str );
} }
static inline unsigned char* u_strncat( unsigned char* dst, const unsigned char* src, MSVCRT_size_t len ) static inline unsigned char* u_strncat( unsigned char* dst, const unsigned char* src, MSVCRT_size_t len )
{ {
return (unsigned char*)strncat( (char*)dst, (const char*)src, len); return (unsigned char*)strncat( (char*)dst, (const char*)src, len);
skipping to change at line 212 skipping to change at line 223
*/ */
int _setmbcp_l(int cp, LCID lcid, MSVCRT_pthreadmbcinfo mbcinfo) int _setmbcp_l(int cp, LCID lcid, MSVCRT_pthreadmbcinfo mbcinfo)
{ {
const char format[] = ".%d"; const char format[] = ".%d";
int newcp; int newcp;
CPINFO cpi; CPINFO cpi;
BYTE *bytes; BYTE *bytes;
WORD chartypes[256]; WORD chartypes[256];
char bufA[256]; char bufA[256];
WCHAR bufW[256]; WCHAR bufW[256], lowW[256], upW[256];
int charcount; int charcount;
int ret; int ret;
int i; int i;
if(!mbcinfo) if(!mbcinfo)
mbcinfo = get_mbcinfo(); mbcinfo = get_mbcinfo();
switch (cp) switch (cp)
{ {
case _MB_CP_ANSI: case _MB_CP_ANSI:
skipping to change at line 313 skipping to change at line 324
charcount = 0; charcount = 0;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
if (!(mbcinfo->mbctype[i + 1] & _M1)) if (!(mbcinfo->mbctype[i + 1] & _M1))
bufA[charcount++] = i; bufA[charcount++] = i;
ret = MultiByteToWideChar(newcp, 0, bufA, charcount, bufW, charcount); ret = MultiByteToWideChar(newcp, 0, bufA, charcount, bufW, charcount);
if (ret != charcount) if (ret != charcount)
ERR("MultiByteToWideChar of chars failed for cp %d, ret=%d (exp %d), error=% d\n", newcp, ret, charcount, GetLastError()); ERR("MultiByteToWideChar of chars failed for cp %d, ret=%d (exp %d), error=% d\n", newcp, ret, charcount, GetLastError());
GetStringTypeW(CT_CTYPE1, bufW, charcount, chartypes); GetStringTypeW(CT_CTYPE1, bufW, charcount, chartypes);
LCMapStringW(lcid, LCMAP_LOWERCASE, bufW, charcount, lowW, charcount);
LCMapStringW(lcid, LCMAP_UPPERCASE, bufW, charcount, upW, charcount);
charcount = 0; charcount = 0;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
if (!(mbcinfo->mbctype[i + 1] & _M1)) if (!(mbcinfo->mbctype[i + 1] & _M1))
{ {
if (chartypes[charcount] & C1_UPPER) if (chartypes[charcount] & C1_UPPER)
{ {
mbcinfo->mbctype[i + 1] |= _SBUP; mbcinfo->mbctype[i + 1] |= _SBUP;
bufW[charcount] = tolowerW(bufW[charcount]); bufW[charcount] = lowW[charcount];
} }
else if (chartypes[charcount] & C1_LOWER) else if (chartypes[charcount] & C1_LOWER)
{ {
mbcinfo->mbctype[i + 1] |= _SBLOW; mbcinfo->mbctype[i + 1] |= _SBLOW;
bufW[charcount] = toupperW(bufW[charcount]); bufW[charcount] = upW[charcount];
} }
charcount++; charcount++;
} }
ret = WideCharToMultiByte(newcp, 0, bufW, charcount, bufA, charcount, NULL, NU LL); ret = WideCharToMultiByte(newcp, 0, bufW, charcount, bufA, charcount, NULL, NU LL);
if (ret != charcount) if (ret != charcount)
ERR("WideCharToMultiByte failed for cp %d, ret=%d (exp %d), error=%d\n", new cp, ret, charcount, GetLastError()); ERR("WideCharToMultiByte failed for cp %d, ret=%d (exp %d), error=%d\n", new cp, ret, charcount, GetLastError());
charcount = 0; charcount = 0;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
skipping to change at line 1389 skipping to change at line 1402
if ((c >= 0x20 && c <= 0x7e) || (c >= 0xa1 && c <= 0xdf)) if ((c >= 0x20 && c <= 0x7e) || (c >= 0xa1 && c <= 0xdf))
return _MBC_SINGLE; return _MBC_SINGLE;
else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc))
return _MBC_LEAD; return _MBC_LEAD;
else else
return _MBC_ILLEGAL; return _MBC_ILLEGAL;
} }
} }
/********************************************************************* /*********************************************************************
* _ismbbkana(MSVCRT.@) * _ismbbkana_l(MSVCRT.@)
*/
int CDECL _ismbbkana_l(unsigned int c, MSVCRT__locale_t locale)
{
MSVCRT_pthreadmbcinfo mbcinfo;
if(locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if(mbcinfo->mbcodepage == 932)
{
/* Japanese/Katakana, CP 932 */
return (c >= 0xa1 && c <= 0xdf);
}
return 0;
}
/*********************************************************************
* _ismbbkana(MSVCRT.@)
*/ */
int CDECL _ismbbkana(unsigned int c) int CDECL _ismbbkana(unsigned int c)
{ {
/* FIXME: use lc_ctype when supported, not lc_all */ return _ismbbkana_l( c, NULL );
if(get_mbcinfo()->mbcodepage == 932) }
{
/* Japanese/Katakana, CP 932 */ /*********************************************************************
return (c >= 0xa1 && c <= 0xdf); * _ismbcdigit_l(MSVCRT.@)
} */
return 0; int CDECL _ismbcdigit_l(unsigned int ch, MSVCRT__locale_t locale)
{
return MSVCRT__iswdigit_l( msvcrt_mbc_to_wc_l(ch, locale), locale );
} }
/********************************************************************* /*********************************************************************
* _ismbcdigit(MSVCRT.@) * _ismbcdigit(MSVCRT.@)
*/ */
int CDECL _ismbcdigit(unsigned int ch) int CDECL _ismbcdigit(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); return _ismbcdigit_l( ch, NULL );
return (get_char_typeW( wch ) & C1_DIGIT); }
/*********************************************************************
* _ismbcgraph_l(MSVCRT.@)
*/
int CDECL _ismbcgraph_l(unsigned int ch, MSVCRT__locale_t locale)
{
return MSVCRT__iswgraph_l( msvcrt_mbc_to_wc_l(ch, locale), locale );
} }
/********************************************************************* /*********************************************************************
* _ismbcgraph(MSVCRT.@) * _ismbcgraph(MSVCRT.@)
*/ */
int CDECL _ismbcgraph(unsigned int ch) int CDECL _ismbcgraph(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); return _ismbcgraph_l( ch, NULL );
return (get_char_typeW( wch ) & (C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | }
C1_ALPHA));
/*********************************************************************
* _ismbcalpha_l (MSVCRT.@)
*/
int CDECL _ismbcalpha_l(unsigned int ch, MSVCRT__locale_t locale)
{
return MSVCRT__iswalpha_l( msvcrt_mbc_to_wc_l(ch, locale), locale );
} }
/********************************************************************* /*********************************************************************
* _ismbcalpha (MSVCRT.@) * _ismbcalpha (MSVCRT.@)
*/ */
int CDECL _ismbcalpha(unsigned int ch) int CDECL _ismbcalpha(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); return _ismbcalpha_l( ch, NULL );
return (get_char_typeW( wch ) & C1_ALPHA); }
/*********************************************************************
* _ismbclower_l (MSVCRT.@)
*/
int CDECL _ismbclower_l(unsigned int ch, MSVCRT__locale_t locale)
{
return MSVCRT__iswlower_l( msvcrt_mbc_to_wc_l(ch, locale), locale );
} }
/********************************************************************* /*********************************************************************
* _ismbclower (MSVCRT.@) * _ismbclower (MSVCRT.@)
*/ */
int CDECL _ismbclower(unsigned int ch) int CDECL _ismbclower(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); return _ismbclower_l( ch, NULL );
return (get_char_typeW( wch ) & C1_UPPER); }
/*********************************************************************
* _ismbcupper_l (MSVCRT.@)
*/
int CDECL _ismbcupper_l(unsigned int ch, MSVCRT__locale_t locale)
{
return MSVCRT__iswupper_l( msvcrt_mbc_to_wc_l(ch, locale), locale );
} }
/********************************************************************* /*********************************************************************
* _ismbcupper (MSVCRT.@) * _ismbcupper (MSVCRT.@)
*/ */
int CDECL _ismbcupper(unsigned int ch) int CDECL _ismbcupper(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); return _ismbcupper_l( ch, NULL );
return (get_char_typeW( wch ) & C1_LOWER);
} }
/********************************************************************* /*********************************************************************
* _ismbcsymbol(MSVCRT.@) * _ismbcsymbol(MSVCRT.@)
*/ */
int CDECL _ismbcsymbol(unsigned int ch) int CDECL _ismbcsymbol(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch );
WORD ctype; WORD ctype;
if (!GetStringTypeW(CT_CTYPE3, &wch, 1, &ctype)) if (!GetStringTypeW(CT_CTYPE3, &wch, 1, &ctype))
{ {
WARN("GetStringTypeW failed on %x\n", ch); WARN("GetStringTypeW failed on %x\n", ch);
return 0; return 0;
} }
return ((ctype & C3_SYMBOL) != 0); 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.@) * _ismbcalnum (MSVCRT.@)
*/ */
int CDECL _ismbcalnum(unsigned int ch) int CDECL _ismbcalnum(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); return _ismbcalnum_l( ch, NULL );
return (get_char_typeW( wch ) & (C1_ALPHA | C1_DIGIT)); }
/*********************************************************************
* _ismbcspace_l (MSVCRT.@)
*/
int CDECL _ismbcspace_l(unsigned int ch, MSVCRT__locale_t locale)
{
return MSVCRT__iswspace_l( msvcrt_mbc_to_wc_l(ch, locale), locale );
} }
/********************************************************************* /*********************************************************************
* _ismbcspace (MSVCRT.@) * _ismbcspace (MSVCRT.@)
*/ */
int CDECL _ismbcspace(unsigned int ch) int CDECL _ismbcspace(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); return _ismbcspace_l( ch, NULL );
return (get_char_typeW( wch ) & C1_SPACE); }
/*********************************************************************
* _ismbcprint_l (MSVCRT.@)
*/
int CDECL _ismbcprint_l(unsigned int ch, MSVCRT__locale_t locale)
{
return MSVCRT__iswprint_l( msvcrt_mbc_to_wc_l(ch, locale), locale );
} }
/********************************************************************* /*********************************************************************
* _ismbcprint (MSVCRT.@) * _ismbcprint (MSVCRT.@)
*/ */
int CDECL _ismbcprint(unsigned int ch) int CDECL _ismbcprint(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); return _ismbcprint_l( ch, NULL );
return (get_char_typeW( wch ) & (C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | }
C1_ALPHA | C1_SPACE));
/*********************************************************************
* _ismbcpunct_l (MSVCRT.@)
*/
int CDECL _ismbcpunct_l(unsigned int ch, MSVCRT__locale_t locale)
{
return MSVCRT__iswpunct_l( msvcrt_mbc_to_wc_l(ch, locale), locale );
} }
/********************************************************************* /*********************************************************************
* _ismbcpunct(MSVCRT.@) * _ismbcpunct(MSVCRT.@)
*/ */
int CDECL _ismbcpunct(unsigned int ch) int CDECL _ismbcpunct(unsigned int ch)
{ {
MSVCRT_wchar_t wch = msvcrt_mbc_to_wc( ch ); return _ismbcpunct_l( ch, NULL );
return (get_char_typeW( wch ) & C1_PUNCT);
} }
/********************************************************************* /*********************************************************************
* _ismbchira(MSVCRT.@) * _ismbchira(MSVCRT.@)
*/ */
int CDECL _ismbchira(unsigned int c) int CDECL _ismbchira(unsigned int c)
{ {
if(get_mbcinfo()->mbcodepage == 932) if(get_mbcinfo()->mbcodepage == 932)
{ {
/* Japanese/Hiragana, CP 932 */ /* Japanese/Hiragana, CP 932 */
 End of changes. 18 change blocks. 
50 lines changed or deleted 138 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)