-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build error on openSUSE OBS: 64-bit portability issue #1
Comments
猜測錯誤點在於 |
哎呦终于有人回应我了。 本机编译(64bit)是不会报这个错误的,运行也正常。(是代码 weakness,不是用不了) 问题出在 OBS 的策略,就是 RedHat/SuSE 的 RPM 的 brp 代码检查。 在编译服务器上编译完成后会查代码,因为这两个发行版背后的公司和他们本身都被移植到了 arm 或者 ppc 以及 ibm s390...这种小处出错运行时很难排错,所以强制编译时排,不修复的话拒绝生成最终 RPM。 但是,我是 openSUSE 的维护者...编译服务器上编不出包的话,用户就用不了了... 让别人给看了下,他出的补丁也解决不了这个错误 --- hash-editor.orig/src/chewing-utf8-util.h |
哦对了,他的原话是这样的: char* 指针在 64 位下是 64 位 |
@marguerite 单修这个错误一行就行, 不过代码里面相关的不相关的问题实在太多了, 于是一起修了.... 这个错误不修的话在x86_64上运行没有段错误那是运气好, 在大端64位上面运行要是没出错那绝对是机器坏了. .... 总之手动打patch的话在这里 |
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,
};
帮忙看一下,谢谢。
The text was updated successfully, but these errors were encountered: