Mercurial > freewnn
changeset 25:466fe6732d8d
- fixed more NULL pointer related errata
- suppress warnings
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 06 Mar 2010 04:37:31 +0900 |
parents | becc60787557 |
children | 6dcfbd28e807 |
files | PubdicPlus/pod.c Wnn/jlib.V3/jlv3.c Wnn/jserver/bnsetu_kai.c Wnn/jserver/daibn_kai.c Wnn/jserver/de.c Wnn/jserver/jikouho.c Wnn/jserver/jikouho_d.c Wnn/jserver/kaiseki.h Wnn/jserver/mknode1.c Wnn/jserver/renbn_kai.c |
diffstat | 10 files changed, 117 insertions(+), 107 deletions(-) [+] |
line wrap: on
line diff
--- a/PubdicPlus/pod.c Fri Mar 05 20:46:36 2010 +0900 +++ b/PubdicPlus/pod.c Sat Mar 06 04:37:31 2010 +0900 @@ -154,7 +154,7 @@ static void store_description (void); static long internkind (Wchar *s); static void listkinds (void); -static int kindcompar (struct kindpack *k1, struct kindpack *k2); +static int kindcompar (const void *p1, const void *p2); static void sortkind (void); static struct dicpack *intern (int key, Wchar *yomi, Wchar *kouho, Wchar *hinshi, int hindo, long kind, int *stat, long flags); static void storepd (FILE *file); @@ -163,8 +163,8 @@ static void entry_out (FILE *cf, struct dicpack *p, Wchar *h, int n, Wchar *ex); static void printentry (FILE *cf, struct dicpack *p); static void showentry (struct dicpack **pd, int n); -static int diccompar (struct dicpack **p1, struct dicpack **p2); -static int dichindocompar (struct dicpack **p1, struct dicpack **p2); +static int diccompar (const void *pp1, const void *pp2); +static int dichindocompar (const void *pp1, const void *pp2); void shrinkargs (char **argv, int n, int count); static void parseargs (int argc, char *argv[]); #endif @@ -822,9 +822,12 @@ } static int -kindcompar (k1, k2) - struct kindpack *k1, *k2; +kindcompar (const void *p1, const void *p2) { + struct kindpack *k1, *k2; + k1 = (struct kindpack *)p1; + k2 = (struct kindpack *)p2; + return Wscmp (k1->kind, k2->kind); } @@ -1364,9 +1367,12 @@ } static int -diccompar (p1, p2) - struct dicpack **p1, **p2; +diccompar (const void *pp1, const void *pp2) { + struct dicpack **p1, **p2; + p1 = (struct dicpack **)pp1; + p2 = (struct dicpack **)pp2; + int n; if (n = Wscmp ((*p1)->yomi, (*p2)->yomi)) { @@ -1387,9 +1393,12 @@ } static int -dichindocompar (p1, p2) - struct dicpack **p1, **p2; +dichindocompar (const void *pp1, const void *pp2) { + struct dicpack **p1, **p2; + p1 = (struct dicpack **)pp1; + p2 = (struct dicpack **)pp2; + int n; if (n = Wscmp ((*p1)->yomi, (*p2)->yomi)) {
--- a/Wnn/jlib.V3/jlv3.c Fri Mar 05 20:46:36 2010 +0900 +++ b/Wnn/jlib.V3/jlv3.c Sat Mar 06 04:37:31 2010 +0900 @@ -355,7 +355,7 @@ /* READ ONLY SD && hind file is none */ (js_access (jl_env (buf), fn, 4) != -1) && (js_access (jl_env (buf), fn1, 4) == -1)) { - if ((dic_no = jl_dic_add (buf, fn, fn1, WNN_DIC_ADD_NOR, prio, WNN_DIC_RDONLY, WNN_DIC_RW, NULL, NULL, WNN_CREATE, NULL)) < 0) + if ((dic_no = jl_dic_add (buf, fn, fn1, WNN_DIC_ADD_NOR, prio, WNN_DIC_RDONLY, WNN_DIC_RW, NULL, NULL, (void *)WNN_CREATE, NULL)) < 0) return (-1); if (jl_dic_delete (buf, dic_no) < 0) return (-1); @@ -365,7 +365,7 @@ { rdonly = WNN_DIC_RDONLY; } - if ((dic_no = jl_dic_add (buf, fn, fn1, WNN_DIC_ADD_NOR, prio, rdonly, hrdonly, NULL, NULL, WNN_CREATE, NULL)) < 0) + if ((dic_no = jl_dic_add (buf, fn, fn1, WNN_DIC_ADD_NOR, prio, rdonly, hrdonly, NULL, NULL, (void *)WNN_CREATE, NULL)) < 0) /* pw_d pw_h err mes */ return (-1); if (js_dic_info (jl_env (buf), dic_no, &ret) < 0)
--- a/Wnn/jserver/bnsetu_kai.c Fri Mar 05 20:46:36 2010 +0900 +++ b/Wnn/jserver/bnsetu_kai.c Sat Mar 06 04:37:31 2010 +0900 @@ -59,7 +59,7 @@ t, ii; struct jdata *jentptr; register struct SYO_BNSETSU *sbnptr = NULL; - struct SYO_BNSETSU *sbnptr_top = 0; + struct SYO_BNSETSU *sbnptr_top = NULL; struct ICHBNP *ichbnpbp; int k, ll; struct SYO_BNSETSU *kanptr; @@ -159,7 +159,7 @@ #endif /* CONVERT_with_SiSheng */ if (bnst_num != 1) { - if (parent != 0 && parent->status_bkwd == NO) + if (parent != NULL && parent->status_bkwd == NO) /* 前の文節が endvect に接続できないものは、 評価値を下げる */ hyokaval0 = _DIVID (hyokaval, 2); @@ -313,7 +313,7 @@ { freesbn (sbnptr); sbncnt = 0; - sbnptr_top = 0; + sbnptr_top = NULL; } } else @@ -516,7 +516,7 @@ sbnptr->t_jc = -1; } sbnptr->hinsi_fk = giji_hinsi; - sbnptr->jentptr = 0; + sbnptr->jentptr = NULL; sbnptr->kangovect = ft->kango_hinsi_area[giji_hinsi]; sbnptr->j_c = j_end + len - 1; return (len); @@ -748,7 +748,7 @@ sbnptr->t_jc = -1; } sbnptr->hinsi_fk = giji_hinsi; - sbnptr->jentptr = 0; + sbnptr->jentptr = NULL; sbnptr->kangovect = ft->kango_hinsi_area[giji_hinsi]; sbnptr->j_c = j_end + len - 1; return (len); @@ -787,7 +787,7 @@ sbnptr->i_jc = yomi_sno; sbnptr->t_jc = -1; sbnptr->hinsi_fk = giji_no; - sbnptr->jentptr = 0; + sbnptr->jentptr = NULL; sbnptr->kangovect = ft->kango_hinsi_area[kigou_no]; sbnptr->j_c = yomi_sno;
--- a/Wnn/jserver/daibn_kai.c Fri Mar 05 20:46:36 2010 +0900 +++ b/Wnn/jserver/daibn_kai.c Sat Mar 06 04:37:31 2010 +0900 @@ -74,7 +74,7 @@ int tmp; struct SYO_BNSETSU *db_set; register struct SYO_BNSETSU **sb_que_head; - struct BZD *bzd = 0; + struct BZD *bzd = NULL; int dbncnt = 0; int setflg; register struct SYO_BNSETSU *sb_one; @@ -89,9 +89,9 @@ sb_que_head = &db_set; *sb_que_head = NULL; - if ((tmp = sbn_kai (yomi_sno, yomi_eno, endvect, endvect1, sb_que_head, 1, (struct SYO_BNSETSU *) 0)) <= 0) + if ((tmp = sbn_kai (yomi_sno, yomi_eno, endvect, endvect1, sb_que_head, 1, NULL)) <= 0) return (tmp); - for (sb_one = *sb_que_head; sb_one != 0; sb_one = sb_one->lnk_br) + for (sb_one = *sb_que_head; sb_one != NULL; sb_one = sb_one->lnk_br) sb_one->son_v = sum_hyouka (sb_one); while (*sb_que_head != NULL) @@ -157,9 +157,9 @@ if (tmp > 0) { sb_one->reference += tmp; - for (sb_one = *sb_que_newcomer; sb_one != 0; sb_one = sb_one->lnk_br) + for (sb_one = *sb_que_newcomer; sb_one != NULL; sb_one = sb_one->lnk_br) sb_one->son_v = sum_hyouka (sb_one); - if (*sb_que_head != 0) + if (*sb_que_head != NULL) *sb_que_head = que_reorder (*sb_que_head, *sb_que_newcomer); else *sb_que_head = *sb_que_newcomer; @@ -184,17 +184,17 @@ while (dbncnt > 0 && bzd->v_jc < _DIVID (edagari_hyouka, 2)) { *rbzd = bzd->lnk_br; - bzd->lnk_br = 0; + bzd->lnk_br = NULL; clr_node (bzd); bzd = *rbzd; dbncnt--; } - for (; bzd != 0 && bzd->lnk_br != 0; bzd = bzd->lnk_br) + for (; bzd != NULL && bzd->lnk_br != NULL; bzd = bzd->lnk_br) { if (bzd->lnk_br->v_jc < _DIVID (edagari_hyouka, 2)) { bzd_sv = bzd->lnk_br->lnk_br; - bzd->lnk_br->lnk_br = 0; + bzd->lnk_br->lnk_br = NULL; clr_node (bzd->lnk_br); bzd->lnk_br = bzd_sv; dbncnt--; @@ -342,7 +342,7 @@ { fzklen = Strlen (fzkchar); fzk_buf = rev_fzk (fzkchar, fzklen); - if (fzk_buf == 0) + if (fzk_buf == NULL) return (NO); /* ええかげん */ fzkcnt = fzk_kai (fzk_buf, fzk_buf + fzklen, v, WNN_VECT_NO, &ichbnpbp); @@ -373,14 +373,14 @@ register w_char *fzkchar; int len; { - static w_char *fzk = 0; + static w_char *fzk = NULL; static int fzk_len = 0; if (fzk_len < len) { - if (fzk != 0) + if (fzk != NULL) free (fzk); - if ((fzk = (w_char *) malloc ((len + 1) * sizeof (w_char))) == 0) + if ((fzk = (w_char *) malloc ((len + 1) * sizeof (w_char))) == NULL) { wnn_errorno = WNN_MALLOC_ERR; fzk_len = 0; @@ -407,7 +407,7 @@ register struct SYO_BNSETSU *next; int flg; - if (new == 0) + if (new == NULL) return (que); if ((flg = sbjunjo (que, new)) < 0) { @@ -500,13 +500,13 @@ sbjunjo (que, new) register struct SYO_BNSETSU *que, *new; { - if (new == 0) + if (new == NULL) return (1); if (que->j_c > new->j_c) return (-1); if (que->j_c < new->j_c) { - if (que->lnk_br == 0) + if (que->lnk_br == NULL) return (0); if (que->lnk_br->j_c > new->j_c) return (0); @@ -520,7 +520,7 @@ return (-2); if (que->kangovect > new->kangovect) return (-1); - if (que->lnk_br == 0) + if (que->lnk_br == NULL) return (0); if (que->lnk_br->j_c > new->j_c) return (0); @@ -549,7 +549,7 @@ else if (hyouka < _DIVID (edagari_hyouka, 2)) return (0); - if (*bzd != 0) + if (*bzd != NULL) { if ((*bzd)->j_c == sbn->j_c) { @@ -561,7 +561,7 @@ } else { - if (((*bzd)->lnk_br = getbzdsp ()) == 0) + if (((*bzd)->lnk_br = getbzdsp ()) == NULL) return (-1); (*bzd) = (*bzd)->lnk_br; ret = 1; @@ -569,15 +569,15 @@ } else { - if ((*rbzd = *bzd = getbzdsp ()) == 0) + if ((*rbzd = *bzd = getbzdsp ()) == NULL) return (-1); ret = 1; } (*bzd)->v_jc = hyouka; (*bzd)->j_c = sbn->j_c; (*bzd)->sbn_cnt = sbn->kbcnt; - (*bzd)->lnk_br = 0; - (*bzd)->lnk_son = 0; + (*bzd)->lnk_br = NULL; + (*bzd)->lnk_son = NULL; (*bzd)->son_v = 0; (*bzd)->sbn = sbn; (*bzd)->kbcnt = 1;
--- a/Wnn/jserver/de.c Fri Mar 05 20:46:36 2010 +0900 +++ b/Wnn/jserver/de.c Sat Mar 06 04:37:31 2010 +0900 @@ -1076,7 +1076,7 @@ } setsockopt (sock_d_in, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof (int)); #ifdef SO_DONTLINGER - setsockopt (sock_d_in, SOL_SOCKET, SO_DONTLINGER, (char *) 0, 0); + setsockopt (sock_d_in, SOL_SOCKET, SO_DONTLINGER, NULL, 0); #else # ifdef SO_LINGER linger.l_onoff = 0;
--- a/Wnn/jserver/jikouho.c Fri Mar 05 20:46:36 2010 +0900 +++ b/Wnn/jserver/jikouho.c Sat Mar 06 04:37:31 2010 +0900 @@ -84,7 +84,7 @@ for (ii = 0; ii < fzkcnt; ii++) getfzkoh (ichbnpbp, ii)->offset += yomi_sno; - jktsbn_top = 0; + jktsbn_top = NULL; for (ii = 0; ii < fzkcnt; ii++) { /* 辞書引き */ @@ -123,7 +123,7 @@ { /* ひらがな候補 */ if ((jktsbn = get_hira_kouho (&jktsbn_top, yomi_sno, yomi_eno)) < (struct JKT_SBN *) 0) return (-1); - if (jktsbn > (struct JKT_SBN *) 0) + if (jktsbn != NULL) { jktsbn->parent = parent; jktsbn->bend_m = yomi_sno; @@ -199,13 +199,13 @@ if (bnst_num == 1) /* endvect に接続できないものは評価値を下げる */ hyokaval0 = (connect_flg != NO) ? hyokaval : _DIVID (hyokaval, 2); - else if (parent != 0) + else if (parent != NULL) { /* 前の文節が endvect に接続できないものは、 評価値を下げる */ struct JKT_SONE *tmp; hyokaval0 = _DIVID (hyokaval, 2); - for (tmp = parent->sbn; tmp != 0; tmp = tmp->lnk_br) + for (tmp = parent->sbn; tmp != NULL; tmp = tmp->lnk_br) { if (tmp->status_bkwd == YES) { @@ -228,7 +228,7 @@ jktsone->status_bkwd = connect_flg; if ((jktsbn = find_jktsbn (jktsbn_top, jktsone, hinsidt, yomi_eno - 1)) < (struct JKT_SBN *) 0) return (-1); - if (jktsbn > (struct JKT_SBN *) 0) + if (jktsbn != NULL) { jktsbn->parent = parent; jktsbn->bend_m = yomi_sno; @@ -243,7 +243,7 @@ /* カタカナ候補 */ if ((jktsbn = get_kata_kouho (jktsbn_top, yomi_sno, yomi_eno, i, fzkptr->vector, getfzkoh1 (ichbnpbp, ii)->vector, ii)) < (struct JKT_SBN *) 0) return (-1); - if (jktsbn > (struct JKT_SBN *) 0) + if (jktsbn != NULL) { jktsbn->parent = parent; jktsbn->bend_m = yomi_sno; @@ -269,7 +269,7 @@ int connect_flg; if (!isjhira (bun[i_jc]) && !BAR_CODE (bun[i_jc]) && (i_jc + 1 == yomi_eno || !isjhira (bun[i_jc + 1]))) - return ((struct JKT_SBN *) 0); + return (NULL); if (i_jc != yomi_eno && !(touten (bun[i_jc])) && !(kuten (bun[i_jc]))) { @@ -279,16 +279,16 @@ } else if (kan_ck_vector (giji_no, vector1) == WNN_NOT_CONNECT_BK) { - return ((struct JKT_SBN *) 0); + return (NULL); } else { connect_flg = WNN_NOT_CONNECT_BK; } - if ((jktsone = getjktsone ()) == 0) - return ((struct JKT_SBN *) 0); + if ((jktsone = getjktsone ()) == NULL) + return (NULL); jktsone->i_jc = i_jc; - jktsone->jentptr = 0; + jktsone->jentptr = NULL; jktsone->t_jc = WNN_KATAKANA; /* カタカナ */ jktsone->v_jc = (yomi_eno - i_jc) * KATA_HYOUKA; jktsone->hinsi_fk = giji_no; @@ -297,7 +297,7 @@ } else { - return ((struct JKT_SBN *) 0); + return (NULL); } } #endif /* !defined(NO_KANA) && !defined(KOREAN) */ @@ -309,10 +309,10 @@ { struct JKT_SONE *jktsone; - if ((jktsone = getjktsone ()) == 0) + if ((jktsone = getjktsone ()) == NULL) return ((struct JKT_SBN *) -1); jktsone->i_jc = yomi_sno; - jktsone->jentptr = 0; + jktsone->jentptr = NULL; jktsone->t_jc = WNN_HIRAGANA; /* ひらがな候補 */ #ifdef KOREAN jktsone->hinsi_fk = katakanago_no; /* Hangul */ @@ -339,7 +339,7 @@ kangovect = ft->kango_hinsi_area[hinsi]; sbn = *jktsbn; - if (sbn == 0 || sbn->j_c != j_c || sbn->kangovect > kangovect) + if (sbn == NULL || sbn->j_c != j_c || sbn->kangovect > kangovect) { if ((sbn = getjktsbn ()) == NO) return ((struct JKT_SBN *) -1); @@ -350,31 +350,31 @@ sbn->kangovect = kangovect; return (sbn); } - while (sbn != 0 && sbn->j_c == j_c) + while (sbn != NULL && sbn->j_c == j_c) { if (sbn->kangovect == kangovect) { /* 評価値で SORT */ v_jc = jktsone->v_jc; sone = sbn->sbn; - if (sone == 0 || sone->v_jc < v_jc) + if (sone == NULL || sone->v_jc < v_jc) { sbn->sbn = jktsone; jktsone->lnk_br = sone; - return (0); + return NULL; } while (sone) { - if (sone->lnk_br == 0 || sone->lnk_br->v_jc < v_jc) + if (sone->lnk_br == NULL || sone->lnk_br->v_jc < v_jc) { jktsone->lnk_br = sone->lnk_br; sone->lnk_br = jktsone; - return (0); + return NULL; } sone = sone->lnk_br; } } - else if (sbn->lnk_br == 0 || sbn->lnk_br->j_c != j_c || sbn->lnk_br->kangovect > kangovect) + else if (sbn->lnk_br == NULL || sbn->lnk_br->j_c != j_c || sbn->lnk_br->kangovect > kangovect) { if ((tsbn = getjktsbn ()) == NO) return ((struct JKT_SBN *) -1); @@ -410,7 +410,7 @@ struct DSD_SBN **dsd_sbn; { struct DSD_SBN *d_sbn; - struct JKT_SBN *tjktsbn = 0; /* 小文節解析結果 */ + struct JKT_SBN *tjktsbn = NULL; /* 小文節解析結果 */ register int cnt = 0; /* 次候補数 */ register struct JKT_SBN *jktsbn; struct JKT_SBN *next_sbn; @@ -438,10 +438,10 @@ init_work_areas (); return (-1); } - for (jktsbn = tjktsbn; jktsbn != 0;) + for (jktsbn = tjktsbn; jktsbn != NULL;) { next_sbn = jktsbn->lnk_br; - for (sone_p = jktsbn->sbn; sone_p != 0; sone_p = sone_p->lnk_br) + for (sone_p = jktsbn->sbn; sone_p != NULL; sone_p = sone_p->lnk_br) { d_sbn->bun_m = jktsbn->bend_m; d_sbn->bun_jc = jktsbn->j_c; @@ -457,7 +457,7 @@ #endif /* NO_FZK */ &(jktsbn->status)); d_sbn->v_jc = DIVID_HYOUKA (sone_p->v_jc, divid); - if (sone_p->jentptr == 0 && jktsbn->status == WNN_NOT_CONNECT) + if (sone_p->jentptr == NULL && jktsbn->status == WNN_NOT_CONNECT) d_sbn->status = WNN_GIJI; else d_sbn->status = jktsbn->status; @@ -511,7 +511,7 @@ (*jktsbn)->kangovect = giji_sbn->kangovect; (*jktsbn)->sbn->i_jc = giji_sbn->i_jc; (*jktsbn)->sbn->v_jc = giji_sbn->v_jc; - (*jktsbn)->sbn->jentptr = 0; + (*jktsbn)->sbn->jentptr = NULL; (*jktsbn)->sbn->t_jc = giji_sbn->t_jc; (*jktsbn)->sbn->hinsi_fk = giji_sbn->hinsi_fk; (*jktsbn)->sbn->status_bkwd = giji_sbn->status_bkwd; @@ -542,7 +542,7 @@ d_sone = d_sone->lnk_br; d_sone->i_jc = s_sone->i_jc; d_sone->v_jc = s_sone->v_jc - 10; /* 第1候補より評価値を下げる */ - d_sone->jentptr = 0; + d_sone->jentptr = NULL; d_sone->hinsi_fk = s_sone->hinsi_fk; d_sone->status_bkwd = s_sone->status_bkwd; return (d_sone);
--- a/Wnn/jserver/jikouho_d.c Fri Mar 05 20:46:36 2010 +0900 +++ b/Wnn/jserver/jikouho_d.c Sat Mar 06 04:37:31 2010 +0900 @@ -84,7 +84,7 @@ { register int i; register int cnt; - struct JKT_DBN *rjkt_dbn = 0; + struct JKT_DBN *rjkt_dbn = NULL; register struct DSD_DBN *dbn; int divid; @@ -185,7 +185,7 @@ register struct JKT_SBN *sb_one; struct JKT_SBN *sbn_tmp; register struct JKT_SBN **sb_que_newcomer; - struct JKT_DBN *jktdbn = 0; + struct JKT_DBN *jktdbn = NULL; int dbncnt = 0; #ifndef NO_KANA int gijiflag = 0; /* 疑似文節を作ったか:最初の小文節のみ */ @@ -223,7 +223,7 @@ else if (tmp > 0) { sb_one->reference += tmp; - if (*sb_que_head != 0) + if (*sb_que_head != NULL) *sb_que_head = jkt_que_reorder (*sb_que_head, *sb_que_newcomer); else *sb_que_head = *sb_que_newcomer; @@ -247,9 +247,9 @@ if ((sb_one = get_hira_kouho (&db_tmp, yomi_sno, yomi_eno)) < (struct JKT_SBN *) 0) return (-1); - if (sb_one > (struct JKT_SBN *) 0) + if (sb_one != NULL) { - sb_one->parent = 0; + sb_one->parent = NULL; sb_one->bend_m = yomi_sno; sb_one->kbcnt = 1; if (set_jkt_dai (rjkt_dbn, &jktdbn, sb_one) < 0) @@ -418,7 +418,7 @@ { struct JKT_DBN *getjktdbn (); - if (*jktdbn != 0) + if (*jktdbn != NULL) { if (((*jktdbn)->lnk_br = getjktdbn ()) == NULL) return (-1); @@ -431,7 +431,7 @@ } (*jktdbn)->j_c = sbn->j_c; (*jktdbn)->sbn_cnt = sbn->kbcnt; - (*jktdbn)->lnk_br = 0; + (*jktdbn)->lnk_br = NULL; (*jktdbn)->sbn = sbn; (*jktdbn)->bend_m = yomi_sno_tmp; return (0); @@ -462,7 +462,7 @@ register int fzkcnt, ii, jktcnt; register int i, /* 幹語の終わりのインデックス */ j; /* 文節始めのインデックス */ - struct JKT_SBN *jktsbn_top = 0; + struct JKT_SBN *jktsbn_top = NULL; struct ICHBNP *ichbnpbp; struct JKT_SBN *gijisbn_top; int get_giji_flg = -1; /* 擬似文節を作れたか */ @@ -552,7 +552,7 @@ } freesbn (giji_sbn); - if (gijisbn_top != 0) + if (gijisbn_top != NULL) { if (get_giji_flg > j) { @@ -585,7 +585,7 @@ get_dsd_dbn (cnt) register int cnt; { - static struct DSD_DBN *m_dbn = 0; + static struct DSD_DBN *m_dbn = NULL; static int md_cnt = 0; if (md_cnt < cnt) @@ -612,7 +612,7 @@ get_dsd_sbn (cnt) register int cnt; { - static struct DSD_SBN *m_sbn = 0; + static struct DSD_SBN *m_sbn = NULL; static int ms_cnt = 0; if (ms_cnt < cnt) @@ -683,14 +683,14 @@ freejktdbn (dbn); dbn = next_dbn; #else /* CONVERT_from_TOP */ - for (sbn = dbn->sbn; sbn != 0; sbn = sbn->parent, d_sbn++) + for (sbn = dbn->sbn; sbn != NULL; sbn = sbn->parent, d_sbn++) { son = cnt_son (dbn->sbn, sbn); par = cnt_par (sbn); p_sbn = d_sbn; for (j = 0; j < son; j++) { - for (sone = sbn->sbn; sone != 0; sone = sone->lnk_br) + for (sone = sbn->sbn; sone != NULL; sone = sone->lnk_br) { for (i = 0; i < par; i++) { @@ -703,7 +703,7 @@ p_sbn->kangovect = sbn->kangovect; p_sbn->v_jc = sone->v_jc; p_sbn->status_bkwd = sone->status_bkwd; - if (sbn->status == WNN_NOT_CONNECT && sone->jentptr == 0) + if (sbn->status == WNN_NOT_CONNECT && sone->jentptr == NULL) p_sbn->status = WNN_GIJI; else p_sbn->status = sbn->status; @@ -730,7 +730,7 @@ { int son, par; register struct DSD_SBN *p_sbn; - if (sbn != 0) + if (sbn != NULL) { sbn_set (dbn, pr_d_sbn, sone, sbn->parent); @@ -755,7 +755,7 @@ for (j = 0; j < son; j++) { - for (sone = sbn->sbn; sone != 0; sone = sone->lnk_br) + for (sone = sbn->sbn; sone != NULL; sone = sone->lnk_br) { for (i = 0; i < par; i++) { @@ -768,7 +768,7 @@ p_sbn->kangovect = sbn->kangovect; p_sbn->v_jc = sone->v_jc; p_sbn->status_bkwd = sone->status_bkwd; - if (sbn->status == WNN_NOT_CONNECT && sone->jentptr == 0) + if (sbn->status == WNN_NOT_CONNECT && sone->jentptr == NULL) p_sbn->status = WNN_GIJI; else p_sbn->status = sbn->status;
--- a/Wnn/jserver/kaiseki.h Fri Mar 05 20:46:36 2010 +0900 +++ b/Wnn/jserver/kaiseki.h Sat Mar 06 04:37:31 2010 +0900 @@ -37,7 +37,9 @@ #endif /* STDC_HEADERS */ #ifdef GLOBAL_VALUE_DEFINE +#undef GLOBAL #define GLOBAL +#undef GLOBAL_VAL #define GLOBAL_VAL(v) = (v) #else #define GLOBAL extern
--- a/Wnn/jserver/mknode1.c Fri Mar 05 20:46:36 2010 +0900 +++ b/Wnn/jserver/mknode1.c Sat Mar 06 04:37:31 2010 +0900 @@ -85,7 +85,7 @@ free_area (list) register struct free_list *list; { - if (list == 0) + if (list == NULL) return; free_area (list->lnk); free (list); @@ -103,7 +103,7 @@ for (n = list->num - 1; n > 0; wk_ptr++, n--) wk_ptr->lnk_br = wk_ptr + 1; - wk_ptr->lnk_br = 0; + wk_ptr->lnk_br = NULL; } @@ -114,7 +114,7 @@ freesbn (sbn) /* struct SYO_BNSETSU を free_area へリンク */ register struct SYO_BNSETSU *sbn; /* クリアするノードのポインタ */ { - if (sbn == 0) + if (sbn == NULL) return; sbn->reference--; if (sbn->reference <= 0) @@ -128,7 +128,7 @@ clr_sbn_node (sbn) register struct SYO_BNSETSU *sbn; { - if (sbn == 0) + if (sbn == NULL) return; if ((sbn->reference) <= 1) { @@ -149,7 +149,7 @@ { register struct SYO_BNSETSU *rtnptr; - if (free_sbn_top == 0) + if (free_sbn_top == NULL) { if (get_area (SBN_KOSUU, sizeof (struct SYO_BNSETSU), &free_list_sbn) < 0) return ((struct SYO_BNSETSU *) -1); @@ -158,11 +158,11 @@ rtnptr = free_sbn_top; free_sbn_top = free_sbn_top->lnk_br; - rtnptr->lnk_br = 0; - rtnptr->parent = 0; + rtnptr->lnk_br = NULL; + rtnptr->parent = NULL; rtnptr->son_v = 0; rtnptr->reference = 0; - rtnptr->jentptr = 0; + rtnptr->jentptr = NULL; rtnptr->status = 0; rtnptr->status_bkwd = 0; return (rtnptr);
--- a/Wnn/jserver/renbn_kai.c Fri Mar 05 20:46:36 2010 +0900 +++ b/Wnn/jserver/renbn_kai.c Sat Mar 06 04:37:31 2010 +0900 @@ -25,8 +25,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -static char rcs_id[] = "$Id: renbn_kai.c,v 1.4 2002/09/01 17:13:11 hiroo Exp $"; - #ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -121,7 +119,7 @@ { /* 各文節の評価値の足し算(son_v)は、mknode でやるんだけど kaidbno が 1 つまり 1文節解析の場合は、そこを通らないからここでやろう */ - for (brbzdptr = rbzdptr->lnk_br; brbzdptr != 0; brbzdptr = brbzdptr->lnk_br) + for (brbzdptr = rbzdptr->lnk_br; brbzdptr != NULL; brbzdptr = brbzdptr->lnk_br) brbzdptr->son_v = brbzdptr->v_jc; } else @@ -151,7 +149,7 @@ } /* 最大の評価を持つノードを見つける */ - for (brbzdptr = rbzdptr->lnk_br, maxbzd = rbzdptr; brbzdptr != 0; brbzdptr = wkbzdptr) + for (brbzdptr = rbzdptr->lnk_br, maxbzd = rbzdptr; brbzdptr != NULL; brbzdptr = wkbzdptr) { wkbzdptr = brbzdptr->lnk_br; if (maxbzd->son_v <= brbzdptr->son_v) @@ -227,7 +225,7 @@ } ft = (struct FT *) files[c_env->fzk_fid].area; - rbzdptr = 0; + rbzdptr = NULL; _status = 0; if (chk_yomi_endvect (yomi_sno, yomi_eno, endvect, endvect1) < 0) return (-1); @@ -242,7 +240,7 @@ } /* 最大の評価値を持つノードを見つける */ - for (brbzdptr = rbzdptr, maxbzd = 0; brbzdptr != 0; brbzdptr = wkbzdptr) + for (brbzdptr = rbzdptr, maxbzd = NULL; brbzdptr != NULL; brbzdptr = wkbzdptr) { wkbzdptr = brbzdptr->lnk_br; if (brbzdptr->j_c == yomi_eno - 1) @@ -317,18 +315,18 @@ } ft = (struct FT *) files[c_env->fzk_fid].area; - rsbnptr = 0; + rsbnptr = NULL; _status = 0; if (chk_yomi_endvect (yomi_sno, yomi_eno, endvect, endvect1) < 0) return (-1); - if (sbn_kai (yomi_sno, yomi_eno, endvect, endvect1, &rsbnptr, 1, 0) < 0) + if (sbn_kai (yomi_sno, yomi_eno, endvect, endvect1, &rsbnptr, 1, NULL) < 0) { init_work_areas (); return (-1); /* ERROR */ } /* 最大の評価値を持つノードを見つける */ - for (brsbnptr = rsbnptr, maxsbn = 0; brsbnptr != 0; brsbnptr = wksbnptr) + for (brsbnptr = rsbnptr, maxsbn = NULL; brsbnptr != NULL; brsbnptr = wksbnptr) { wksbnptr = brsbnptr->lnk_br; if (brsbnptr->j_c == yomi_eno - 1) @@ -378,7 +376,7 @@ if (set_kata_giji_sbn (yomi_sno, yomi_eno, endvect, endvect1, &maxsbn) < 0) return (-1); } - if (maxsbn->jentptr == 0 && maxsbn->status == WNN_NOT_CONNECT) + if (maxsbn->jentptr == NULL && maxsbn->status == WNN_NOT_CONNECT) maxsbn->status = WNN_GIJI; sbn_cnt = cnt_syo (maxsbn); if ((*dsd_sbn = get_dsd_sbn (sbn_cnt)) == NULL) @@ -404,7 +402,7 @@ struct DSD_DBN *dsd_dbn_head; struct BZD *s_bzd; /* Buffer son's bzd */ dsd_dbn_head = dsd_dbn; - while (bzd != 0) + while (bzd != NULL) { nextp = dsd_dbn++; nextp->bun_m = bzd->bend_m; @@ -424,7 +422,7 @@ } return (dsd_dbn_head); #else /* CONVERT_from_TOP */ - if (bzd == 0) + if (bzd == NULL) return (dsd_dbn); nextp = dcdbn_set (dsd_dbn, dsd_sbn, bzd->lnk_son); nextp->bun_m = bzd->bend_m; @@ -446,7 +444,7 @@ dcdsbn_set (struct DSD_SBN *dsd_sbn, struct SYO_BNSETSU *sbn) { - if (sbn == 0) + if (sbn == NULL) return (dsd_sbn); #ifdef CONVERT_from_TOP dsd_sbn = dcdsbn_set (dsd_sbn, sbn->parent); @@ -474,6 +472,7 @@ { int cnt; cnt = 0; + while (sbn) { cnt++; @@ -563,14 +562,14 @@ } } - if ((*sbn = getsbnsp ()) == 0) + if ((*sbn = getsbnsp ()) == NULL) return (-1); (*sbn)->j_c = yomi_eno - 1; (*sbn)->i_jc = getfzkoh (ichbnpbp, tempi)->offset + yomi_sno; (*sbn)->bend_m = yomi_sno; (*sbn)->v_jc = 0; - (*sbn)->jentptr = 0; + (*sbn)->jentptr = NULL; (*sbn)->t_jc = WNN_KATAKANA; (*sbn)->kangovect = ft->kango_hinsi_area[giji_no]; (*sbn)->hinsi_fk = giji_no; @@ -589,7 +588,7 @@ struct BZD **bzd, int buncnt) { - if ((*bzd = getbzdsp ()) == 0) + if ((*bzd = getbzdsp ()) == NULL) return (-1); if (set_kata_giji_sbn (yomi_sno, yomi_eno, endvect, endvect1, &(*bzd)->sbn) < 0) return (-1);