Commit 31360d47 authored by Alexandre Julliard's avatar Alexandre Julliard

unicode: Use a standard two-level mapping table for the digit map.

parent d5bd6673
...@@ -869,7 +869,10 @@ static int fold_digits( const WCHAR *src, int srclen, WCHAR *dst, int dstlen ) ...@@ -869,7 +869,10 @@ static int fold_digits( const WCHAR *src, int srclen, WCHAR *dst, int dstlen )
if (!dstlen) return srclen; if (!dstlen) return srclen;
if (srclen > dstlen) return 0; if (srclen > dstlen) return 0;
for (i = 0; i < srclen; i++) for (i = 0; i < srclen; i++)
dst[i] = src[i] + wine_digitmap[wine_digitmap[src[i] >> 8] + (src[i] & 0xff)]; {
WCHAR digit = get_table_entry( wine_digitmap, src[i] );
dst[i] = digit ? digit : src[i];
}
return srclen; return srclen;
} }
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
static inline WCHAR to_unicode_digit( WCHAR ch ) static inline WCHAR to_unicode_digit( WCHAR ch )
{ {
extern const WCHAR wine_digitmap[] DECLSPEC_HIDDEN; extern const WCHAR wine_digitmap[] DECLSPEC_HIDDEN;
return ch + wine_digitmap[wine_digitmap[ch >> 8] + (ch & 0xff)]; WCHAR ret = wine_digitmap[wine_digitmap[wine_digitmap[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0xf)];
return ret ? ret : ch;
} }
static inline WCHAR to_unicode_native( WCHAR ch ) static inline WCHAR to_unicode_native( WCHAR ch )
......
...@@ -1796,7 +1796,7 @@ sub dump_digit_folding($$) ...@@ -1796,7 +1796,7 @@ sub dump_digit_folding($$)
print OUTPUT "/* DO NOT EDIT!! */\n\n"; print OUTPUT "/* DO NOT EDIT!! */\n\n";
print OUTPUT "#include \"windef.h\"\n\n"; print OUTPUT "#include \"windef.h\"\n\n";
dump_case_table( "DECLSPEC_HIDDEN wine_digitmap", @digitmap_table ); dump_two_level_mapping( "wine_digitmap", 0, @digitmap_table );
if ($compat) if ($compat)
{ {
print OUTPUT "\n"; print OUTPUT "\n";
......
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