Hi,
[ 136s] E: libchewing 64bit-portability-issue che.c:1066
[ 136s] E: libchewing 64bit-portability-issue key2pho-utf8.c:98
代码片段:
che.c
void entry_active(GtkWidget obj, gpointer vbox, const char *zhuin)
{
int i, length;
char *chr_zhuin;
GtkWidget *box = vbox;
GtkWidget *bl;
gchar buf[4];
gchar *text = gtk_entry_get_text(GTK_ENTRY(obj));
/
the representation of Mandarin Phonetic Symbols consists of initial,
middle, fnal consonants (each occupies 3 bytes in UTF-8), and tone
(2 bytes in UTF-8). Therefore, we declare 11 bytes in zhuin_buffer.
*/
char zhuin_buffer[3 * 3 + 2 + 1];
length = chewing_utf8_strlen(text);
gtk_container_foreach(GTK_CONTAINER(box), gtk_widget_destroy, NULL);
if (zhuin)
chr_zhuin = strtok(zhuin, " ");
else
chr_zhuin = " ";
for(i = 0; i < length; i++) {
// 下面这行提示有问题
chewing_utf8_strncpy(buf, chewing_utf8_strseek(text, i), 1, 1);
/* try to find the zhuin for the chinese character */
if (zhuin_dictionary && find_zhuin(zhuin_dictionary, buf, zhuin_buffer)) {
chr_zhuin = zhuin_buffer;
} else {
chr_zhuin = " ";
}
bl = che_new_label_button_box(buf, chr_zhuin);
gtk_widget_show_all(GTK_WIDGET(bl));
gtk_box_pack_start_defaults( GTK_BOX(box), GTK_WIDGET (bl));
if (zhuin)
chr_zhuin = strtok(NULL, " ");
}
}
key2pho-utf8.c
int Uint2PhoneUTF8( char *phone, long seq )
{
int i, j, k;
char *pos;
char buffer[5];
for ( i = 0, j = 0; i < 4; i++) {
k = ((seq >> shift[ i ]) & sb[ i ] ) - 1;
// 下面这行提示有问题
if ( k >= 0 && (pos = chewing_utf8_strseek( zhuin_tab[ i ], k )) )
{
chewing_utf8_strncpy(buffer, pos, 1, 1);
strcat(phone, buffer);
j++;
}
}
return j;
}
报错函数定义是:
void*
chewing_utf8_strseek(char src, size_t n)
{
int i = 0;
char *iter = (char)src;
for( i = 0; i < n; i++ )
{
iter += chewing_utf8_byte2len(iter[0]);
}
return (void*)iter;
}
chewing_utf8_byte2len 定义是
/* Return bytes of a UTF-8 character */
int
chewing_utf8_byte2len(unsigned char b)
{
return utf8len_tab[b];
}
utf8len_tab 定义是:
/* Table of UTF-8 length _/
static char utf8len_tab[256] =
{
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /bogus/
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /_bogus*/
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1,
};
帮忙看一下,谢谢。