From 782188d5392ad8616e099850e08bc0c512201cb7 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Fri, 30 Jan 2004 23:20:16 +0000 Subject: [PATCH] Size compose_table correctly. (#123421, Simon Josefsson) 2004-01-30 Noah Levitt * glib/gunicomp.h: * glib/gunidecomp.c: * glib/gen-unicode-tables.pl: Size compose_table correctly. (#123421, Simon Josefsson) * glib/gen-unicode-tables.pl: Get rid of some new warnings from perl 5.8.1. --- ChangeLog | 10 ++++++++++ ChangeLog.pre-2-10 | 10 ++++++++++ ChangeLog.pre-2-12 | 10 ++++++++++ ChangeLog.pre-2-4 | 10 ++++++++++ ChangeLog.pre-2-6 | 10 ++++++++++ ChangeLog.pre-2-8 | 10 ++++++++++ glib/gen-unicode-tables.pl | 12 +++++++----- glib/gunicomp.h | 4 +++- glib/gunidecomp.c | 2 +- 9 files changed, 71 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ddd22e..2d3b9e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-01-30 Noah Levitt + + * glib/gunicomp.h: + * glib/gunidecomp.c: + * glib/gen-unicode-tables.pl: Size compose_table correctly. (#123421, + Simon Josefsson) + + * glib/gen-unicode-tables.pl: Get rid of some new warnings from perl + 5.8.1. + Tue Jan 27 18:45:47 2004 Manish Singh * m4macros/glib-2.0.m4 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 5ddd22e..2d3b9e2 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +2004-01-30 Noah Levitt + + * glib/gunicomp.h: + * glib/gunidecomp.c: + * glib/gen-unicode-tables.pl: Size compose_table correctly. (#123421, + Simon Josefsson) + + * glib/gen-unicode-tables.pl: Get rid of some new warnings from perl + 5.8.1. + Tue Jan 27 18:45:47 2004 Manish Singh * m4macros/glib-2.0.m4 diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 5ddd22e..2d3b9e2 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,13 @@ +2004-01-30 Noah Levitt + + * glib/gunicomp.h: + * glib/gunidecomp.c: + * glib/gen-unicode-tables.pl: Size compose_table correctly. (#123421, + Simon Josefsson) + + * glib/gen-unicode-tables.pl: Get rid of some new warnings from perl + 5.8.1. + Tue Jan 27 18:45:47 2004 Manish Singh * m4macros/glib-2.0.m4 diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 5ddd22e..2d3b9e2 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +2004-01-30 Noah Levitt + + * glib/gunicomp.h: + * glib/gunidecomp.c: + * glib/gen-unicode-tables.pl: Size compose_table correctly. (#123421, + Simon Josefsson) + + * glib/gen-unicode-tables.pl: Get rid of some new warnings from perl + 5.8.1. + Tue Jan 27 18:45:47 2004 Manish Singh * m4macros/glib-2.0.m4 diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 5ddd22e..2d3b9e2 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +2004-01-30 Noah Levitt + + * glib/gunicomp.h: + * glib/gunidecomp.c: + * glib/gen-unicode-tables.pl: Size compose_table correctly. (#123421, + Simon Josefsson) + + * glib/gen-unicode-tables.pl: Get rid of some new warnings from perl + 5.8.1. + Tue Jan 27 18:45:47 2004 Manish Singh * m4macros/glib-2.0.m4 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 5ddd22e..2d3b9e2 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +2004-01-30 Noah Levitt + + * glib/gunicomp.h: + * glib/gunidecomp.c: + * glib/gen-unicode-tables.pl: Size compose_table correctly. (#123421, + Simon Josefsson) + + * glib/gen-unicode-tables.pl: Get rid of some new warnings from perl + 5.8.1. + Tue Jan 27 18:45:47 2004 Manish Singh * m4macros/glib-2.0.m4 diff --git a/glib/gen-unicode-tables.pl b/glib/gen-unicode-tables.pl index 0e5389e..5e600ba 100755 --- a/glib/gen-unicode-tables.pl +++ b/glib/gen-unicode-tables.pl @@ -766,9 +766,10 @@ sub escape { my ($string) = @_; - $string =~ s/(\C)/sprintf "\\x%02x",ord($1)/eg; + my $escaped = unpack("H*", $string); + $escaped =~ s/(.{2})/\\x$1/g; - return $string; + return $escaped; } # Returns the offset of $decomp in the offset string. Updates the @@ -1204,6 +1205,8 @@ sub output_composition_table $last = $code if $code > $last; } + printf OUT "#define COMPOSE_TABLE_LAST %d\n\n", $last / 256; + # Output lookup table my @row; @@ -1215,16 +1218,15 @@ sub output_composition_table } printf OUT "\n};\n\n"; - print OUT "static const gint16 compose_table[256] = {\n"; + print OUT "static const gint16 compose_table[COMPOSE_TABLE_LAST + 1] = {\n"; for (my $count = 0; $count <= $last; $count += 256) { print OUT ",\n" if $count > 0; print OUT " ", $row[$count / 256]; + $bytes_out += 2; } print OUT "\n};\n\n"; - $bytes_out += 256 * 2; - # Output first singletons print OUT "static const guint16 compose_first_single[][2] = {\n"; diff --git a/glib/gunicomp.h b/glib/gunicomp.h index 26975b1..36429ba 100644 --- a/glib/gunicomp.h +++ b/glib/gunicomp.h @@ -3,6 +3,8 @@ #define COMPOSE_SECOND_START 357 #define COMPOSE_SECOND_SINGLE_START 388 +#define COMPOSE_TABLE_LAST 48 + static const guint16 compose_data[][256] = { { /* page 0, index 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -222,7 +224,7 @@ static const guint16 compose_data[][256] = { } }; -static const gint16 compose_table[256] = { +static const gint16 compose_table[COMPOSE_TABLE_LAST + 1] = { 0 /* page 0 */, 1 /* page 1 */, 2 /* page 2 */, diff --git a/glib/gunidecomp.c b/glib/gunidecomp.c index 193ef70..8c32b10 100644 --- a/glib/gunidecomp.c +++ b/glib/gunidecomp.c @@ -281,7 +281,7 @@ combine_hangul (gunichar a, : (compose_data[compose_table[Page]][Char])) #define COMPOSE_INDEX(Char) \ - (((Char) > (G_UNICODE_LAST_CHAR)) ? 0 : CI((Char) >> 8, (Char) & 0xff)) + (((Char >> 8) > (COMPOSE_TABLE_LAST)) ? 0 : CI((Char) >> 8, (Char) & 0xff)) static gboolean combine (gunichar a, -- 2.7.4