]> git.sur5r.net Git - openldap/commitdiff
Fix ucnumber behavior
authorHoward Chu <hyc@openldap.org>
Mon, 31 May 2004 06:25:25 +0000 (06:25 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 31 May 2004 06:25:25 +0000 (06:25 +0000)
libraries/liblunicode/ucdata/api.txt
libraries/liblunicode/ucdata/ucdata.c
libraries/liblunicode/ucdata/ucgendat.c
libraries/liblunicode/ucdata/uctable.h

index d13b2a45622b89a661493a6447e52bef45e53b85..59170ba42d71771458172b58097d1b3c8ffe4295 100644 (file)
@@ -6,6 +6,18 @@
                              -------------------
 
 
+####
+NOTE: This library has been customized for use with OpenLDAP. The character
+data tables are hardcoded into the library and the load/unload/reload
+functions are no-ops. Also, the MUTT API claimed to be compatible with
+John Cowan's library but its ucnumber behavior was broken. This has been
+fixed in the OpenLDAP release.
+
+By default, the implementation specific properties in MUTTUCData.txt are
+not incorporated into the OpenLDAP build. You can supply them to ucgendat
+and recreate uctable.h if you need them.
+  -- hyc@openldap.org
+####
 
 
 -----------------------------------------------------------------------------
@@ -153,7 +165,15 @@ int ucnumber_lookup(unsigned long code, struct ucnumber *num)
 
   This function determines if the code is a number and fills in the `num'
   field with the numerator and denominator.  If the code happens to be a
-  single digit, the numerator and denominator fields will be the same.
+  single digit, the denominator field will be 1.
+
+####
+The original code would set numerator = denominator for regular digits.
+However, the Readme also claimed to be compatible with John Cowan's uctype
+library, but this behavior is both nonsensical and incompatible with the
+Cowan library. As such, it has been fixed here as described above.
+  -- hyc@openldap.org
+####
 
   If the function returns 0, the code is not a number.  Any other return
   value means the code is a number.
index 9e64122f85a5e49f64b9de3ac7e62b0a8220fbf7..7edff44ee01482c05d58e884abb8c60e4dea05cc 100644 (file)
@@ -1432,7 +1432,7 @@ main(void)
       printf("0x10000 NOT DEFINED\n");
 
     if (ucnumber_lookup(0x30, &num)) {
-        if (num.numerator != num.denominator)
+        if (num.denominator != 1)
           printf("UCNUMBER: 0x30 = %d/%d\n", num.numerator, num.denominator);
         else
           printf("UCNUMBER: 0x30 = %d\n", num.numerator);
@@ -1440,7 +1440,7 @@ main(void)
       printf("UCNUMBER: 0x30 NOT A NUMBER\n");
 
     if (ucnumber_lookup(0xbc, &num)) {
-        if (num.numerator != num.denominator)
+        if (num.denominator != 1)
           printf("UCNUMBER: 0xbc = %d/%d\n", num.numerator, num.denominator);
         else
           printf("UCNUMBER: 0xbc = %d\n", num.numerator);
@@ -1449,7 +1449,7 @@ main(void)
 
 
     if (ucnumber_lookup(0xff19, &num)) {
-        if (num.numerator != num.denominator)
+        if (num.denominator != 1)
           printf("UCNUMBER: 0xff19 = %d/%d\n", num.numerator, num.denominator);
         else
           printf("UCNUMBER: 0xff19 = %d\n", num.numerator);
@@ -1457,7 +1457,7 @@ main(void)
       printf("UCNUMBER: 0xff19 NOT A NUMBER\n");
 
     if (ucnumber_lookup(0x4e00, &num)) {
-        if (num.numerator != num.denominator)
+        if (num.denominator != 1)
           printf("UCNUMBER: 0x4e00 = %d/%d\n", num.numerator, num.denominator);
         else
           printf("UCNUMBER: 0x4e00 = %d\n", num.numerator);
@@ -1473,19 +1473,19 @@ main(void)
     printf("UCGETDIGIT: 0x969 = %d\n", dig);
 
     num = ucgetnumber(0x30);
-    if (num.numerator != num.denominator)
+    if (num.denominator != 1)
       printf("UCGETNUMBER: 0x30 = %d/%d\n", num.numerator, num.denominator);
     else
       printf("UCGETNUMBER: 0x30 = %d\n", num.numerator);
 
     num = ucgetnumber(0xbc);
-    if (num.numerator != num.denominator)
+    if (num.denominator != 1)
       printf("UCGETNUMBER: 0xbc = %d/%d\n", num.numerator, num.denominator);
     else
       printf("UCGETNUMBER: 0xbc = %d\n", num.numerator);
 
     num = ucgetnumber(0xff19);
-    if (num.numerator != num.denominator)
+    if (num.denominator != 1)
       printf("UCGETNUMBER: 0xff19 = %d/%d\n", num.numerator, num.denominator);
     else
       printf("UCGETNUMBER: 0xff19 = %d\n", num.numerator);
index 8539f7f1c1e9584b4e0a60b277ede960407b0299..7403a1dd81a7a11a3d92db1779ba9e80545c1b15 100644 (file)
@@ -1077,7 +1077,7 @@ read_cdata(FILE *in)
              * Adjust the denominator in case of integers and add the number.
              */
             if (wnum == 0)
-              number[1] = number[0];
+              number[1] = 1;
 
             add_number(code, number[0], number[1]);
         }
index a68723a3e97e8a52091fa5dbbcb45087ceef5fda..b6d0098bb5fd4f887a07090963c9e918b18588e4 100644 (file)
@@ -14292,26 +14292,26 @@ static const ac_uint4 _ucnum_nodes[] = {
 };
 
 static const short _ucnum_vals[] = {
-       0x0000, 0x0000, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003, 0x0003,
-       0x0004, 0x0004, 0x0005, 0x0005, 0x0006, 0x0006, 0x0007, 0x0007,
-       0x0008, 0x0008, 0x0009, 0x0009, 0x0001, 0x0004, 0x0001, 0x0002,
-       0x0003, 0x0004, 0x0010, 0x0010, 0x000a, 0x000a, 0x0064, 0x0064,
-       0x03e8, 0x03e8, 0x0003, 0x0002, 0x0005, 0x0002, 0x0007, 0x0002,
+       0x0000, 0x0001, 0x0001, 0x0001, 0x0002, 0x0001, 0x0003, 0x0001,
+       0x0004, 0x0001, 0x0005, 0x0001, 0x0006, 0x0001, 0x0007, 0x0001,
+       0x0008, 0x0001, 0x0009, 0x0001, 0x0001, 0x0004, 0x0001, 0x0002,
+       0x0003, 0x0004, 0x0010, 0x0001, 0x000a, 0x0001, 0x0064, 0x0001,
+       0x03e8, 0x0001, 0x0003, 0x0002, 0x0005, 0x0002, 0x0007, 0x0002,
        0x0009, 0x0002, 0x000b, 0x0002, 0x000d, 0x0002, 0x000f, 0x0002,
-       0x0011, 0x0002,     -1, 0x0002, 0x0014, 0x0014, 0x001e, 0x001e,
-       0x0028, 0x0028, 0x0032, 0x0032, 0x003c, 0x003c, 0x0046, 0x0046,
-       0x0050, 0x0050, 0x005a, 0x005a, 0x2710, 0x2710, 0x0011, 0x0011,
-       0x0012, 0x0012, 0x0013, 0x0013, 0x0001, 0x0003, 0x0002, 0x0003,
+       0x0011, 0x0002,     -1, 0x0002, 0x0014, 0x0001, 0x001e, 0x0001,
+       0x0028, 0x0001, 0x0032, 0x0001, 0x003c, 0x0001, 0x0046, 0x0001,
+       0x0050, 0x0001, 0x005a, 0x0001, 0x2710, 0x0001, 0x0011, 0x0001,
+       0x0012, 0x0001, 0x0013, 0x0001, 0x0001, 0x0003, 0x0002, 0x0003,
        0x0001, 0x0005, 0x0002, 0x0005, 0x0003, 0x0005, 0x0004, 0x0005,
        0x0001, 0x0006, 0x0005, 0x0006, 0x0001, 0x0008, 0x0003, 0x0008,
-       0x0005, 0x0008, 0x0007, 0x0008, 0x000b, 0x000b, 0x000c, 0x000c,
-       0x01f4, 0x01f4, 0x1388, 0x1388, 0x000d, 0x000d, 0x000e, 0x000e,
-       0x000f, 0x000f, 0x0015, 0x0015, 0x0016, 0x0016, 0x0017, 0x0017,
-       0x0018, 0x0018, 0x0019, 0x0019, 0x001a, 0x001a, 0x001b, 0x001b,
-       0x001c, 0x001c, 0x001d, 0x001d, 0x001f, 0x001f, 0x0020, 0x0020,
-       0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023, 0x0024, 0x0024,
-       0x0025, 0x0025, 0x0026, 0x0026, 0x0027, 0x0027, 0x0029, 0x0029,
-       0x002a, 0x002a, 0x002b, 0x002b, 0x002c, 0x002c, 0x002d, 0x002d,
-       0x002e, 0x002e, 0x002f, 0x002f, 0x0030, 0x0030, 0x0031, 0x0031
+       0x0005, 0x0008, 0x0007, 0x0008, 0x000b, 0x0001, 0x000c, 0x0001,
+       0x01f4, 0x0001, 0x1388, 0x0001, 0x000d, 0x0001, 0x000e, 0x0001,
+       0x000f, 0x0001, 0x0015, 0x0001, 0x0016, 0x0001, 0x0017, 0x0001,
+       0x0018, 0x0001, 0x0019, 0x0001, 0x001a, 0x0001, 0x001b, 0x0001,
+       0x001c, 0x0001, 0x001d, 0x0001, 0x001f, 0x0001, 0x0020, 0x0001,
+       0x0021, 0x0001, 0x0022, 0x0001, 0x0023, 0x0001, 0x0024, 0x0001,
+       0x0025, 0x0001, 0x0026, 0x0001, 0x0027, 0x0001, 0x0029, 0x0001,
+       0x002a, 0x0001, 0x002b, 0x0001, 0x002c, 0x0001, 0x002d, 0x0001,
+       0x002e, 0x0001, 0x002f, 0x0001, 0x0030, 0x0001, 0x0031, 0x0001
 };