texlive[50056] Build/source/texk/makejvf: makejvf: fix some covscan

commits+hironobu at tug.org commits+hironobu at tug.org
Tue Feb 19 11:55:59 CET 2019


Revision: 50056
          http://tug.org/svn/texlive?view=revision&revision=50056
Author:   hironobu
Date:     2019-02-19 11:55:59 +0100 (Tue, 19 Feb 2019)
Log Message:
-----------
makejvf: fix some covscan issues

Modified Paths:
--------------
    trunk/Build/source/texk/makejvf/ChangeLog
    trunk/Build/source/texk/makejvf/tfmread.c
    trunk/Build/source/texk/makejvf/tool.c
    trunk/Build/source/texk/makejvf/write.c

Modified: trunk/Build/source/texk/makejvf/ChangeLog
===================================================================
--- trunk/Build/source/texk/makejvf/ChangeLog	2019-02-19 01:23:36 UTC (rev 50055)
+++ trunk/Build/source/texk/makejvf/ChangeLog	2019-02-19 10:55:59 UTC (rev 50056)
@@ -1,3 +1,10 @@
+2019-02-19  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* tfmread.c, tool.c: Avoid compiler warnings.
+	* write.c (writevfu): Removed unnecessary conditionals.
+	Thanks to @ngothan for a report by covscan.
+	https://github.com/TeX-Live/texlive-source/issues/11
+
 2019-02-10  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
 
 	* uniblock.c: Update references Unicode blocks Blocks-12.0.0.txt

Modified: trunk/Build/source/texk/makejvf/tfmread.c
===================================================================
--- trunk/Build/source/texk/makejvf/tfmread.c	2019-02-19 01:23:36 UTC (rev 50055)
+++ trunk/Build/source/texk/makejvf/tfmread.c	2019-02-19 10:55:59 UTC (rev 50056)
@@ -138,15 +138,15 @@
 
 		header = xmalloc(lh*4);
 		for (i = 0 ; i < lh*4 ; i++) {
-			header[i] = fgetc(fp);
+			header[i] = (char)fgetc(fp);
 		}
 		char_type = xmalloc(nt*4);
 		for (i = 0 ; i < nt*4 ; i++) {
-			char_type[i] = fgetc(fp);
+			char_type[i] = (char)fgetc(fp);
 		}
 		char_info = xmalloc((ec+1)*4);
 		for (i = 0 ; i < (ec+1)*4 ; i++) {
-			char_info[i] = fgetc(fp);
+			char_info[i] = (char)fgetc(fp);
 		}
 		width = xmalloc(nw*sizeof(int));
 		for (i = 0 ; i < nw ; i++) {
@@ -166,7 +166,7 @@
 		}
 		glue_kern = xmalloc(nl*4);
 		for (i = 0 ; i < nl*4 ; i++) {
-			glue_kern[i] = fgetc(fp);
+			glue_kern[i] = (char)fgetc(fp);
 		}
 		kern = xmalloc(nk*sizeof(int));
 		for (i = 0 ; i < nk ; i++) {

Modified: trunk/Build/source/texk/makejvf/tool.c
===================================================================
--- trunk/Build/source/texk/makejvf/tool.c	2019-02-19 01:23:36 UTC (rev 50055)
+++ trunk/Build/source/texk/makejvf/tool.c	2019-02-19 10:55:59 UTC (rev 50056)
@@ -106,7 +106,7 @@
 	unsigned char fchar[4];
 
 	for (i = 0 ; i < 4 ; i++)
-		fchar[i] = fgetc(fp);
+		fchar[i] = (char)fgetc(fp);
 
 	cc = mquad(fchar);
 	return cc;
@@ -120,7 +120,7 @@
 
 	fchar[0] = 0;
 	for (i = 1 ; i < 4 ; i++)
-		fchar[i] = fgetc(fp);
+		fchar[i] = (char)fgetc(fp);
 
 	cc = mquad(fchar);
 
@@ -134,9 +134,9 @@
 	int i,cc;
 	unsigned char fchar[4];
 
-	fchar[0]=0;
-	for (i=1;i<4;i++)
-		fchar[i]=fgetc(fp);
+	fchar[0] = 0;
+	for (i = 1 ; i < 4 ; i++)
+		fchar[i] = (char)fgetc(fp);
 
 	cc = mquad(fchar);
 
@@ -153,7 +153,7 @@
 
 	fchar[0] = fchar[1] = 0;
 	for (i = 2 ; i < 4 ; i++)
-		fchar[i] = fgetc(fp);
+		fchar[i] = (char)fgetc(fp);
 
 	cc = mquad(fchar);
 
@@ -167,7 +167,7 @@
 
 	fchar[0] = fchar[1] = 0;
 	for (i = 2 ; i < 4 ; i++)
-		fchar[i] = fgetc(fp);
+		fchar[i] = (char)fgetc(fp);
 
 	cc = mquad(fchar);
 

Modified: trunk/Build/source/texk/makejvf/write.c
===================================================================
--- trunk/Build/source/texk/makejvf/write.c	2019-02-19 01:23:36 UTC (rev 50055)
+++ trunk/Build/source/texk/makejvf/write.c	2019-02-19 10:55:59 UTC (rev 50056)
@@ -401,13 +401,8 @@
 				}
 			}
 			else
-				skip = -(zw-w); /* skip=(int)((0.1)*zw); */
-			if (code == 0x2018) {
-				skip2+=0; /* skip2+=-(int)((0.65)*zh); */
-			}
-			else {
-				skip2+=0; /* skip2+=-(int)((0.6)*zh); */
-			}
+				skip = -(zw-w); /* changed */
+			/* no correction needed for skip2 */
 
 			if (kanatfm)
 				cc=4;
@@ -530,13 +525,8 @@
 				}
 			}
 			else
-				skip = zw; /* skip=(int)((0.4)*zw); */
-			if (code == 0x2019) {
-				skip2+=0; /* skip2+=(int)((0.65)*zh); */
-			}
-			else {
-				skip2+=0; /* skip2+=(int)((0.6)*zh); */
-			}
+				skip = zw; /* changed */
+			/* no correction needed for skip2 */
 
 			if (kanatfm)
 				cc=4;



More information about the tex-live-commits mailing list