diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-05-02 12:29:48 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-05-02 12:29:48 +0000 |
commit | 808caf0e3038020441cdb1d964efd26ebc6ba474 (patch) | |
tree | f72207f17bd49ccc4d9e78e974f8a95762c4a68e /Build/source/texk | |
parent | 55899550ec16f1a2fccf4420316345016882f7cd (diff) |
texk/mendex: Change most 'unsigned char' into plain 'char'
to avoid lots of 'differ in signedness' warnings from gcc-4.4
git-svn-id: svn://tug.org/texlive/trunk@22277 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/mendexk/ChangeLog.TL | 28 | ||||
-rw-r--r-- | Build/source/texk/mendexk/Makefile.am | 6 | ||||
-rw-r--r-- | Build/source/texk/mendexk/Makefile.in | 3 | ||||
-rwxr-xr-x | Build/source/texk/mendexk/configure | 28 | ||||
-rw-r--r-- | Build/source/texk/mendexk/configure.ac | 5 | ||||
-rw-r--r-- | Build/source/texk/mendexk/convert.c | 37 | ||||
-rw-r--r-- | Build/source/texk/mendexk/exkana.h | 22 | ||||
-rw-r--r-- | Build/source/texk/mendexk/exvar.h | 4 | ||||
-rw-r--r-- | Build/source/texk/mendexk/fread.c | 32 | ||||
-rw-r--r-- | Build/source/texk/mendexk/fwrite.c | 8 | ||||
-rw-r--r-- | Build/source/texk/mendexk/kana.h | 22 | ||||
-rw-r--r-- | Build/source/texk/mendexk/ktable.h | 10 | ||||
-rw-r--r-- | Build/source/texk/mendexk/main.c | 2 | ||||
-rw-r--r-- | Build/source/texk/mendexk/mendex.h | 16 | ||||
-rw-r--r-- | Build/source/texk/mendexk/sort.c | 30 | ||||
-rw-r--r-- | Build/source/texk/mendexk/var.h | 4 |
16 files changed, 123 insertions, 134 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog.TL b/Build/source/texk/mendexk/ChangeLog.TL index 104cb0757c8..b2a58d6d428 100644 --- a/Build/source/texk/mendexk/ChangeLog.TL +++ b/Build/source/texk/mendexk/ChangeLog.TL @@ -1,6 +1,34 @@ ChangeLog.TL: TeX Live (TL) changes for mendexk =============================================== +2011-04-23 Peter Breitenlohner <peb@mppmu.mpg.de> + + * Makefile.am (EXTRA_DIST): No need to mention ChangeLog, README. + * configure.ac: Drop useless check for <strings.h>. + + * convert.c, fread.c, main.c, sort.c: Do not typecast the + result of malloc(). + +2011-04-22 Peter Breitenlohner <peb@mppmu.mpg.de> + + Avoid 'differ in signedness' warnings. + The string functions strlen(), strcmp(), strncmp(), strcpy(), + and strncpy() all expect 'char *' arguments and gcc-4.x will + create warnings for 'signed char *' and 'unsigned char *' args. + Moreover strcmp() and strncmp() will always compare string bytes + interpreted as 'unsigned char'. Finally initializing plain char + array elements with, e.g., '0x80' always does the right thing. + + * convert.c, exkana.h, exvar.h, fread.c, fwrite.c, kana.h, + ktable.h, mendex.h, sort.c, var.h: Change type of all global and + local vars, function params, and struct members from 'unsigned + char' or 'unsigned char *' to plain 'char' or 'char *', but + always cast string bytes to 'unsigned char' when tested for '<', + '<=', '>', or '>='. + + * convert.c, fread.c, main.c, sort.c: Do not typecast the + result of malloc(). + 2010-04-17 Peter Breitenlohner <peb@mppmu.mpg.de> * convert.c (dicread, dicvalread), fread.c (idxread), diff --git a/Build/source/texk/mendexk/Makefile.am b/Build/source/texk/mendexk/Makefile.am index bf5fe2dda07..7cb1c85e804 100644 --- a/Build/source/texk/mendexk/Makefile.am +++ b/Build/source/texk/mendexk/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the TeX Live subdirectory texk/mendexk/ ## -## Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org> +## Copyright (C) 2010, 2011 Peter Breitenlohner <tex-live@tug.org> ## You may freely use, modify and/or distribute this file. ## ACLOCAL_AMFLAGS = -I ../../m4 @@ -42,9 +42,7 @@ dist_man1_MANS = mendex.1 EXTRA_DIST = \ COPYRIGHT \ COPYRIGHT.jis \ - ChangeLog \ - ChangeLog.TL \ - README + ChangeLog.TL ## Eventually delete these files ## diff --git a/Build/source/texk/mendexk/Makefile.in b/Build/source/texk/mendexk/Makefile.in index c85474acd0b..4cafb83d593 100644 --- a/Build/source/texk/mendexk/Makefile.in +++ b/Build/source/texk/mendexk/Makefile.in @@ -274,8 +274,7 @@ mendex_SOURCES = \ LDADD = $(PTEXENC_LIBS) $(KPATHSEA_LIBS) dist_man1_MANS = mendex.1 -EXTRA_DIST = COPYRIGHT COPYRIGHT.jis ChangeLog ChangeLog.TL README \ - indexsty mendex.doc +EXTRA_DIST = COPYRIGHT COPYRIGHT.jis ChangeLog.TL indexsty mendex.doc all: c-auto.h $(MAKE) $(AM_MAKEFLAGS) all-am diff --git a/Build/source/texk/mendexk/configure b/Build/source/texk/mendexk/configure index 7df6c35c9f6..084bf0413dc 100755 --- a/Build/source/texk/mendexk/configure +++ b/Build/source/texk/mendexk/configure @@ -762,8 +762,7 @@ CFLAGS LDFLAGS LIBS CPPFLAGS -CPP -CPPFLAGS' +CPP' # Initialize some variables set by options. @@ -12503,31 +12502,6 @@ WARNING_CFLAGS=$kpse_cv_warning_cflags ac_config_headers="$ac_config_headers c-auto.h:c-auto.in" -for ac_header in strings.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" -if test "x$ac_cv_header_strings_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRINGS_H 1 -_ACEOF - -fi - -done - -for ac_func -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - kpse_save_CPPFLAGS=$CPPFLAGS kpse_save_LIBS=$LIBS diff --git a/Build/source/texk/mendexk/configure.ac b/Build/source/texk/mendexk/configure.ac index ecd187ba60b..074cd8f189e 100644 --- a/Build/source/texk/mendexk/configure.ac +++ b/Build/source/texk/mendexk/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl Copyright (C) 2010 Peter Breitenlohner <tex-live@tug.org> +dnl Copyright (C) 2010, 2011 Peter Breitenlohner <tex-live@tug.org> dnl dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, @@ -17,9 +17,6 @@ KPSE_COMMON([mendexk], [no-define]) AC_CONFIG_HEADERS([c-auto.h:c-auto.in]) -AC_CHECK_HEADERS([strings.h]) -AC_CHECK_FUNCS([]) - KPSE_KPATHSEA_FLAGS KPSE_PTEXENC_FLAGS diff --git a/Build/source/texk/mendexk/convert.c b/Build/source/texk/mendexk/convert.c index 886d07bfafb..3d7d4241d22 100644 --- a/Build/source/texk/mendexk/convert.c +++ b/Build/source/texk/mendexk/convert.c @@ -17,11 +17,11 @@ #endif struct dictionary{ -unsigned char dic[2][50]; +char dic[2][50]; }; -struct dictionary *dictable,*envdic; -int dlines=0,elines=0; +static struct dictionary *dictable,*envdic; +static int dlines=0,elines=0; static int dicvalread(const char *filename, struct dictionary *dicval, int line); @@ -32,15 +32,15 @@ void initkanatable(void) for (i=0xa4a1;i<=0xa4f3;i++) { cc=i-0xa4a1; - hiragana[cc*2]=(unsigned char)((i>>8)&0xff); - hiragana[cc*2+1]=(unsigned char)(i&0xff); + hiragana[cc*2]=((i>>8)&0xff); + hiragana[cc*2+1]=(i&0xff); } hiragana[(i-0xa4a1)*2]=0; for (i=0xa5a1;i<=0xa5f6;i++) { cc=i-0xa5a1; - katakana[cc*2]=(unsigned char)((i>>8)&0xff); - katakana[cc*2+1]=(unsigned char)(i&0xff); + katakana[cc*2]=((i>>8)&0xff); + katakana[cc*2+1]=(i&0xff); } katakana[(i-0xa5a1)*2]=0; @@ -87,7 +87,7 @@ int dicread(const char *filename) } nkf_close(fp); - dictable=(struct dictionary *)malloc(sizeof(struct dictionary)*i); + dictable=malloc(sizeof(struct dictionary)*i); dlines=dicvalread(filename,dictable,i); @@ -124,7 +124,7 @@ ENV: } nkf_close(fp); - envdic=(struct dictionary *)malloc(sizeof(struct dictionary)*i); + envdic=malloc(sizeof(struct dictionary)*i); elines=dicvalread(envfile,envdic,i); @@ -140,7 +140,7 @@ static int dcomp(const void *bf1, const void *bf2); static int dicvalread(const char *filename, struct dictionary *dicval, int line) { int i,j,k; - unsigned char buff[256]; + char buff[256]; FILE *fp; if(kpse_in_name_ok(filename)) @@ -195,14 +195,14 @@ static int dcomp(const void *bf1, const void *bf2) if (((*buff1).dic[0][i]=='\0')&&((*buff2).dic[0][i]=='\0')) return 0; else if (((*buff1).dic[0][i]=='\0')&&((*buff2).dic[0][i]!='\0')) return 1; else if (((*buff1).dic[0][i]!='\0')&&((*buff2).dic[0][i]=='\0')) return -1; - else if ((*buff1).dic[0][i]<(*buff2).dic[0][i]) return 1; - else if ((*buff1).dic[0][i]>(*buff2).dic[0][i]) return -1; + else if ((unsigned char)(*buff1).dic[0][i]<(unsigned char)(*buff2).dic[0][i]) return 1; + else if ((unsigned char)(*buff1).dic[0][i]>(unsigned char)(*buff2).dic[0][i]) return -1; } return 0; } /* convert to capital-hiragana character */ -int convert(unsigned char *buff1, unsigned char *buff2) +int convert(char *buff1, char *buff2) { int i=0,j=0,k,l; char errbuff[4096]; @@ -223,7 +223,7 @@ int convert(unsigned char *buff1, unsigned char *buff2) i++; } - else if (buff1[i]<0x80) { + else if ((unsigned char)buff1[i]<0x80) { buff2[j]=buff1[i]; i++; j++; @@ -284,7 +284,7 @@ MATCH3: j+=2; } - else if (buff1[i]>=0x80) { + else if ((unsigned char)buff1[i]>=0x80) { if ((strncmp(&buff1[i],SPACE,2)>=0)&&(strncmp(&buff1[i],ALPHAEND,2)<=0)) { /* alpha-numeric,symbols */ for (k=0;k<strlen(symboltable);k+=2) { @@ -526,10 +526,3 @@ int pnumconv(char *page, int attr) } return cc; } - -#if 0 /* unused */ -int nbyte(unsigned char *str, int n) -{ - return (unsigned int)str[n]; -} -#endif /* 0 */ diff --git a/Build/source/texk/mendexk/exkana.h b/Build/source/texk/mendexk/exkana.h index a088a97fde0..4fefbf04300 100644 --- a/Build/source/texk/mendexk/exkana.h +++ b/Build/source/texk/mendexk/exkana.h @@ -1,12 +1,12 @@ -extern unsigned char AKASATANA[]; -extern unsigned char *akasatana; -extern unsigned char AIUEO[]; -extern unsigned char *aiueo; +extern char AKASATANA[]; +extern char *akasatana; +extern char AIUEO[]; +extern char *aiueo; -extern unsigned char ONBIKI[]; -extern unsigned char SPACE[]; -extern unsigned char ALPHAEND[]; -extern unsigned char HIRATOP[]; -extern unsigned char HIRAEND[]; -extern unsigned char KATATOP[]; -extern unsigned char KATAEND[]; +extern char ONBIKI[]; +extern char SPACE[]; +extern char ALPHAEND[]; +extern char HIRATOP[]; +extern char HIRAEND[]; +extern char KATATOP[]; +extern char KATAEND[]; diff --git a/Build/source/texk/mendexk/exvar.h b/Build/source/texk/mendexk/exvar.h index 7190a233c72..a30a77220b4 100644 --- a/Build/source/texk/mendexk/exvar.h +++ b/Build/source/texk/mendexk/exvar.h @@ -29,6 +29,6 @@ extern char symhead_positive[2048],symhead_negative[2048]; extern char numhead_positive[2048],numhead_negative[2048]; extern int symbol_flag; extern int letter_head; -extern unsigned char atama[2048]; -extern unsigned char page_compositor[2048],page_precedence[2048]; +extern char atama[2048]; +extern char page_compositor[2048],page_precedence[2048]; extern char character_order[2048]; diff --git a/Build/source/texk/mendexk/fread.c b/Build/source/texk/mendexk/fread.c index 9f5bc324c79..4d04940380c 100644 --- a/Build/source/texk/mendexk/fread.c +++ b/Build/source/texk/mendexk/fread.c @@ -12,14 +12,14 @@ #define BUFSIZE 65535 -static int getestr(unsigned char *buff, unsigned char *estr); +static int getestr(char *buff, char *estr); static void chkpageattr(struct page *p); /* read idx file */ int idxread(char *filename, int start) { int i,j,k,l,m,n,cc,indent,wflg,flg=0,bflg=0,nest,esc,quo,eflg=0,pacc,preject; - unsigned char buff[BUFSIZE],wbuff[BUFSIZE],estr[256],table[BUFSIZE],*tmp1,*tmp2; + char buff[BUFSIZE],wbuff[BUFSIZE],estr[256],table[BUFSIZE],*tmp1,*tmp2; FILE *fp; pacc=acc; @@ -119,7 +119,7 @@ LOOP: n++; goto LOOP; } - ind[i].idx[indent]=(unsigned char *)malloc(k+1); + ind[i].idx[indent]=malloc(k+1); if (ind[i].idx[indent]==NULL) { fprintf(stderr,"Malloc error.(ind[%d].idx[%d])\n",i,indent); exit(-1); @@ -142,7 +142,7 @@ LOOP: n++; goto LOOP; } - ind[i].org[indent]=(unsigned char *)malloc(k+1); + ind[i].org[indent]=malloc(k+1); if (ind[i].org[indent]==NULL) { fprintf(stderr,"Malloc error.(ind[%d].org[%d])\n",i,indent); exit(-1); @@ -170,7 +170,7 @@ LOOP: } else estr[0]='\0'; - ind[i].idx[indent]=(unsigned char *)malloc(k+1); + ind[i].idx[indent]=malloc(k+1); if (ind[i].idx[indent]==NULL) { fprintf(stderr,"Malloc error.(ind[%d].idx[%d])\n",i,indent); exit(-1); @@ -219,7 +219,7 @@ LOOP: wbuff[k]=buff[j]; if (buff[j]!=escape) esc=0; - if (buff[j]>=0x80) { + if ((unsigned char)buff[j]>=0x80) { wbuff[k+1]=buff[j+1]; j++; k++; @@ -240,7 +240,7 @@ LOOP: n++; goto LOOP; } - ind[i].dic[k]=(unsigned char *)malloc(strlen(table)+1); + ind[i].dic[k]=malloc(strlen(table)+1); if (ind[i].dic[k]==NULL) { fprintf(stderr,"Malloc error.(ind[%d].dic[%d])\n",i,k); exit(-1); @@ -257,7 +257,7 @@ LOOP: n++; goto LOOP; } - ind[i].dic[k]=(unsigned char *)malloc(strlen(table)+1); + ind[i].dic[k]=malloc(strlen(table)+1); if (ind[i].dic[k]==NULL) { fprintf(stderr,"Malloc error.(ind[%d].dic[%d])\n",i,k); exit(-1); @@ -271,7 +271,7 @@ LOOP: if (i==0) { ind[0].num=0; - ind[0].p=(struct page *)malloc(sizeof(struct page)*16); + ind[0].p=malloc(sizeof(struct page)*16); for (;buff[j]!=arg_open && buff[j]!='\n' && buff[j]!='\0';j++); if (buff[j]=='\n' || buff[j]=='\0') { verb_printf(efp,"\nWarning: Missing second argument in %s, line %d.",filename,ind[i].lnum); @@ -306,7 +306,7 @@ LOOP: } else nest--; } - else if (buff[j]>=0x80) { + else if ((unsigned char)buff[j]>=0x80) { table[k]=buff[j]; j++; k++; @@ -378,7 +378,7 @@ LOOP: if (nest==0) break; else nest--; } - else if (buff[j]>=0x80) { + else if ((unsigned char)buff[j]>=0x80) { table[k]=buff[j]; j++; k++; @@ -408,7 +408,7 @@ LOOP: } else { ind[i].num=0; - ind[i].p=(struct page *)malloc(sizeof(struct page)*16); + ind[i].p=malloc(sizeof(struct page)*16); for (;buff[j]!=arg_open && buff[j]!='\n' && buff[j]!='\0';j++); if (buff[j]=='\n' || buff[j]=='\0') { verb_printf(efp,"\nWarning: Missing second argument in %s, line %d.",filename,ind[i].lnum); @@ -439,7 +439,7 @@ LOOP: } else nest--; } - else if (buff[j]>=0x80) { + else if ((unsigned char)buff[j]>=0x80) { table[k]=buff[j]; j++; k++; @@ -460,14 +460,14 @@ LOOP: } /* pic up encap string */ -static int getestr(unsigned char *buff, unsigned char *estr) +static int getestr(char *buff, char *estr) { int i,nest=0; for (i=0;i<strlen(buff);i++) { if (buff[i]==encap) { if (i>0) { - if (buff[i-1]<0x80) { + if ((unsigned char)buff[i-1]<0x80) { estr[i]=buff[i]; i++; } @@ -484,7 +484,7 @@ static int getestr(unsigned char *buff, unsigned char *estr) if (buff[i]==arg_open) nest++; else if (buff[i]==arg_close) nest--; estr[i]=buff[i]; - if (buff[i]>0x80) { + if ((unsigned char)buff[i]>0x80) { i++; estr[i]=buff[i]; } diff --git a/Build/source/texk/mendexk/fwrite.c b/Build/source/texk/mendexk/fwrite.c index 2f2b35283e2..07b332fa647 100644 --- a/Build/source/texk/mendexk/fwrite.c +++ b/Build/source/texk/mendexk/fwrite.c @@ -74,7 +74,7 @@ int verb_printf(FILE *fp, const char *format, ...) void indwrite(char *filename, struct index *ind, int pagenum) { int i,j,hpoint=0; - unsigned char datama[256],lbuff[4096]; + char datama[256],lbuff[4096]; FILE *fp; if (filename[0]!='\0' && kpse_out_name_ok(filename)) fp=fopen(filename,"w"); @@ -116,7 +116,7 @@ void indwrite(char *filename, struct index *ind, int pagenum) if (lethead_flag) { fputs(lethead_prefix,fp); for (j=hpoint;j<(strlen(datama)/2);j++) { - if (ind[i].dic[0][1]<datama[j*2+1]) { + if ((unsigned char)ind[i].dic[0][1]<(unsigned char)datama[j*2+1]) { fprintf(fp,"%c%c",atama[(j-1)*2],atama[(j-1)*2+1]); hpoint=j; break; @@ -129,7 +129,7 @@ void indwrite(char *filename, struct index *ind, int pagenum) } sprintf(lbuff,"%s%s",item_0,ind[i].idx[0]); for (hpoint=0;hpoint<(strlen(datama)/2);hpoint++) { - if (ind[i].dic[0][1]<datama[hpoint*2+1]) { + if ((unsigned char)ind[i].dic[0][1]<(unsigned char)datama[hpoint*2+1]) { break; } } @@ -177,7 +177,7 @@ void indwrite(char *filename, struct index *ind, int pagenum) } else if (japanese(ind[i].dic[0])) { for (j=hpoint;j<(strlen(datama)/2);j++) { - if ((ind[i].dic[0][0]<=datama[j*2])&&(ind[i].dic[0][1]<datama[j*2+1])) { + if ((unsigned char)(ind[i].dic[0][0]<=(unsigned char)datama[j*2])&&((unsigned char)ind[i].dic[0][1]<(unsigned char)datama[j*2+1])) { break; } } diff --git a/Build/source/texk/mendexk/kana.h b/Build/source/texk/mendexk/kana.h index e83f4a35fe7..7ad88383b9e 100644 --- a/Build/source/texk/mendexk/kana.h +++ b/Build/source/texk/mendexk/kana.h @@ -1,6 +1,6 @@ #include "exkana.h" -unsigned char AKASATANA[]={ +char AKASATANA[]={ 0xa4,0xa2, /* あ */ 0xa4,0xab, /* か */ 0xa4,0xb5, /* さ */ @@ -13,9 +13,9 @@ unsigned char AKASATANA[]={ 0xa4,0xef, /* わ */ 0 }; -unsigned char *akasatana; +char *akasatana; -unsigned char AIUEO[]={ +char AIUEO[]={ 0xa4,0xa2, /* あ */ 0xa4,0xa4, /* い */ 0xa4,0xa6, /* う */ @@ -66,12 +66,12 @@ unsigned char AIUEO[]={ 0xa4,0xf3, /* ん */ 0 }; -unsigned char *aiueo; +char *aiueo; -unsigned char ONBIKI[]={0xa1,0xbc,0}; /* ー */ -unsigned char SPACE[]={0xa1,0xa1,0}; /* 全角スペース */ -unsigned char ALPHAEND[]={0xa3,0xfa,0}; /* z */ -unsigned char HIRATOP[]={0xa4,0xa1,0}; /* ぁ */ -unsigned char HIRAEND[]={0xa4,0xf3,0}; /* ん */ -unsigned char KATATOP[]={0xa5,0xa1,0}; /* ァ */ -unsigned char KATAEND[]={0xa5,0xf6,0}; /* ヶ */ +char ONBIKI[]={0xa1,0xbc,0}; /* ー */ +char SPACE[]={0xa1,0xa1,0}; /* 全角スペース */ +char ALPHAEND[]={0xa3,0xfa,0}; /* z */ +char HIRATOP[]={0xa4,0xa1,0}; /* ぁ */ +char HIRAEND[]={0xa4,0xf3,0}; /* ん */ +char KATATOP[]={0xa5,0xa1,0}; /* ァ */ +char KATAEND[]={0xa5,0xf6,0}; /* ヶ */ diff --git a/Build/source/texk/mendexk/ktable.h b/Build/source/texk/mendexk/ktable.h index 25740b84512..69f322b72ca 100644 --- a/Build/source/texk/mendexk/ktable.h +++ b/Build/source/texk/mendexk/ktable.h @@ -1,6 +1,6 @@ -unsigned char hiragana[200]; -unsigned char katakana[200]; -unsigned char kanatable[]={ +char hiragana[200]; +char katakana[200]; +char kanatable[]={ 0xa4,0xa2, /* あ */ 0xa4,0xa2, /* あ */ 0xa4,0xa4, /* い */ @@ -89,7 +89,7 @@ unsigned char kanatable[]={ 0xa4,0xab, /* か */ 0 }; -unsigned char symboltable[]={ +char symboltable[]={ 0xa1,0xa1, /* スペース */ 0xa1,0xaa, /* ! */ 0xa1,0xc9, /* ” */ @@ -187,7 +187,7 @@ unsigned char symboltable[]={ 0xa1,0xc1, /* 〜 */ 0 }; -unsigned char btable[6][21]={ +char btable[6][21]={ {0xa4,0xa2, /* あ */ 0xa4,0xab, /* か */ 0xa4,0xb5, /* さ */ diff --git a/Build/source/texk/mendexk/main.c b/Build/source/texk/mendexk/main.c index 88b8682b75c..71bc1f85d00 100644 --- a/Build/source/texk/mendexk/main.c +++ b/Build/source/texk/mendexk/main.c @@ -296,7 +296,7 @@ int main(int argc, char **argv) lines=0; ecount=0; - ind=(struct index *)malloc(sizeof(struct index)); + ind=malloc(sizeof(struct index)); for (i=0;i<idxcount-fsti;i++) { ecount+=idxread(idxfile[i],lines); diff --git a/Build/source/texk/mendexk/mendex.h b/Build/source/texk/mendexk/mendex.h index da931e5422b..81a7ecd8e33 100644 --- a/Build/source/texk/mendexk/mendex.h +++ b/Build/source/texk/mendexk/mendex.h @@ -7,16 +7,16 @@ struct page { struct index { int num; char words; - unsigned char *org[3]; - unsigned char *dic[3]; - unsigned char *idx[3]; + char *org[3]; + char *dic[3]; + char *idx[3]; struct page *p; int lnum; }; /* convert.c */ void initkanatable(void); -int convert(unsigned char *buff1, unsigned char *buff2); +int convert(char *buff1, char *buff2); int pnumconv(char *page, int attr); int dicread(const char *filename); @@ -26,10 +26,10 @@ int lastpage(const char *filename); /* sort.c */ void wsort(struct index *ind, int num); void pagesort(struct index *ind, int num); -int alphanumeric(unsigned char c); -int alphabet(unsigned char c); -int numeric(unsigned char c); -int japanese(unsigned char *buff); +int alphanumeric(char c); +int alphabet(char c); +int numeric(char c); +int japanese(char *buff); int chkcontinue(struct page *p, int num); /* styfile.c */ diff --git a/Build/source/texk/mendexk/sort.c b/Build/source/texk/mendexk/sort.c index 39d2f19160c..f6eccbde304 100644 --- a/Build/source/texk/mendexk/sort.c +++ b/Build/source/texk/mendexk/sort.c @@ -11,7 +11,7 @@ int sym,number,alpha,kana; static int wcomp(const void *p, const void *q); static int pcomp(const void *p, const void *q); -static int ordering(unsigned char *buff); +static int ordering(char *buff); /* sort index */ void wsort(struct index *ind, int num) @@ -121,15 +121,15 @@ static int wcomp(const void *p, const void *q) return 1; /* simple compare */ - if ((*index1).dic[j][i]<(*index2).dic[j][i]) return -1; - else if ((*index1).dic[j][i]>(*index2).dic[j][i]) return 1; + if ((unsigned char)(*index1).dic[j][i]<(unsigned char)(*index2).dic[j][i]) return -1; + else if ((unsigned char)(*index1).dic[j][i]>(unsigned char)(*index2).dic[j][i]) return 1; /* 2byte character */ - if (((*index1).dic[j][i]>=0x80)&&((*index2).dic[j][i]>=0x80)) { + if (((unsigned char)(*index1).dic[j][i]>=0x80)&&((unsigned char)(*index2).dic[j][i]>=0x80)) { prechar=1; i++; - if ((*index1).dic[j][i]<(*index2).dic[j][i]) return -1; - else if ((*index1).dic[j][i]>(*index2).dic[j][i]) return 1; + if ((unsigned char)(*index1).dic[j][i]<(unsigned char)(*index2).dic[j][i]) return -1; + else if ((unsigned char)(*index1).dic[j][i]>(unsigned char)(*index2).dic[j][i]) return 1; } else prechar=0; } @@ -139,8 +139,8 @@ static int wcomp(const void *p, const void *q) if (((*index1).idx[j][i]=='\0')&&((*index2).idx[j][i]=='\0')) break; else if ((*index1).idx[j][i]=='\0') return -1; else if ((*index2).idx[j][i]=='\0') return 1; - else if ((*index1).idx[j][i]<(*index2).idx[j][i]) return -1; - else if ((*index1).idx[j][i]>(*index2).idx[j][i]) return 1; + else if ((unsigned char)(*index1).idx[j][i]<(unsigned char)(*index2).idx[j][i]) return -1; + else if ((unsigned char)(*index1).idx[j][i]>(unsigned char)(*index2).idx[j][i]) return 1; } } return 0; @@ -155,7 +155,7 @@ void pagesort(struct index *ind, int num) for (i=0;i<num;i++) { if (ind[i].num==0) continue; - buff=(struct page *)malloc(sizeof(struct page)*(ind[i].num+1)); + buff=malloc(sizeof(struct page)*(ind[i].num+1)); for (j=0;j<=ind[i].num;j++) { buff[j]=ind[i].p[j]; } @@ -210,9 +210,9 @@ static int pcomp(const void *p, const void *q) return 0; } -static int ordering(unsigned char *buff) +static int ordering(char *buff) { - if ((*buff)<0x80) { + if ((unsigned char)(*buff)<0x80) { if (alphabet(*buff)) return alpha; else if (numeric(*buff)) return number; else return sym; @@ -223,26 +223,26 @@ static int ordering(unsigned char *buff) } } -int alphanumeric(unsigned char c) +int alphanumeric(char c) { if (((c>='A')&&(c<='Z'))||((c>='a')&&(c<='z'))||((c>='0')&&(c<='9'))) return 1; else return 0; } -int alphabet(unsigned char c) +int alphabet(char c) { if (((c>='A')&&(c<='Z'))||((c>='a')&&(c<='z'))) return 1; else return 0; } -int numeric(unsigned char c) +int numeric(char c) { if ((c>='0')&&(c<='9')) return 1; else return 0; } -int japanese(unsigned char *buff) +int japanese(char *buff) { if (strncmp(buff,HIRATOP,2)>=0) return 1; else return 0; diff --git a/Build/source/texk/mendexk/var.h b/Build/source/texk/mendexk/var.h index 5b7fe8a7ddb..9565dd791d0 100644 --- a/Build/source/texk/mendexk/var.h +++ b/Build/source/texk/mendexk/var.h @@ -32,6 +32,6 @@ char symhead_positive[2048]={"Symbols"},symhead_negative[2048]={"symbols"}; char numhead_positive[2048]={"Numbers"},numhead_negative[2048]={"numbers"}; int symbol_flag=1; int letter_head=1; -unsigned char atama[2048]; -unsigned char page_compositor[2048]={"-"},page_precedence[2048]={"rnaRA"}; +char atama[2048]; +char page_compositor[2048]={"-"},page_precedence[2048]={"rnaRA"}; char character_order[2048]={"SNEJ"}; |