Commit a85bc781 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

kernelbase: Use translated Unicode default char to check invalid chars.

parent 3bb92d77
...@@ -1005,12 +1005,15 @@ static void test_undefined_byte_char(void) ...@@ -1005,12 +1005,15 @@ static void test_undefined_byte_char(void)
LPCSTR str; LPCSTR str;
BOOL is_error; BOOL is_error;
} testset[] = { } testset[] = {
{ 37, "\x6f", FALSE },
{ 874, "\xdd", TRUE }, { 874, "\xdd", TRUE },
{ 932, "\xfe", TRUE }, { 932, "\xfe", TRUE },
{ 932, "\x80", FALSE }, { 932, "\x80", FALSE },
{ 932, "\x81\x45", FALSE },
{ 936, "\xff", TRUE }, { 936, "\xff", TRUE },
{ 949, "\xff", TRUE }, { 949, "\xff", TRUE },
{ 950, "\xff", TRUE }, { 950, "\xff", TRUE },
{ 1252, "?", FALSE },
{ 1252, "\x90", FALSE }, { 1252, "\x90", FALSE },
{ 1253, "\xaa", TRUE }, { 1253, "\xaa", TRUE },
{ 1255, "\xff", TRUE }, { 1255, "\xff", TRUE },
......
...@@ -1044,12 +1044,12 @@ static int check_invalid_chars( const CPTABLEINFO *info, const unsigned char *sr ...@@ -1044,12 +1044,12 @@ static int check_invalid_chars( const CPTABLEINFO *info, const unsigned char *sr
{ {
if (srclen == 1) break; /* partial char, error */ if (srclen == 1) break; /* partial char, error */
if (info->DBCSOffsets[off + src[1]] == info->UniDefaultChar && if (info->DBCSOffsets[off + src[1]] == info->UniDefaultChar &&
((src[0] << 8) | src[1]) != info->TransDefaultChar) break; ((src[0] << 8) | src[1]) != info->TransUniDefaultChar) break;
src++; src++;
srclen--; srclen--;
continue; continue;
} }
if (info->MultiByteTable[*src] == info->UniDefaultChar && *src != info->TransDefaultChar) if (info->MultiByteTable[*src] == info->UniDefaultChar && *src != info->TransUniDefaultChar)
break; break;
if (is_private_use_area_char( info->MultiByteTable[*src] )) break; if (is_private_use_area_char( info->MultiByteTable[*src] )) break;
} }
...@@ -1058,7 +1058,7 @@ static int check_invalid_chars( const CPTABLEINFO *info, const unsigned char *sr ...@@ -1058,7 +1058,7 @@ static int check_invalid_chars( const CPTABLEINFO *info, const unsigned char *sr
{ {
for ( ; srclen; src++, srclen-- ) for ( ; srclen; src++, srclen-- )
{ {
if (info->MultiByteTable[*src] == info->UniDefaultChar && *src != info->TransDefaultChar) if (info->MultiByteTable[*src] == info->UniDefaultChar && *src != info->TransUniDefaultChar)
break; break;
if (is_private_use_area_char( info->MultiByteTable[*src] )) break; if (is_private_use_area_char( info->MultiByteTable[*src] )) break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment