Size compose_table correctly. (#123421, Simon Josefsson)
authorNoah Levitt <nlevitt@columbia.edu>
Fri, 30 Jan 2004 23:20:16 +0000 (23:20 +0000)
committerNoah Levitt <nlevitt@src.gnome.org>
Fri, 30 Jan 2004 23:20:16 +0000 (23:20 +0000)
2004-01-30  Noah Levitt  <nlevitt@columbia.edu>

* 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
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gen-unicode-tables.pl
glib/gunicomp.h
glib/gunidecomp.c

index 5ddd22e..2d3b9e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-30  Noah Levitt  <nlevitt@columbia.edu>
+
+       * 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  <yosh@gimp.org>
 
        * m4macros/glib-2.0.m4
index 5ddd22e..2d3b9e2 100644 (file)
@@ -1,3 +1,13 @@
+2004-01-30  Noah Levitt  <nlevitt@columbia.edu>
+
+       * 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  <yosh@gimp.org>
 
        * m4macros/glib-2.0.m4
index 5ddd22e..2d3b9e2 100644 (file)
@@ -1,3 +1,13 @@
+2004-01-30  Noah Levitt  <nlevitt@columbia.edu>
+
+       * 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  <yosh@gimp.org>
 
        * m4macros/glib-2.0.m4
index 5ddd22e..2d3b9e2 100644 (file)
@@ -1,3 +1,13 @@
+2004-01-30  Noah Levitt  <nlevitt@columbia.edu>
+
+       * 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  <yosh@gimp.org>
 
        * m4macros/glib-2.0.m4
index 5ddd22e..2d3b9e2 100644 (file)
@@ -1,3 +1,13 @@
+2004-01-30  Noah Levitt  <nlevitt@columbia.edu>
+
+       * 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  <yosh@gimp.org>
 
        * m4macros/glib-2.0.m4
index 5ddd22e..2d3b9e2 100644 (file)
@@ -1,3 +1,13 @@
+2004-01-30  Noah Levitt  <nlevitt@columbia.edu>
+
+       * 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  <yosh@gimp.org>
 
        * m4macros/glib-2.0.m4
index 0e5389e..5e600ba 100755 (executable)
@@ -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";
index 26975b1..36429ba 100644 (file)
@@ -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 */,
index 193ef70..8c32b10 100644 (file)
@@ -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,