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;
STDYOUT stdydat;
if(err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr)))
if((err = addel_arg(yomi, kanji, hinsi, yptr, sizeof(yptr))))
return err;
inputyomi = yomi;
cnvstart = ystart = yptr;
cnvlen = sstrlen(yptr);
if(err = checkdict(kanji, hinsi))
if((err = checkdict(kanji, hinsi)))
return err;
if(!curdict->maxunit)

View file

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

View file

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

View file

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

View file

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

View file

@ -58,7 +58,7 @@ u_int deldic(u_char* yomi, u_char* kanji, TypeGram hinsi) {
u_char * stp, *edp;
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;
if(!curdict->maxunit) return AD_NOTUSERDICT;

View file

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

View file

@ -79,7 +79,7 @@ void mkjiritu(int mode) {
}
for(jrec = maxjptr; jrec; jrec = jrec->jsort) {
if(stb = getstb(jrec->hinsi))
if((stb = getstb(jrec->hinsi)))
setubi(jrec, stb);
}
}
@ -95,7 +95,7 @@ dic_mu(int mode) {
dicsaml = 0;
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;
jrec = maxjptr;
while(child = jrec->jsort) {
while((child = jrec->jsort)) {
ptr = jrec;
jrec = child;
}
@ -144,7 +144,7 @@ JREC* argjrec(int len, JREC* rec) {
return jrec;
}
while(child = ptr->jsort) {
while((child = ptr->jsort)) {
if((int)child->jlen < len) break;
ptr = child;

View file

@ -344,8 +344,8 @@ static int
chrck_numtbl(u_short flg, u_short cond) {
u_short must;
if(cond = SelNumCond(cond)) {
if(must = (cond & SELNUMMUST)) {
if((cond = SelNumCond(cond))) {
if((must = (cond & SELNUMMUST))) {
if((flg & must) != must) return FALSE;
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 + 1];
if(j = ((tmp >> 4) & 3)) {
if((j = ((tmp >> 4) & 3))) {
*kanjitmp++ = Num4tbl[j = (3 - j) * 2];
*kanjitmp++ = Num4tbl[j + 1];
}
if(j = ((tmp >> 6) & 3)) {
if((j = ((tmp >> 6) & 3))) {
*kanjitmp++ = Num6tbl[j = (3 - j) * 2];
*kanjitmp++ = Num6tbl[j + 1];
}

View file

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

View file

@ -137,11 +137,11 @@ putfile(int fd, int pos, int len, u_char* p) {
static int
check_passwd(u_char* buf, char* passwd) {
buf += PASSWDPOS;
return (*buf && strncmp(passwd, buf, PASSWDLEN)) ? FALSE : TRUE;
return (*buf && strncmp(passwd, (char*)buf, PASSWDLEN)) ? FALSE : TRUE;
}
static void
set_passwd(u_char* buf, char* passwd) {
strncpy(buf + PASSWDPOS, passwd, PASSWDLEN);
strncpy((char*)buf + PASSWDPOS, passwd, PASSWDLEN);
}
static int
@ -732,7 +732,7 @@ int set_stdypass(char* pass) {
static void
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) {

View file

@ -116,7 +116,7 @@ int setconj(TypeGram hinsi, JREC* jrec, CREC* crec) {
int count = 0;
u_char* cnj;
if(cnj = Conjadr(hinsi)) {
if((cnj = Conjadr(hinsi))) {
saml = ofslen = 0;
yptr = cnvstart + jrec->jlen;
@ -139,7 +139,7 @@ int setconj(TypeGram hinsi, JREC* jrec, CREC* crec) {
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->right = right;
count++;

View file

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

View file

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