chewing / chewing-utils Goto Github PK
View Code? Open in Web Editor NEWUtilities for Chewing IM
License: GNU Lesser General Public License v2.1
Utilities for Chewing IM
License: GNU Lesser General Public License v2.1
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,
};
帮忙看一下,谢谢。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.