Fix warnings in clang

This commit is contained in:
Nishi 2026-06-19 02:57:26 +09:00
commit ceceab8d8b
21 changed files with 49 additions and 52 deletions

View file

@ -73,14 +73,14 @@ u_int adddic(u_char* yomi, u_char* kanji, TypeGram hinsi) {
STDYIN* stdy; STDYIN* stdy;
STDYOUT stdydat; STDYOUT stdydat;
if(err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr))) if((err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr))))
return err; return err;
inputyomi = yomi; inputyomi = yomi;
cnvstart = ystart = yptr; cnvstart = ystart = yptr;
cnvlen = sstrlen(yptr); cnvlen = sstrlen(yptr);
if(err = checkdict(kanji, hinsi)) if((err = checkdict(kanji, hinsi)))
return err; return err;
if(!curdict->maxunit) if(!curdict->maxunit)

View file

@ -131,7 +131,7 @@ yomi2kata(u_char* src, u_char* dst) {
int first; int first;
int second; int second;
while(first = *src++) { while((first = *src++)) {
second = *src++; second = *src++;
if(first != 0xa4) { if(first != 0xa4) {
@ -182,9 +182,9 @@ int cvtknj(u_char* yomi, u_char* knj, u_char* dst) {
keep = dst; keep = dst;
yomi2kata(yomi, kana); yomi2kata(yomi, kana);
if(len = top_strcmp(yomi, knj)) { if((len = top_strcmp(yomi, knj))) {
*dst = (u_char)(ZENHIRAASSYUKU | (len - 1)); *dst = (u_char)(ZENHIRAASSYUKU | (len - 1));
} else if(len = top_strcmp(kana, knj)) { } else if((len = top_strcmp(kana, knj))) {
*dst = (u_char)(ZENKATAASSYUKU | (len - 1)); *dst = (u_char)(ZENKATAASSYUKU | (len - 1));
} }
@ -195,10 +195,10 @@ int cvtknj(u_char* yomi, u_char* knj, u_char* dst) {
if(*knj) { if(*knj) {
for(;;) { for(;;) {
if(len = last_strcmp(yomi, knj)) { if((len = last_strcmp(yomi, knj))) {
*dst++ = (u_char)(ZENHIRAASSYUKU | (len - 1)); *dst++ = (u_char)(ZENHIRAASSYUKU | (len - 1));
break; break;
} else if(len = last_strcmp(kana, knj)) { } else if((len = last_strcmp(kana, knj))) {
*dst++ = (u_char)(ZENKATAASSYUKU | (len - 1)); *dst++ = (u_char)(ZENKATAASSYUKU | (len - 1));
break; break;
} else if(*knj == SS2) { } else if(*knj == SS2) {

View file

@ -62,7 +62,7 @@ int cl2knj(u_char* yomi, int len, u_char* kouho) {
} }
*ptr2 = 0; *ptr2 = 0;
strlcpy(orgyomi, yomi, (int)(ptr1 - yomi) + 1); strlcpy((char*)orgyomi, (char*)yomi, (int)(ptr1 - yomi) + 1);
if(!hyomi[0]) return 0; if(!hyomi[0]) return 0;

View file

@ -57,7 +57,7 @@ void cvtdict(KHREC* krec, CLREC* clrec, int flg) {
jlen = jrec->jlen; jlen = jrec->jlen;
if(i = jrec->sttofs) { if((i = jrec->sttofs)) {
if(i == SETTOU_KIGOU) { if(i == SETTOU_KIGOU) {
sttlen = 1; sttlen = 1;

View file

@ -165,7 +165,7 @@ void setstyrec(KHREC* krec) {
if(jrec->stbofs && (fptr = getstb(jrec->hinsi))) if(jrec->stbofs && (fptr = getstb(jrec->hinsi)))
stdy.len -= StbYomiLen(fptr + jrec->stbofs - 1); stdy.len -= StbYomiLen(fptr + jrec->stbofs - 1);
if(fptr = Settou_ptr(jrec->sttofs)) if((fptr = Settou_ptr(jrec->sttofs)))
stdy.sttlen = SttYomiLen(fptr); stdy.sttlen = SttYomiLen(fptr);
else else
stdy.sttlen = 0; stdy.sttlen = 0;

View file

@ -58,7 +58,7 @@ u_int deldic(u_char* yomi, u_char* kanji, TypeGram hinsi) {
u_char * stp, *edp; u_char * stp, *edp;
int size, len; int size, len;
if(err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr))) if((err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr))))
return err; return err;
if(!curdict->maxunit) return AD_NOTUSERDICT; if(!curdict->maxunit) return AD_NOTUSERDICT;

View file

@ -61,7 +61,7 @@ void mkbunsetu() {
else else
hinsi = jrec->hinsi; hinsi = jrec->hinsi;
if(right = Connadr[hinsi]) { if((right = Connadr[hinsi])) {
gobilen = 0; gobilen = 0;
next = cnvstart + jrec->jlen; next = cnvstart + jrec->jlen;
@ -73,7 +73,7 @@ void mkbunsetu() {
srchfzk(jrec, next, right, 0); srchfzk(jrec, next, right, 0);
} }
else if(count = setconj(hinsi, jrec, crec)) { else if((count = setconj(hinsi, jrec, crec))) {
for(i = count; i-- > 0;) { for(i = count; i-- > 0;) {
@ -108,7 +108,7 @@ argclrec(int len) {
ptr = NULL; ptr = NULL;
rec = maxclptr; rec = maxclptr;
while(child = rec->clsort) { while((child = rec->clsort)) {
ptr = rec; ptr = rec;
rec = child; rec = child;
} }
@ -141,7 +141,7 @@ argclrec(int len) {
return rec; return rec;
} }
while(child = ptr->clsort) { while((child = ptr->clsort)) {
if((int)child->cllen < len || if((int)child->cllen < len ||
((int)child->cllen == len && ((int)child->cllen == len &&
child->jnode->hinsi == TANKANJI)) { child->jnode->hinsi == TANKANJI)) {

View file

@ -79,7 +79,7 @@ void mkjiritu(int mode) {
} }
for(jrec = maxjptr; jrec; jrec = jrec->jsort) { for(jrec = maxjptr; jrec; jrec = jrec->jsort) {
if(stb = getstb(jrec->hinsi)) if((stb = getstb(jrec->hinsi)))
setubi(jrec, stb); setubi(jrec, stb);
} }
} }
@ -95,7 +95,7 @@ dic_mu(int mode) {
dicsaml = 0; dicsaml = 0;
prevseg = -1; prevseg = -1;
while(tagp = srchdict(tagp)) setjrec(tagp, mode); while((tagp = srchdict(tagp))) setjrec(tagp, mode);
} }
} }
@ -111,7 +111,7 @@ JREC* argjrec(int len, JREC* rec) {
ptr = NULL; ptr = NULL;
jrec = maxjptr; jrec = maxjptr;
while(child = jrec->jsort) { while((child = jrec->jsort)) {
ptr = jrec; ptr = jrec;
jrec = child; jrec = child;
} }
@ -144,7 +144,7 @@ JREC* argjrec(int len, JREC* rec) {
return jrec; return jrec;
} }
while(child = ptr->jsort) { while((child = ptr->jsort)) {
if((int)child->jlen < len) break; if((int)child->jlen < len) break;
ptr = child; ptr = child;

View file

@ -344,8 +344,8 @@ static int
chrck_numtbl(u_short flg, u_short cond) { chrck_numtbl(u_short flg, u_short cond) {
u_short must; u_short must;
if(cond = SelNumCond(cond)) { if((cond = SelNumCond(cond))) {
if(must = (cond & SELNUMMUST)) { if((must = (cond & SELNUMMUST))) {
if((flg & must) != must) return FALSE; if((flg & must) != must) return FALSE;
cond &= ~must; cond &= ~must;
} }

View file

@ -291,11 +291,11 @@ num_kurai(u_char* p, int len, u_char* tbl) {
*kanjitmp++ = tbl[j = ((tmp & 0x0f) - _NUM0) * 2]; *kanjitmp++ = tbl[j = ((tmp & 0x0f) - _NUM0) * 2];
*kanjitmp++ = tbl[j + 1]; *kanjitmp++ = tbl[j + 1];
if(j = ((tmp >> 4) & 3)) { if((j = ((tmp >> 4) & 3))) {
*kanjitmp++ = Num4tbl[j = (3 - j) * 2]; *kanjitmp++ = Num4tbl[j = (3 - j) * 2];
*kanjitmp++ = Num4tbl[j + 1]; *kanjitmp++ = Num4tbl[j + 1];
} }
if(j = ((tmp >> 6) & 3)) { if((j = ((tmp >> 6) & 3))) {
*kanjitmp++ = Num6tbl[j = (3 - j) * 2]; *kanjitmp++ = Num6tbl[j = (3 - j) * 2];
*kanjitmp++ = Num6tbl[j + 1]; *kanjitmp++ = Num6tbl[j + 1];
} }

View file

@ -299,7 +299,7 @@ static void
set_idxyomi() { set_idxyomi() {
u_char *p1, *p2; u_char *p1, *p2;
if(p2 = get_idxptr(peepidx)) { if((p2 = get_idxptr(peepidx))) {
p1 = peepyomi; p1 = peepyomi;
while(*p2) { while(*p2) {
cd2sjh_chr(*p2++, p1); cd2sjh_chr(*p2++, p1);

View file

@ -137,11 +137,11 @@ putfile(int fd, int pos, int len, u_char* p) {
static int static int
check_passwd(u_char* buf, char* passwd) { check_passwd(u_char* buf, char* passwd) {
buf += PASSWDPOS; buf += PASSWDPOS;
return (*buf && strncmp(passwd, buf, PASSWDLEN)) ? FALSE : TRUE; return (*buf && strncmp(passwd, (char*)buf, PASSWDLEN)) ? FALSE : TRUE;
} }
static void static void
set_passwd(u_char* buf, char* passwd) { set_passwd(u_char* buf, char* passwd) {
strncpy(buf + PASSWDPOS, passwd, PASSWDLEN); strncpy((char*)buf + PASSWDPOS, passwd, PASSWDLEN);
} }
static int static int
@ -732,7 +732,7 @@ int set_stdypass(char* pass) {
static void static void
set_comment(u_char* buf, char* comment) { set_comment(u_char* buf, char* comment) {
strlcpy(buf + HEADERLENGTH, comment, COMMENTLENGTH); strlcpy((char*)buf + HEADERLENGTH, comment, COMMENTLENGTH);
} }
int set_dictcmnt(DictFile* dp, char* cmnt) { int set_dictcmnt(DictFile* dp, char* cmnt) {

View file

@ -116,7 +116,7 @@ int setconj(TypeGram hinsi, JREC* jrec, CREC* crec) {
int count = 0; int count = 0;
u_char* cnj; u_char* cnj;
if(cnj = Conjadr(hinsi)) { if((cnj = Conjadr(hinsi))) {
saml = ofslen = 0; saml = ofslen = 0;
yptr = cnvstart + jrec->jlen; yptr = cnvstart + jrec->jlen;
@ -139,7 +139,7 @@ int setconj(TypeGram hinsi, JREC* jrec, CREC* crec) {
if(isdpnd(*(yptr + saml))) continue; if(isdpnd(*(yptr + saml))) continue;
if(right = cnvrow(jrec, (TypeCnct)CnjRight(cnj))) { if((right = cnvrow(jrec, (TypeCnct)CnjRight(cnj)))) {
crec->len = (u_char)(ofslen + saml); crec->len = (u_char)(ofslen + saml);
crec->right = right; crec->right = right;
count++; count++;

View file

@ -53,7 +53,7 @@ srch_josuu_sub(JREC* jrec, TypeGram gram) {
dicinl = 1; dicinl = 1;
dicsaml = 0; dicsaml = 0;
prevseg = -1; prevseg = -1;
while(tagp = srchdict(tagp)) setnumrec(tagp, jrec, gram); while((tagp = srchdict(tagp))) setnumrec(tagp, jrec, gram);
} }
} }
@ -101,7 +101,7 @@ setnrec_sub(u_char* p, u_short flag, int stb) {
return; return;
} }
if(rec = argjrec(len1, (JREC*)NULL)) { if((rec = argjrec(len1, (JREC*)NULL))) {
rec->class = suuji_class; rec->class = suuji_class;
rec->hinsi = SUUSI; rec->hinsi = SUUSI;
rec->sttofs = headcode; rec->sttofs = headcode;
@ -192,7 +192,7 @@ check_num(u_char* ptr) {
for(i = suuji_keta; --i >= 0;) { for(i = suuji_keta; --i >= 0;) {
if(hketa >= 4) return FALSE; if(hketa >= 4) return FALSE;
tmp = suuji_ubuf[i]; tmp = suuji_ubuf[i];
if(j = ((tmp >> 6) & 3)) { if((j = ((tmp >> 6) & 3))) {
if(j < hketa) return FALSE; if(j < hketa) return FALSE;
if(j > hketa) { if(j > hketa) {
flag |= JFLAG_N01; flag |= JFLAG_N01;

View file

@ -115,7 +115,7 @@ void wakachi() {
return; return;
if(jrec->jlen) { if(jrec->jlen) {
if(clrec = argclrec((int)jrec->jlen)) { if((clrec = argclrec((int)jrec->jlen))) {
clrec->jnode = jrec; clrec->jnode = jrec;
clrec->right = R_MEISI; clrec->right = R_MEISI;
clrec->kubun = K_TAIGEN; clrec->kubun = K_TAIGEN;

View file

@ -72,7 +72,7 @@ int cnvhinsi(u_char* buf) {
mid = (min + max) / 2; mid = (min + max) / 2;
i = u_strcmp(buf, gramtbl[mid].name); i = u_strcmp(buf, (u_char*)gramtbl[mid].name);
if(i < 0) { if(i < 0) {
max = mid - 1; max = mid - 1;

View file

@ -88,7 +88,7 @@ char* get_idxlist(char* name) {
i = 0; i = 0;
for(q = p; *q;) { for(q = p; *q;) {
if(fp = fopen(q, "r")) if((fp = fopen(q, "r")))
fclose(fp); fclose(fp);
else { else {
fprintf(stderr, "Can't open %s mode \"r\"\n", q); fprintf(stderr, "Can't open %s mode \"r\"\n", q);
@ -106,7 +106,7 @@ void parse(int argc, char** argv) {
char* progname = NULL; char* progname = NULL;
char* p; char* p;
if(progname = strrchr(argv[0], '/')) if((progname = strrchr(argv[0], '/')))
progname++; progname++;
else else
progname = argv[0]; progname = argv[0];

View file

@ -112,19 +112,19 @@ makekanji(int* yomi, int* kanji, int* atr, int* len) {
#endif #endif
} }
if(i = top_strcmp(yomi, kanji)) { if((i = top_strcmp(yomi, kanji))) {
kanji += i; kanji += i;
ktmp[pos++] = (ZENHIRAASSYUKU | (i - 1)); ktmp[pos++] = (ZENHIRAASSYUKU | (i - 1));
} else if(i = top_strcmp(kana, kanji)) { } else if((i = top_strcmp(kana, kanji))) {
kanji += i; kanji += i;
ktmp[pos++] = (ZENKATAASSYUKU | (i - 1)); ktmp[pos++] = (ZENKATAASSYUKU | (i - 1));
} }
while(*kanji) { while(*kanji) {
if(i = last_strcmp(yomi, kanji)) { if((i = last_strcmp(yomi, kanji))) {
kanji += i; kanji += i;
ktmp[pos++] = (ZENHIRAASSYUKU | (i - 1)); ktmp[pos++] = (ZENHIRAASSYUKU | (i - 1));
} else if(i = last_strcmp(kana, kanji)) { } else if((i = last_strcmp(kana, kanji))) {
kanji += i; kanji += i;
ktmp[pos++] = (ZENKATAASSYUKU | (i - 1)); ktmp[pos++] = (ZENKATAASSYUKU | (i - 1));
} else if(((*kanji >> 8) & 0xff) == SS2 || *kanji < 0x100) { } else if(((*kanji >> 8) & 0xff) == SS2 || *kanji < 0x100) {
@ -293,7 +293,7 @@ douon_knj(DouonRec* drec) {
int i; int i;
int len = 0; int len = 0;
u_char* p; u_char* p;
u_char* knjofscvt(); u_char* knjofscvt(u_char*, int, int*);
HinsiRec* hrec; HinsiRec* hrec;
KanjiRec* krec; KanjiRec* krec;
@ -442,7 +442,7 @@ void makelist(int* yomi, int* kanji, int hinsi, int* atr) {
kcode = makekanji(yomi, kanji, atr, &klen); kcode = makekanji(yomi, kanji, atr, &klen);
if(drectmp && strcmp(ycode, drectmp->yptr)) { if(drectmp && strcmp((char*)ycode, (char*)drectmp->yptr)) {
make_d_list(drectmp); make_d_list(drectmp);
drectmp = NULL; drectmp = NULL;

View file

@ -225,7 +225,7 @@ void makeseg() {
dst += DOUONBLKSIZENUMBER; dst += DOUONBLKSIZENUMBER;
p = drec->yptr; p = drec->yptr;
slen = strlen(p) - drec->dlen; slen = strlen((char*)p) - drec->dlen;
p += slen; p += slen;
for(i = drec->dlen; i > 0; i--) { for(i = drec->dlen; i > 0; i--) {
datset(*p); datset(*p);
@ -291,7 +291,7 @@ void makeseg() {
fprintf(stderr, "\275\320\316\317\245\325\245\241\245\244\245\353\244\307\245\267\241\274\245\257\245\250\245\351\241\274\n"); fprintf(stderr, "\275\320\316\317\245\325\245\241\245\244\245\353\244\307\245\267\241\274\245\257\245\250\245\351\241\274\n");
exit(1); exit(1);
} }
if(Fwrite(buf, sizeof(buf), 1, outfp) != 1) { if(Fwrite((char*)buf, sizeof(buf), 1, outfp) != 1) {
fprintf(stderr, "\275\320\316\317\245\325\245\241\245\244\245\353\244\307\245\351\245\244\245\310\245\250\245\351\241\274\n"); fprintf(stderr, "\275\320\316\317\245\325\245\241\245\244\245\353\244\307\245\351\245\244\245\310\245\250\245\351\241\274\n");
exit(1); exit(1);
} }
@ -328,10 +328,7 @@ err:
#undef datset #undef datset
} }
static void put4byte(p, n) static void put4byte(u_char* p, long n) {
u_char* p;
long n;
{
p += 3; p += 3;
*p-- = n; *p-- = n;
n >>= 8; n >>= 8;
@ -379,9 +376,9 @@ void makehead(u_char* dict_name) {
put4byte(header + DICTASEGLEN, 0); put4byte(header + DICTASEGLEN, 0);
Fseek(outfp, (long)HEADERPOS, 0); Fseek(outfp, (long)HEADERPOS, 0);
Fwrite(header, sizeof(header), 1, outfp); Fwrite((char*)header, sizeof(header), 1, outfp);
Fseek(outfp, (long)INDEXPOS, 0); Fseek(outfp, (long)INDEXPOS, 0);
Fwrite(mindex, MAININDEXLENGTH, 1, outfp); Fwrite((char*)mindex, MAININDEXLENGTH, 1, outfp);
#undef INDEXPOS #undef INDEXPOS
} }

View file

@ -233,7 +233,7 @@ int* readline() {
error(NOKANJISTRING); error(NOKANJISTRING);
i = j = 0; i = j = 0;
while(c = readhinsi()) { while((c = readhinsi())) {
if(c < 0) { if(c < 0) {
if(i >= MAXATRNUMBER) if(i >= MAXATRNUMBER)
error(TOOMANYATR); error(TOOMANYATR);

View file

@ -90,7 +90,7 @@
#define NODATAINMAIN "\245\341\245\244\245\363\274\255\275\361\244\313\302\270\272\337\244\267\244\336\244\273\244\363" #define NODATAINMAIN "\245\341\245\244\245\363\274\255\275\361\244\313\302\270\272\337\244\267\244\336\244\273\244\363"
#define TOOMANYTARGET "\311\312\273\354\244\362\243\261\244\304\273\330\304\352\244\267\244\306\244\257\244\300\244\265\244\244" #define TOOMANYTARGET "\311\312\273\354\244\362\243\261\244\304\273\330\304\352\244\267\244\306\244\257\244\300\244\265\244\244"
#define HINSITANKAN cnvhinsi("\303\261\264\301") #define HINSITANKAN cnvhinsi((u_char*)"\303\261\264\301")
#define FALSE 0 #define FALSE 0
#define TRUE (!FALSE) #define TRUE (!FALSE)