diff options
author | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2019-02-17 01:48:55 +0000 |
---|---|---|
committer | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2019-02-17 01:48:55 +0000 |
commit | d0b0df2efdc844eb4f396115267cabbc23b7f99a (patch) | |
tree | 1caf4d8b85c79710064296f39348cfe94a92f23f /Build | |
parent | 38a55d73bd3eadf7d3ec5f286426446e1b8bdd3e (diff) |
upmendex version 0.52
git-svn-id: svn://tug.org/texlive/trunk@50040 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/upmendex/COPYRIGHT | 2 | ||||
-rw-r--r-- | Build/source/texk/upmendex/ChangeLog | 10 | ||||
-rwxr-xr-x | Build/source/texk/upmendex/configure | 22 | ||||
-rw-r--r-- | Build/source/texk/upmendex/configure.ac | 2 | ||||
-rw-r--r-- | Build/source/texk/upmendex/convert.c | 18 | ||||
-rw-r--r-- | Build/source/texk/upmendex/fread.c | 6 | ||||
-rw-r--r-- | Build/source/texk/upmendex/fwrite.c | 106 | ||||
-rw-r--r-- | Build/source/texk/upmendex/hanzi.h | 10 | ||||
-rw-r--r-- | Build/source/texk/upmendex/kp.c | 4 | ||||
-rw-r--r-- | Build/source/texk/upmendex/main.c | 10 | ||||
-rw-r--r-- | Build/source/texk/upmendex/mendex.h | 2 | ||||
-rw-r--r-- | Build/source/texk/upmendex/sort.c | 6 | ||||
-rw-r--r-- | Build/source/texk/upmendex/styfile.c | 14 |
13 files changed, 129 insertions, 83 deletions
diff --git a/Build/source/texk/upmendex/COPYRIGHT b/Build/source/texk/upmendex/COPYRIGHT index 71d21b0a15d..1cc83b01680 100644 --- a/Build/source/texk/upmendex/COPYRIGHT +++ b/Build/source/texk/upmendex/COPYRIGHT @@ -1,5 +1,5 @@ Copyright (C) 1995 ASCII Corporation, 2009 ASCII MEDIA WORKS, - 2015-2017 TANAKA Takuji + 2015-2019 TANAKA Takuji All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Build/source/texk/upmendex/ChangeLog b/Build/source/texk/upmendex/ChangeLog index 2923c0dc870..51f4af3cc34 100644 --- a/Build/source/texk/upmendex/ChangeLog +++ b/Build/source/texk/upmendex/ChangeLog @@ -1,3 +1,13 @@ +2019-02-17 TANAKA Takuji <ttk@t-lab.opal.ne.jp> + + * version 0.52 Beta version. + * main.c, COPYRIGHT: Update copyright year. + * fread.c: Fix typo. It seems a bug. + * {convert,fread,fwrite,kp,sort,styfile}.c, {hanzi,mendex}.h: + Avoid compiler warnings. + Thanks to @ngothan for a report by covscan. + https://github.com/TeX-Live/texlive-source/issues/11 + 2017-04-05 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * main.c: Avoid access violation. diff --git a/Build/source/texk/upmendex/configure b/Build/source/texk/upmendex/configure index 3d9785fbaaf..f3c0ab64825 100755 --- a/Build/source/texk/upmendex/configure +++ b/Build/source/texk/upmendex/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for upmendex (TeX Live) 0.50. +# Generated by GNU Autoconf 2.69 for upmendex (TeX Live) 0.52. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='upmendex (TeX Live)' PACKAGE_TARNAME='upmendex--tex-live-' -PACKAGE_VERSION='0.50' -PACKAGE_STRING='upmendex (TeX Live) 0.50' +PACKAGE_VERSION='0.52' +PACKAGE_STRING='upmendex (TeX Live) 0.52' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1344,7 +1344,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures upmendex (TeX Live) 0.50 to adapt to many kinds of systems. +\`configure' configures upmendex (TeX Live) 0.52 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1415,7 +1415,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of upmendex (TeX Live) 0.50:";; + short | recursive ) echo "Configuration of upmendex (TeX Live) 0.52:";; esac cat <<\_ACEOF @@ -1540,7 +1540,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -upmendex (TeX Live) configure 0.50 +upmendex (TeX Live) configure 0.52 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2473,7 +2473,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by upmendex (TeX Live) $as_me 0.50, which was +It was created by upmendex (TeX Live) $as_me 0.52, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -8672,7 +8672,7 @@ fi # Define the identity of the package. PACKAGE='upmendex--tex-live-' - VERSION='0.50' + VERSION='0.52' # Some tools Automake needs. @@ -18201,7 +18201,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -upmendex (TeX Live) config.lt 0.50 +upmendex (TeX Live) config.lt 0.52 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -20274,7 +20274,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by upmendex (TeX Live) $as_me 0.50, which was +This file was extended by upmendex (TeX Live) $as_me 0.52, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20340,7 +20340,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -upmendex (TeX Live) config.status 0.50 +upmendex (TeX Live) config.status 0.52 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/upmendex/configure.ac b/Build/source/texk/upmendex/configure.ac index 53d37dff059..9a6cbfa555e 100644 --- a/Build/source/texk/upmendex/configure.ac +++ b/Build/source/texk/upmendex/configure.ac @@ -7,7 +7,7 @@ dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl -AC_INIT([upmendex (TeX Live)], [0.50]) +AC_INIT([upmendex (TeX Live)], [0.52]) AC_PREREQ([2.63]) AC_CONFIG_SRCDIR([main.c]) AC_CONFIG_AUX_DIR([../../build-aux]) diff --git a/Build/source/texk/upmendex/convert.c b/Build/source/texk/upmendex/convert.c index 19e1e179772..72e7cb5b783 100644 --- a/Build/source/texk/upmendex/convert.c +++ b/Build/source/texk/upmendex/convert.c @@ -11,6 +11,8 @@ #include "kp.h" +#define BUFFERLEN 4096 + struct dictionary{ UChar* dic[2]; }; @@ -52,7 +54,7 @@ int dicread(const char *filename) { int i,ecount=0; const char *envfile; - char buff[4096]; + char buff[BUFFERLEN]; FILE *fp; if (filename!=NULL) { @@ -68,7 +70,7 @@ int dicread(const char *filename) verb_printf(efp,"Scanning dictionary file %s.",filename); for (i=0;;i++) { - if (fgets(buff,4095,fp)==NULL) break; + if (fgets(buff,BUFFERLEN-1,fp)==NULL) break; if ((buff[0]=='\r')||(buff[0]=='\n')||(buff[0]=='\0')) i--; } fclose(fp); @@ -185,7 +187,7 @@ static int dcomp(const void *bf1, const void *bf2) int convert(UChar *buff1, UChar *buff2) { int i=0,j=0,k; - char errbuff[4096],errbuff2[4096]; + char errbuff[BUFFERLEN],errbuff2[BUFFERLEN]; int wclen; UChar buff3[3]; @@ -196,9 +198,9 @@ int convert(UChar *buff1, UChar *buff2) } else { wclen = is_surrogate_pair(&buff1[i]) ? 2 : 1; - buff3[0] =buff1[i]; - if (wclen==2) buff3[1] =buff1[i+1]; - buff3[wclen]=L'\0'; + buff3[0] =buff1[i]; + if (wclen==2){ buff3[1] =buff1[i+1]; } + buff3[wclen]=L'\0'; if ( lorder==1 &&( buff1[i]==' ' || buff1[i]=='\t' || buff3[0]==0x00A0 || buff3[0]==0x202F || buff3[0]==0x2060 || buff3[0]==0xFEFF )) { @@ -267,8 +269,8 @@ int convert(UChar *buff1, UChar *buff2) j+=wclen; } else { - widechar_to_multibyte(errbuff2,4096,&buff1[i]); - sprintf(errbuff,"\nError: %s is no entry in dictionary file ",errbuff2); + widechar_to_multibyte(errbuff2,BUFFERLEN,&buff1[i]); + snprintf(errbuff,BUFFERLEN,"\nError: %s is no entry in dictionary file ",errbuff2); fputs(errbuff,efp); if (efp!=stderr) fputs(errbuff,stderr); return -1; diff --git a/Build/source/texk/upmendex/fread.c b/Build/source/texk/upmendex/fread.c index 75c1e01470b..358c21a4987 100644 --- a/Build/source/texk/upmendex/fread.c +++ b/Build/source/texk/upmendex/fread.c @@ -51,7 +51,7 @@ int idxread(char *filename, int start) for (i=start,n=1;;i++,n++) { if (!(i%100)) - ind=(struct index *)realloc(ind,sizeof(struct index)*(i+100)); + ind=(struct index *)xrealloc(ind,sizeof(struct index)*(i+100)); LOOP: ind[i].lnum=n; if (fgets(buff,sizeof(buff)-1,fp)==NULL) break; @@ -293,7 +293,7 @@ LOOP: else tmp1=ind[i].idx[m]; if (ind[l].org[m]!=NULL) tmp2=ind[l].org[m]; - else tmp2=ind[i].idx[m]; + else tmp2=ind[l].idx[m]; widechar_to_multibyte(wbuff,BUFSIZE,tmp1); verb_printf(efp,"\nWarning: Sort key \"%s\"",wbuff); @@ -354,7 +354,7 @@ LOOP: if (k>ind[l].num) { ind[l].num++; - if (!((ind[l].num)%16)) ind[l].p=(struct page *)realloc(ind[l].p,sizeof(struct page)*((int)((ind[l].num)/16)+1)*16); + if (!((ind[l].num)%16)) ind[l].p=(struct page *)xrealloc(ind[l].p,sizeof(struct page)*((int)((ind[l].num)/16)+1)*16); ind[l].p[ind[l].num].page=xstrdup(table); diff --git a/Build/source/texk/upmendex/fwrite.c b/Build/source/texk/upmendex/fwrite.c index a54b5dd0d1e..6736f56e5a2 100644 --- a/Build/source/texk/upmendex/fwrite.c +++ b/Build/source/texk/upmendex/fwrite.c @@ -254,15 +254,18 @@ void indwrite(char *filename, struct index *ind, int pagenum) case 2: widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[1]); - SAPPENDF(lbuff,"%s%s",item_x1,obuff); + SAPPENDF(lbuff,"%s",item_x1); + SAPPENDF(lbuff,"%s",obuff); SAPPENDF(lbuff,"%s",delim_1); break; case 3: widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[1]); - SAPPENDF(lbuff,"%s%s",item_x1,obuff); + SAPPENDF(lbuff,"%s",item_x1); + SAPPENDF(lbuff,"%s",obuff); widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[2]); - SAPPENDF(lbuff,"%s%s",item_x2,obuff); + SAPPENDF(lbuff,"%s",item_x2); + SAPPENDF(lbuff,"%s",obuff); SAPPENDF(lbuff,"%s",delim_2); break; @@ -335,13 +338,17 @@ void indwrite(char *filename, struct index *ind, int pagenum) switch (ind[i].words) { case 1: widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SAPPENDF(lbuff,"%s%s%s",item_0,obuff,delim_0); + SAPPENDF(lbuff,"%s",item_0); + SAPPENDF(lbuff,"%s",obuff); + SAPPENDF(lbuff,"%s",delim_0); break; case 2: if (u_strcmp(ind[i-1].idx[0],ind[i].idx[0])!=0 || u_strcmp(ind[i-1].dic[0],ind[i].dic[0])!=0) { widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SAPPENDF(lbuff,"%s%s%s",item_0,obuff,item_x1); + SAPPENDF(lbuff,"%s",item_0); + SAPPENDF(lbuff,"%s",obuff); + SAPPENDF(lbuff,"%s",item_x1); } else { if (ind[i-1].words==1) { @@ -359,24 +366,32 @@ void indwrite(char *filename, struct index *ind, int pagenum) case 3: if (u_strcmp(ind[i-1].idx[0],ind[i].idx[0])!=0 || u_strcmp(ind[i-1].dic[0],ind[i].dic[0])!=0) { widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SAPPENDF(lbuff,"%s%s",item_0,obuff); + SAPPENDF(lbuff,"%s",item_0); + SAPPENDF(lbuff,"%s",obuff); widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[1]); - SAPPENDF(lbuff,"%s%s%s",item_x1,obuff,item_x2); + SAPPENDF(lbuff,"%s",item_x1); + SAPPENDF(lbuff,"%s",obuff); + SAPPENDF(lbuff,"%s",item_x2); } else if (ind[i-1].words==1) { widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[1]); - SAPPENDF(lbuff,"%s%s%s",item_01,obuff,item_x2); + SAPPENDF(lbuff,"%s",item_01); + SAPPENDF(lbuff,"%s",obuff); + SAPPENDF(lbuff,"%s",item_x2); } else if (u_strcmp(ind[i-1].idx[1],ind[i].idx[1])!=0 || u_strcmp(ind[i-1].dic[1],ind[i].dic[1])!=0) { widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[1]); - if (ind[i-1].words==2) SAPPENDF(lbuff,"%s%s%s",item_1,obuff,item_12); - else SAPPENDF(lbuff,"%s%s%s",item_1,obuff,item_x2); + SAPPENDF(lbuff,"%s",item_1); + SAPPENDF(lbuff,"%s",obuff); + if (ind[i-1].words==2) SAPPENDF(lbuff,"%s",item_12); + else SAPPENDF(lbuff,"%s",item_x2); } else { SAPPENDF(lbuff,"%s",item_2); } widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[2]); - SAPPENDF(lbuff,"%s%s",obuff,delim_2); + SAPPENDF(lbuff,"%s",obuff); + SAPPENDF(lbuff,"%s",delim_2); break; default: @@ -416,16 +431,20 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff) SPRINTF(buff,"%s%s%s",encap_prefix,ind[num].p[j].enc,encap_infix); } if (strlen(suffix_3p)>0 && (pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])-pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0]))==2) { - SAPPENDF(buff,"%s%s",ind[num].p[j].page,suffix_3p); + SAPPENDF(buff,"%s",ind[num].p[j].page); + SAPPENDF(buff,"%s",suffix_3p); } else if (strlen(suffix_mp)>0 && (pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])-pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0]))>=2) { - SAPPENDF(buff,"%s%s",ind[num].p[j].page,suffix_mp); + SAPPENDF(buff,"%s",ind[num].p[j].page); + SAPPENDF(buff,"%s",suffix_mp); } else if (strlen(suffix_2p)>0 && (pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])-pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0]))==1) { - SAPPENDF(buff,"%s%s",ind[num].p[j].page,suffix_2p); + SAPPENDF(buff,"%s",ind[num].p[j].page); + SAPPENDF(buff,"%s",suffix_2p); } else { - SAPPENDF(buff,"%s%s",ind[num].p[j].page,delim_r); + SAPPENDF(buff,"%s",ind[num].p[j].page); + SAPPENDF(buff,"%s",delim_r); SAPPENDF(buff,"%s",ind[num].p[cc].page); } SAPPENDF(tmpbuff,"%s",buff); @@ -449,24 +468,31 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff) SPRINTF(errbuff,"Warning: Unmatched range closing operator \'%c\',",range_close); for (i=0;i<ind[num].words;i++) { widechar_to_multibyte(obuff,BUFFERLEN,ind[num].idx[i]); - SAPPENDF(errbuff,"%s.",obuff); + SAPPENDF(errbuff,"%s",obuff); + SAPPENDF(errbuff,"."); } warn_printf(efp, "%s\n", errbuff); ind[num].p[j].enc++; } if (strlen(ind[num].p[j].enc)>0) { - SAPPENDF(tmpbuff,"%s%s%s",encap_prefix,ind[num].p[j].enc,encap_infix); - SAPPENDF(tmpbuff,"%s%s%s",ind[num].p[j].page,encap_suffix,delim_n); + SAPPENDF(tmpbuff,"%s",encap_prefix); + SAPPENDF(tmpbuff,"%s",ind[num].p[j].enc); + SAPPENDF(tmpbuff,"%s",encap_infix); + SAPPENDF(tmpbuff,"%s",ind[num].p[j].page); + SAPPENDF(tmpbuff,"%s",encap_suffix); + SAPPENDF(tmpbuff,"%s",delim_n); linecheck(lbuff,tmpbuff); } else { - SAPPENDF(tmpbuff,"%s%s",ind[num].p[j].page,delim_n); + SAPPENDF(tmpbuff,"%s",ind[num].p[j].page); + SAPPENDF(tmpbuff,"%s",delim_n); linecheck(lbuff,tmpbuff); } } else { /* no encap */ - SAPPENDF(tmpbuff,"%s%s",ind[num].p[j].page,delim_n); + SAPPENDF(tmpbuff,"%s",ind[num].p[j].page); + SAPPENDF(tmpbuff,"%s",delim_n); linecheck(lbuff,tmpbuff); } } @@ -475,7 +501,8 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff) SPRINTF(errbuff,"Warning: Unmatched range opening operator \'%c\',",range_open); for (k=0;k<ind[num].words;k++) { widechar_to_multibyte(obuff,BUFFERLEN,ind[num].idx[k]); - SAPPENDF(errbuff,"%s.",obuff); + SAPPENDF(errbuff,"%s",obuff); + SAPPENDF(errbuff,"."); } warn_printf(efp, "%s\n", errbuff); ind[num].p[j].enc++; @@ -484,14 +511,18 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff) SPRINTF(errbuff,"Warning: Unmatched range closing operator \'%c\',",range_close); for (k=0;k<ind[num].words;k++) { widechar_to_multibyte(obuff,BUFFERLEN,ind[num].idx[k]); - SAPPENDF(errbuff,"%s.",obuff); + SAPPENDF(errbuff,"%s",obuff); + SAPPENDF(errbuff,"."); } warn_printf(efp, "%s\n", errbuff); ind[num].p[j].enc++; } if (strlen(ind[num].p[j].enc)>0) { - SAPPENDF(tmpbuff,"%s%s%s",encap_prefix,ind[num].p[j].enc,encap_infix); - SAPPENDF(tmpbuff,"%s%s",ind[num].p[j].page,encap_suffix); + SAPPENDF(tmpbuff,"%s",encap_prefix); + SAPPENDF(tmpbuff,"%s",ind[num].p[j].enc); + SAPPENDF(tmpbuff,"%s",encap_infix); + SAPPENDF(tmpbuff,"%s",ind[num].p[j].page); + SAPPENDF(tmpbuff,"%s",encap_suffix); } else { SAPPENDF(tmpbuff,"%s",ind[num].p[j].page); @@ -513,7 +544,8 @@ static int range_check(struct index ind, int count, char *lbuff) if (ind.p[i].enc[0]==range_close) { SPRINTF(errbuff,"Warning: Unmatched range closing operator \'%c\',",range_close); widechar_to_multibyte(obuff,BUFFERLEN,ind.idx[0]); - SAPPENDF(errbuff,"%s.",obuff); + SAPPENDF(errbuff,"%s",obuff); + SAPPENDF(errbuff,"."); warn_printf(efp, "%s\n", errbuff); ind.p[i].enc++; } @@ -532,14 +564,15 @@ static int range_check(struct index ind, int count, char *lbuff) SPRINTF(errbuff,"Warning: Unmatched range opening operator \'%c\',",range_open); for (k=0;k<ind.words;k++) { widechar_to_multibyte(obuff,BUFFERLEN,ind.idx[k]); - SAPPENDF(errbuff,"%s.",obuff); + SAPPENDF(errbuff,"%s",obuff); + SAPPENDF(errbuff,"."); } warn_printf(efp, "%s\n", errbuff); ind.p[j].enc++; } if (strlen(ind.p[j].enc)>0) { - SPRINTF(tmpbuff,"%s%s%s",encap_prefix,ind.p[j].enc,encap_infix); - SAPPENDF(tmpbuff,"%s%s%s",ind.p[j].page,encap_suffix,delim_n); + SPRINTF(tmpbuff,"%s%s%s%s%s%s",encap_prefix,ind.p[j].enc,encap_infix + ,ind.p[j].page,encap_suffix,delim_n); linecheck(lbuff,tmpbuff); } } @@ -548,7 +581,8 @@ static int range_check(struct index ind, int count, char *lbuff) SPRINTF(errbuff,"Warning: Unmatched range opening operator \'%c\',",range_open); for (k=0;k<ind.words;k++) { widechar_to_multibyte(obuff,BUFFERLEN,ind.idx[k]); - SAPPENDF(errbuff,"%s.",obuff); + SAPPENDF(errbuff,"%s",obuff); + SAPPENDF(errbuff,"."); } warn_printf(efp, "%s\n", errbuff); } @@ -581,7 +615,9 @@ static int range_check(struct index ind, int count, char *lbuff) static void linecheck(char *lbuff, char *tmpbuff) { if (line_length+strlen(tmpbuff)>line_max) { - SAPPENDF(lbuff,"\n%s%s",indent_space,tmpbuff); + SAPPENDF(lbuff,"\n"); + SAPPENDF(lbuff,"%s",indent_space); + SAPPENDF(lbuff,"%s",tmpbuff); line_length=indent_length+strlen(tmpbuff); tmpbuff[0]='\0'; } @@ -602,7 +638,7 @@ static void crcheck(char *lbuff, FILE *fp) strncpy(buff,lbuff,i+1); buff[i+1]='\0'; fputs(buff,fp); - strcpy(buff,&lbuff[i+1]); + strncpy(buff,&lbuff[i+1],BUFFERLEN-1); strcpy(lbuff,buff); break; } @@ -698,15 +734,15 @@ static void index_normalize(UChar *istr, UChar *ini, int *chset) ini[0]=ch; return; } - else if (len=is_hanzi(istr)) { + else if ((len=is_hanzi(istr))>0) { if (hanzi_mode==0) hanzi_mode=init_hanzi_header(); if (hanzi_mode==HANZI_UNKNOWN) { u_strcpy(ini, hz_index[0].idx); return; } - strX[0] =istr[0]; - if (len==2) strX[1] =istr[1]; - strX[len]=L'\0'; + strX[0] =istr[0]; + if (len==2){ strX[1] =istr[1]; } + strX[len]=L'\0'; lo=0; hi=hz_index_len; while (lo<hi) { mi = (lo+hi)/2; diff --git a/Build/source/texk/upmendex/hanzi.h b/Build/source/texk/upmendex/hanzi.h index 3815fac0c08..e16cb793138 100644 --- a/Build/source/texk/upmendex/hanzi.h +++ b/Build/source/texk/upmendex/hanzi.h @@ -221,7 +221,7 @@ struct hanzi_index HZ_RADICAL[]={ {{0x2FD3, L'\0'}, {0xFDD0, 0x9F8D, L'\0'}}, /* 龍 */ {{0x2FD4, L'\0'}, {0xFDD0, 0x9F9C, L'\0'}}, /* 龜 */ {{0x2FD5, L'\0'}, {0xFDD0, 0x9FA0, L'\0'}}, /* 龠 */ - {0, 0}, + {{L'\0'}, {L'\0'}}, }; /* @@ -272,7 +272,7 @@ struct hanzi_index HZ_STROKE[]={ // {{0x4E09, 0x5341, 0x516B, 0x756B, L'\0'}, {0xFDD0, 0x2826, L'\0'}}, /* 三十八畫 */ {{0x4E09, 0x5341, 0x4E5D, 0x756B, L'\0'}, {0xFDD0, 0x2827, L'\0'}}, /* 三十九畫 */ {{0x56DB, 0x5341, 0x516B, 0x756B, L'\0'}, {0xFDD0, 0x2830, L'\0'}}, /* 四十八畫 */ - {0, 0}, + {{L'\0'}, {L'\0'}}, }; /* @@ -306,7 +306,7 @@ struct hanzi_index HZ_PINYIN[]={ {{L'X', L'\0'}, {0xFDD0, L'X', L'\0'}}, /* X */ {{L'Y', L'\0'}, {0xFDD0, L'Y', L'\0'}}, /* Y */ {{L'Z', L'\0'}, {0xFDD0, L'Z', L'\0'}}, /* Z */ - {0, 0}, + {{L'\0'}, {L'\0'}}, }; /* @@ -354,10 +354,10 @@ struct hanzi_index HZ_ZHUYIN[]={ {{0x3127, L'\0'}, {0xFDD0, 0x3127, L'\0'}}, /* ㄧ */ {{0x3128, L'\0'}, {0xFDD0, 0x3128, L'\0'}}, /* ㄨ */ {{0x3129, L'\0'}, {0xFDD0, 0x3129, L'\0'}}, /* ㄩ */ - {0, 0}, + {{L'\0'}, {L'\0'}}, }; struct hanzi_index HZ_UNKNOWN[]={ {{0x6F22, 0x5B57, L'\0'}, {L'\0'}}, /* 漢字 */ - {0, 0}, + {{L'\0'}, {L'\0'}}, }; diff --git a/Build/source/texk/upmendex/kp.c b/Build/source/texk/upmendex/kp.c index c43453f7857..7633f8ebfc4 100644 --- a/Build/source/texk/upmendex/kp.c +++ b/Build/source/texk/upmendex/kp.c @@ -13,10 +13,10 @@ */ static const char *KP_get_path(const char *var, const char *def_val) { - char avar[50]; + char avar[264]; const char *p; strcpy(avar, "${"); - strcat(avar, var); + strncat(avar, var, 260); strcat(avar, "}"); p = kpse_path_expand(avar); return (p && *p) ? p : def_val; diff --git a/Build/source/texk/upmendex/main.c b/Build/source/texk/upmendex/main.c index 00983d863ff..e65ac3108da 100644 --- a/Build/source/texk/upmendex/main.c +++ b/Build/source/texk/upmendex/main.c @@ -19,7 +19,7 @@ char *styfile,*idxfile[256],*indfile,*dicfile,*logfile; #endif KpathseaSupportInfo kp_ist,kp_dict; -#define VERSION "version 0.51" +#define VERSION "version 0.52" int main(int argc, char **argv) { @@ -156,7 +156,7 @@ int main(int argc, char **argv) u_getVersion(icuVersion); u_versionToString(icuVersion, icu_version); fprintf(stderr,"upmendex - index processor, %s (%s).\n",VERSION, TL_VERSION); - fprintf(stderr," Copyright 2009 ASCII MEDIA WORKS, 2015-2017 TANAKA Takuji\n"); + fprintf(stderr," Copyright 2009 ASCII MEDIA WORKS, 2015-2019 TANAKA Takuji\n"); fprintf(stderr," using ICU version %s\n",icu_version); fprintf(stderr,"usage:\n"); fprintf(stderr,"%% upmendex [-ilqrcgf] [-s sty] [-d dic] [-o ind] [-t log] [-p no] [--] [idx0 idx1 ...]\n"); @@ -179,10 +179,8 @@ int main(int argc, char **argv) } } else { - cc=strlen(argv[i]); - if (cc<4) cc+=4; - else if (strcmp(&argv[i][cc-4],".idx")) cc+=4; - idxfile[j]=xmalloc(cc+1); + cc=strlen(argv[i])+6; + idxfile[j]=xmalloc(cc); strcpy(idxfile[j++],argv[i]); } } diff --git a/Build/source/texk/upmendex/mendex.h b/Build/source/texk/upmendex/mendex.h index b48b36319eb..b2cda82aedf 100644 --- a/Build/source/texk/upmendex/mendex.h +++ b/Build/source/texk/upmendex/mendex.h @@ -75,7 +75,7 @@ int charset(UChar *c); /* styfile.c */ void styread(const char *filename); -void set_icu_attributes(); +void set_icu_attributes(void); /* fread.c */ int idxread(char *filename, int start); diff --git a/Build/source/texk/upmendex/sort.c b/Build/source/texk/upmendex/sort.c index 54597923efb..5d11a0727c0 100644 --- a/Build/source/texk/upmendex/sort.c +++ b/Build/source/texk/upmendex/sort.c @@ -311,21 +311,21 @@ static int get_charset_juncture(UChar *str) static int unescape(const unsigned char *src, UChar *dist) { int i,j,k; - unsigned char tmp[STYBUFSIZE]; + char tmp[STYBUFSIZE]; for (i=j=0;i<STYBUFSIZE;i++) { if (src[i]=='\0') { return i; } else if (src[i]< 0x80 && (src[i+1]>=0x80 || src[i+1]=='\0')) { - strncpy(tmp,&src[j],i-j+1); + strncpy(tmp,(char *)&src[j],i-j+1); tmp[i-j+1]='\0'; k=u_strlen(dist); u_unescape(tmp, &dist[k], STYBUFSIZE-k); j=i+1; } else if (src[i]>=0x80 && (src[i+1]< 0x80 || src[i+1]=='\0')) { - strncpy(tmp,&src[j],i-j+1); + strncpy(tmp,(char *)&src[j],i-j+1); tmp[i-j+1]='\0'; k=u_strlen(dist); multibyte_to_widechar(&dist[k], STYBUFSIZE-k, tmp); diff --git a/Build/source/texk/upmendex/styfile.c b/Build/source/texk/upmendex/styfile.c index 25e100fb6df..1c94c900770 100644 --- a/Build/source/texk/upmendex/styfile.c +++ b/Build/source/texk/upmendex/styfile.c @@ -293,20 +293,20 @@ static int sstrncmp(const char *s1, const char *s2, size_t len) return strncmp(s1, s2, len); } -void set_icu_attributes() +void set_icu_attributes(void) { int i,attr; char *pos, *tmp; for (i=0;i<UCOL_ATTRIBUTE_COUNT;i++) icu_attributes[i]=UCOL_DEFAULT; tmp=icu_attr_str; - if (pos=strstr(tmp,"alternate:")) { + if ((pos=strstr(tmp,"alternate:"))>0) { pos+=10; attr=UCOL_ALTERNATE_HANDLING; if (strstr(pos,"shifted")) icu_attributes[attr]=UCOL_SHIFTED; else if (strstr(pos,"non-ignorable")) icu_attributes[attr]=UCOL_NON_IGNORABLE; else verb_printf(efp,"\nWarning: Illegal input for icu_attributes (alternate)."); } - if (pos=strstr(tmp,"strength:")) { + if ((pos=strstr(tmp,"strength:"))>0) { pos+=9; attr=UCOL_STRENGTH; if (strstr(pos,"primary")) icu_attributes[attr]=UCOL_PRIMARY; else if (strstr(pos,"secondary")) icu_attributes[attr]=UCOL_SECONDARY; @@ -315,26 +315,26 @@ void set_icu_attributes() else if (strstr(pos,"identical")) icu_attributes[attr]=UCOL_IDENTICAL; else verb_printf(efp,"\nWarning: Illegal input for icu_attributes (strength)."); } - if (pos=strstr(tmp,"french-collation:")) { + if ((pos=strstr(tmp,"french-collation:"))>0) { pos+=17; attr=UCOL_FRENCH_COLLATION; if (strstr(pos,"on")) icu_attributes[attr]=UCOL_ON; else if (strstr(pos,"off")) icu_attributes[attr]=UCOL_OFF; else verb_printf(efp,"\nWarning: Illegal input for icu_attributes (french-collation)."); } - if (pos=strstr(tmp,"case-first:")) { + if ((pos=strstr(tmp,"case-first:"))>0) { pos+=11; attr=UCOL_CASE_FIRST; if (strstr(pos,"off")) icu_attributes[attr]=UCOL_OFF; else if (strstr(pos,"upper-first")) icu_attributes[attr]=UCOL_UPPER_FIRST; else if (strstr(pos,"lower-first")) icu_attributes[attr]=UCOL_LOWER_FIRST; else verb_printf(efp,"\nWarning: Illegal input for icu_attributes (case-first)."); } - if (pos=strstr(tmp,"case-level:")) { + if ((pos=strstr(tmp,"case-level:"))>0) { pos+=11; attr=UCOL_CASE_LEVEL; if (strstr(pos,"on")) icu_attributes[attr]=UCOL_ON; else if (strstr(pos,"off")) icu_attributes[attr]=UCOL_OFF; else verb_printf(efp,"\nWarning: Illegal input for icu_attributes (case-level)."); } - if (pos=strstr(tmp,"normalization-mode:")) { + if ((pos=strstr(tmp,"normalization-mode:"))>0) { pos+=19; attr=UCOL_NORMALIZATION_MODE; if (strstr(pos,"on")) icu_attributes[attr]=UCOL_ON; else if (strstr(pos,"off")) icu_attributes[attr]=UCOL_OFF; |