[Groonga-commit] groonga/groonga-normalizer-mysql [master] Fix wrong decompose

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 1 18:55:54 JST 2013


Kouhei Sutou	2013-02-01 18:55:54 +0900 (Fri, 01 Feb 2013)

  New Revision: 56e9a4071901deb7ef253f8d36b34949d3549de4
  https://github.com/groonga/groonga-normalizer-mysql/commit/56e9a4071901deb7ef253f8d36b34949d3549de4

  Log:
    Fix wrong decompose
    
    low_code must be the lowest 0xff.

  Modified files:
    normalizers/mysql.c

  Modified: normalizers/mysql.c (+9 -13)
===================================================================
--- normalizers/mysql.c    2013-02-01 18:55:21 +0900 (92d55dd)
+++ normalizers/mysql.c    2013-02-01 18:55:54 +0900 (4f3b137)
@@ -1584,23 +1584,19 @@ decompose_character(const char *rest, int character_length,
     *low_code = rest[0] & 0x7f;
     break;
   case 2 :
-    *plane = 0x00;
-    *low_code = (rest[0] & 0x1f << 6) + (rest[1] & 0x3f);
+    *plane = rest[0] & 0x1c;
+    *low_code = ((rest[0] & 0x03) << 6) + (rest[1] & 0x3f);
     break;
   case 3 :
-    *plane = rest[0] & 0x0f;
-    *low_code =
-      ((rest[0] & 0x0f) << 12) +
-      ((rest[1] & 0x3f) << 6) +
-      (rest[2] & 0x3f);
+    *plane = ((rest[0] & 0x0f) << 4) + ((rest[1] & 0x3c));
+    *low_code = ((rest[1] & 0x03) << 6) + (rest[2] & 0x3f);
     break;
   case 4 :
-    *plane = ((rest[0] & 0x07) << 6) + (rest[1] & 0x3f);
-    *low_code =
-      ((rest[0] & 0x07) << 15) +
-      ((rest[1] & 0x3f) << 12) +
-      ((rest[2] & 0x3f) << 6) +
-      (rest[3] & 0x3f);
+    *plane =
+      ((rest[0] & 0x07) << 10) +
+      ((rest[1] & 0x3f) << 4) +
+      ((rest[2]) & 0x3c);
+    *low_code = ((rest[1] & 0x03) << 6) + (rest[2] & 0x3f);
     if (*plane > 0xff) {
       *plane = -1;
     }
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index