texlive[50040] Build/source/texk/upmendex: upmendex version 0.52

commits+takuji at tug.org commits+takuji at tug.org
Sun Feb 17 02:48:55 CET 2019


Revision: 50040
          http://tug.org/svn/texlive?view=revision&revision=50040
Author:   takuji
Date:     2019-02-17 02:48:55 +0100 (Sun, 17 Feb 2019)
Log Message:
-----------
upmendex version 0.52

Modified Paths:
--------------
    trunk/Build/source/texk/upmendex/COPYRIGHT
    trunk/Build/source/texk/upmendex/ChangeLog
    trunk/Build/source/texk/upmendex/configure
    trunk/Build/source/texk/upmendex/configure.ac
    trunk/Build/source/texk/upmendex/convert.c
    trunk/Build/source/texk/upmendex/fread.c
    trunk/Build/source/texk/upmendex/fwrite.c
    trunk/Build/source/texk/upmendex/hanzi.h
    trunk/Build/source/texk/upmendex/kp.c
    trunk/Build/source/texk/upmendex/main.c
    trunk/Build/source/texk/upmendex/mendex.h
    trunk/Build/source/texk/upmendex/sort.c
    trunk/Build/source/texk/upmendex/styfile.c

Modified: trunk/Build/source/texk/upmendex/COPYRIGHT
===================================================================
--- trunk/Build/source/texk/upmendex/COPYRIGHT	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/COPYRIGHT	2019-02-17 01:48:55 UTC (rev 50040)
@@ -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

Modified: trunk/Build/source/texk/upmendex/ChangeLog
===================================================================
--- trunk/Build/source/texk/upmendex/ChangeLog	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/ChangeLog	2019-02-17 01:48:55 UTC (rev 50040)
@@ -1,3 +1,13 @@
+2019-02-17  TANAKA Takuji  <ttk at 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 at t-lab.opal.ne.jp>
 
 	* main.c: Avoid access violation.

Modified: trunk/Build/source/texk/upmendex/configure
===================================================================
--- trunk/Build/source/texk/upmendex/configure	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/configure	2019-02-17 01:48:55 UTC (rev 50040)
@@ -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 @@
 # 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 @@
   # 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 @@
 
 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 @@
 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 @@
 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 @@
 
 # Define the identity of the package.
  PACKAGE='upmendex--tex-live-'
- VERSION='0.50'
+ VERSION='0.52'
 
 
 # Some tools Automake needs.
@@ -18201,7 +18201,7 @@
 Report bugs to <bug-libtool at 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 @@
 # 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 @@
 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\\"
 

Modified: trunk/Build/source/texk/upmendex/configure.ac
===================================================================
--- trunk/Build/source/texk/upmendex/configure.ac	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/configure.ac	2019-02-17 01:48:55 UTC (rev 50040)
@@ -7,7 +7,7 @@
 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])

Modified: trunk/Build/source/texk/upmendex/convert.c
===================================================================
--- trunk/Build/source/texk/upmendex/convert.c	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/convert.c	2019-02-17 01:48:55 UTC (rev 50040)
@@ -11,6 +11,8 @@
 
 #include "kp.h"
 
+#define BUFFERLEN 4096
+
 struct dictionary{
 UChar* dic[2];
 };
@@ -52,7 +54,7 @@
 {
 	int i,ecount=0;
 	const char *envfile;
-	char buff[4096];
+	char buff[BUFFERLEN];
 	FILE *fp;
 
 	if (filename!=NULL) {
@@ -68,7 +70,7 @@
 		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 @@
 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 @@
 		}
 		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 @@
 							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;

Modified: trunk/Build/source/texk/upmendex/fread.c
===================================================================
--- trunk/Build/source/texk/upmendex/fread.c	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/fread.c	2019-02-17 01:48:55 UTC (rev 50040)
@@ -51,7 +51,7 @@
 
 	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 @@
 						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 @@
 
 				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);	
 

Modified: trunk/Build/source/texk/upmendex/fwrite.c
===================================================================
--- trunk/Build/source/texk/upmendex/fwrite.c	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/fwrite.c	2019-02-17 01:48:55 UTC (rev 50040)
@@ -254,15 +254,18 @@
 
 			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 @@
 			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 @@
 			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 @@
 				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 @@
 				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 @@
 		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 @@
 		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 @@
 		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 @@
 						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 @@
 					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 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 @@
 			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 @@
 		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;

Modified: trunk/Build/source/texk/upmendex/hanzi.h
===================================================================
--- trunk/Build/source/texk/upmendex/hanzi.h	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/hanzi.h	2019-02-17 01:48:55 UTC (rev 50040)
@@ -221,7 +221,7 @@
   {{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 @@
   //  {{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 @@
   {{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 @@
   {{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'}},
 };

Modified: trunk/Build/source/texk/upmendex/kp.c
===================================================================
--- trunk/Build/source/texk/upmendex/kp.c	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/kp.c	2019-02-17 01:48:55 UTC (rev 50040)
@@ -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;

Modified: trunk/Build/source/texk/upmendex/main.c
===================================================================
--- trunk/Build/source/texk/upmendex/main.c	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/main.c	2019-02-17 01:48:55 UTC (rev 50040)
@@ -19,7 +19,7 @@
 #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 @@
 				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 @@
 			}
 		}
 		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]);
 		}
 	}

Modified: trunk/Build/source/texk/upmendex/mendex.h
===================================================================
--- trunk/Build/source/texk/upmendex/mendex.h	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/mendex.h	2019-02-17 01:48:55 UTC (rev 50040)
@@ -75,7 +75,7 @@
 
 /* styfile.c */
 void styread(const char *filename);
-void set_icu_attributes();
+void set_icu_attributes(void);
 
 /* fread.c */
 int idxread(char *filename, int start);

Modified: trunk/Build/source/texk/upmendex/sort.c
===================================================================
--- trunk/Build/source/texk/upmendex/sort.c	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/sort.c	2019-02-17 01:48:55 UTC (rev 50040)
@@ -311,7 +311,7 @@
 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') {
@@ -318,7 +318,7 @@
 			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);
@@ -325,7 +325,7 @@
 			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);

Modified: trunk/Build/source/texk/upmendex/styfile.c
===================================================================
--- trunk/Build/source/texk/upmendex/styfile.c	2019-02-17 01:46:54 UTC (rev 50039)
+++ trunk/Build/source/texk/upmendex/styfile.c	2019-02-17 01:48:55 UTC (rev 50040)
@@ -293,7 +293,7 @@
 	return strncmp(s1, s2, len);
 }
 
-void set_icu_attributes()
+void set_icu_attributes(void)
 {
 	int i,attr;
 	char *pos, *tmp;
@@ -300,13 +300,13 @@
 
 	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,13 +315,13 @@
 		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;
@@ -328,13 +328,13 @@
 		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;



More information about the tex-live-commits mailing list