From: tomo Date: Wed, 12 Mar 2003 12:41:44 +0000 (+0000) Subject: (chise_dt_get_char): Use `chise_value_data' instead of X-Git-Tag: r0_1_1-pre1~33 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b588d4fcce8c0b33590a3e9e89b6dfc5f4977f8c;p=chise%2Flibchise.git (chise_dt_get_char): Use `chise_value_data' instead of `chise_value_to_c_string'; use `strnlen' and `chise_value_size' instead of `strlen'; fix problem about control characters. --- diff --git a/chise.c b/chise.c index 4c790e1..04b5041 100644 --- a/chise.c +++ b/chise.c @@ -52,8 +52,8 @@ chise_dt_get_char (CHISE_Decoding_Table *db, int code_point) if (!status) { unsigned char *str - = (unsigned char *)chise_value_to_c_string (&valdatum); - int len = strlen (str); + = (unsigned char *)chise_value_data (&valdatum); + int len = strnlen (str, chise_value_size (&valdatum)); int i = 0; if ( (len >= 2) && (str[i++] == '?') ) @@ -67,6 +67,16 @@ chise_dt_get_char (CHISE_Decoding_Table *db, int code_point) if (len < 3) return -1; c = str[i++]; + if (c == '^') + { + if (len < 4) + return -1; + c = str[i++]; + if (c == '?') + return 0x7F; + else + return c & (0x80 | 0x1F); + } } if ( c < 0xC0 ) {