Code Monkey home page Code Monkey logo

chewing-utils's People

Contributors

jserv avatar lzh9102 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

chewing-utils's Issues

build error on openSUSE OBS: 64-bit portability issue

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,
};

帮忙看一下,谢谢。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.