kernelbase: Use the digit table from locale.nls in FoldStringW().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-04-25 11:53:53 +02:00
parent ccbb341a8c
commit f3b77b8027
4 changed files with 1 additions and 123 deletions

View File

@ -9,7 +9,6 @@ C_SRCS = \
collation.c \
console.c \
debug.c \
digitmap.c \
file.c \
loader.c \
locale.c \

View File

@ -1,91 +0,0 @@
/* Unicode digit folding mappings */
/* generated from https://www.unicode.org/Public/14.0.0/ucd/UCD.zip:UnicodeData.txt */
/* DO NOT EDIT!! */
#include "windef.h"
const unsigned short DECLSPEC_HIDDEN wine_digitmap[619] =
{
/* level 1 offsets */
0x0100, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x0116, 0x0110,
0x010c, 0x0126, 0x0126, 0x0126, 0x0126, 0x0126, 0x0135, 0x0140,
0x014c, 0x010c, 0x010c, 0x0156, 0x010c, 0x010c, 0x010c, 0x010e,
0x0165, 0x0171, 0x017f, 0x018a, 0x0196, 0x010c, 0x010c, 0x010c,
0x019f, 0x010c, 0x010c, 0x010c, 0x01a9, 0x010c, 0x010c, 0x01b9,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x0140, 0x010c,
0x010f, 0x01c9, 0x013d, 0x010d, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c,
0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x010c, 0x0165,
/* level 2 offsets */
0x01d9, 0x01d9, 0x01d9, 0x01e9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01f7, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e3, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e3, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01e9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01e9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01e9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x0201, 0x0211, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e3, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x0221, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e9,
0x01e9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01e9, 0x01e9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x0231, 0x01e9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x020a,
0x0206, 0x0202, 0x023a, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x0240,
0x024b, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x0204, 0x025b, 0x0210, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01e9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9,
0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01d9, 0x01e9, 0x01d9,
0x01e9,
/* values */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0032, 0x0033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0031,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x0031, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0030, 0x0000, 0x0000, 0x0000, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0031,
0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039,
0x0000, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036,
0x0037, 0x0038, 0x0039, 0x0000, 0x0031, 0x0032, 0x0033, 0x0034,
0x0035, 0x0036
};

View File

@ -1856,12 +1856,6 @@ void init_locale( HMODULE module )
}
static inline USHORT get_table_entry( const USHORT *table, WCHAR ch )
{
return table[table[table[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0xf)];
}
static inline WCHAR casemap( const USHORT *table, WCHAR ch )
{
return ch + table[table[table[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0x0f)];
@ -2072,17 +2066,12 @@ static NTSTATUS expand_ligatures( const WCHAR *src, int srclen, WCHAR *dst, int
static NTSTATUS fold_digits( const WCHAR *src, int srclen, WCHAR *dst, int *dstlen )
{
extern const WCHAR wine_digitmap[] DECLSPEC_HIDDEN;
int i, len = *dstlen;
*dstlen = srclen;
if (!len) return STATUS_SUCCESS;
if (srclen > len) return STATUS_BUFFER_TOO_SMALL;
for (i = 0; i < srclen; i++)
{
WCHAR digit = get_table_entry( wine_digitmap, src[i] );
dst[i] = digit ? digit : src[i];
}
for (i = 0; i < srclen; i++) dst[i] = casemap( charmaps[CHARMAP_FOLDDIGITS], src[i] );
return STATUS_SUCCESS;
}

View File

@ -3253,24 +3253,6 @@ sub dump_vertical($$)
save_file($filename);
}
################################################################
# dump the digit folding tables
sub dump_digit_folding($)
{
my ($filename) = shift;
open OUTPUT,">$filename.new" or die "Cannot create $filename";
print "Building $filename\n";
print OUTPUT "/* Unicode digit folding mappings */\n";
print OUTPUT "/* generated from $UNIDATA:UnicodeData.txt */\n";
print OUTPUT "/* DO NOT EDIT!! */\n\n";
print OUTPUT "#include \"windef.h\"\n\n";
dump_two_level_mapping( "wine_digitmap", 0, 16, @digitmap_table );
close OUTPUT;
save_file($filename);
}
################################################################
# compress a mapping table by removing identical rows
sub compress_array($$@)
@ -5393,7 +5375,6 @@ load_data();
dump_sortkeys( "dlls/kernelbase/collation.c" );
dump_bidi_dir_table( "dlls/gdi32/uniscribe/direction.c" );
dump_bidi_dir_table( "dlls/dwrite/direction.c" );
dump_digit_folding( "dlls/kernelbase/digitmap.c" );
dump_mirroring( "dlls/gdi32/uniscribe/mirror.c" );
dump_mirroring( "dlls/dwrite/mirror.c" );
dump_bracket( "dlls/gdi32/uniscribe/bracket.c" );