libwine: MB_ERR_INVALID_CHARS makes an error when the undefined byte character is used.
This commit is contained in:
parent
79d7cd76f9
commit
16d5737009
|
@ -385,7 +385,6 @@ static void test_undefined_byte_char(void)
|
||||||
ret = MultiByteToWideChar(testset[i].codepage, MB_ERR_INVALID_CHARS,
|
ret = MultiByteToWideChar(testset[i].codepage, MB_ERR_INVALID_CHARS,
|
||||||
testset[i].str, -1, NULL, 0);
|
testset[i].str, -1, NULL, 0);
|
||||||
if (testset[i].is_error) {
|
if (testset[i].is_error) {
|
||||||
todo_wine
|
|
||||||
ok(ret == 0 && GetLastError() == ERROR_NO_UNICODE_TRANSLATION,
|
ok(ret == 0 && GetLastError() == ERROR_NO_UNICODE_TRANSLATION,
|
||||||
"ret is %d, GetLastError is %u (cp %d)\n",
|
"ret is %d, GetLastError is %u (cp %d)\n",
|
||||||
ret, GetLastError(), testset[i].codepage);
|
ret, GetLastError(), testset[i].codepage);
|
||||||
|
|
|
@ -39,6 +39,13 @@ static int get_decomposition( WCHAR src, WCHAR *dst, unsigned int dstlen )
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check the code whether it is in Unicode Private Use Area (PUA). */
|
||||||
|
/* MB_ERR_INVALID_CHARS raises an error converting from 1-byte character to PUA. */
|
||||||
|
static inline int is_private_use_area_char(WCHAR code)
|
||||||
|
{
|
||||||
|
return (code >= 0xe000 && code <= 0xf8ff);
|
||||||
|
}
|
||||||
|
|
||||||
/* check src string for invalid chars; return non-zero if invalid char found */
|
/* check src string for invalid chars; return non-zero if invalid char found */
|
||||||
static inline int check_invalid_chars_sbcs( const struct sbcs_table *table, int flags,
|
static inline int check_invalid_chars_sbcs( const struct sbcs_table *table, int flags,
|
||||||
const unsigned char *src, unsigned int srclen )
|
const unsigned char *src, unsigned int srclen )
|
||||||
|
@ -49,7 +56,8 @@ static inline int check_invalid_chars_sbcs( const struct sbcs_table *table, int
|
||||||
+ (def_unicode_char & 0xff)];
|
+ (def_unicode_char & 0xff)];
|
||||||
while (srclen)
|
while (srclen)
|
||||||
{
|
{
|
||||||
if (cp2uni[*src] == def_unicode_char && *src != def_char) break;
|
if ((cp2uni[*src] == def_unicode_char && *src != def_char) ||
|
||||||
|
is_private_use_area_char(cp2uni[*src])) break;
|
||||||
src++;
|
src++;
|
||||||
srclen--;
|
srclen--;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +175,8 @@ static inline int check_invalid_chars_dbcs( const struct dbcs_table *table,
|
||||||
src++;
|
src++;
|
||||||
srclen--;
|
srclen--;
|
||||||
}
|
}
|
||||||
else if (cp2uni[*src] == def_unicode_char && *src != def_char) break;
|
else if ((cp2uni[*src] == def_unicode_char && *src != def_char) ||
|
||||||
|
is_private_use_area_char(cp2uni[*src])) break;
|
||||||
src++;
|
src++;
|
||||||
srclen--;
|
srclen--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue