texlive[51226] Build/source/texk/dvipdfm-x: Fix for compiler

commits+kakuto at tug.org commits+kakuto at tug.org
Sun May 26 06:55:48 CEST 2019


Revision: 51226
          http://tug.org/svn/texlive?view=revision&revision=51226
Author:   kakuto
Date:     2019-05-26 06:55:48 +0200 (Sun, 26 May 2019)
Log Message:
-----------
Fix for compiler warnings. (S. Hirata)

Modified Paths:
--------------
    trunk/Build/source/texk/dvipdfm-x/ChangeLog
    trunk/Build/source/texk/dvipdfm-x/cmap_write.c
    trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c
    trunk/Build/source/texk/dvipdfm-x/pdfdev.c
    trunk/Build/source/texk/dvipdfm-x/pdfdev.h
    trunk/Build/source/texk/dvipdfm-x/pdfdoc.c
    trunk/Build/source/texk/dvipdfm-x/spc_dvips.c
    trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c
    trunk/Build/source/texk/dvipdfm-x/system.h
    trunk/Build/source/texk/dvipdfm-x/truetype.c
    trunk/Build/source/texk/dvipdfm-x/tt_post.c
    trunk/Build/source/texk/dvipdfm-x/xbb.c

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2019-05-26 04:55:48 UTC (rev 51226)
@@ -1,3 +1,11 @@
+2019-05-26  Shunsaku Hirata  <shunsaku.hirata74 at gmail.com>
+
+	* cmap_write.c, dvipdfmx.c, pdfdev.c, pdfdev.h, pdfdoc.c
+	spc_dvips.c, spc_pdfm.c, truetype.c, xbb.c:
+	Fix for compiler warnings.
+	* tt_post.c: Add missing "*/" in a deactivated section.
+	* system.h: "pragma warning" only when _MSC_VER is defined.
+
 2019-05-22  Shunsaku Hirata  <shunsaku.hirata74 at gmail.com>
 
 	* tt_gsub.c: Fix a bug that otl_gsub_read_alternate() and

Modified: trunk/Build/source/texk/dvipdfm-x/cmap_write.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/cmap_write.c	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/cmap_write.c	2019-05-26 04:55:48 UTC (rev 51226)
@@ -1,6 +1,6 @@
 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
 
-    Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
+    Copyright (C) 2002-2019 by Jin-Hwan Cho and Shunsaku Hirata,
     the dvipdfmx project team.
 
     This program is free software; you can redistribute it and/or modify
@@ -240,13 +240,14 @@
 
 /* duplicated from pdfobj.c */
 static void
-write_string (char **outptr, char *endptr, const char *string)
+write_string (char **outptr, char *endptr, const char *strptr)
 {
-  char *s, *p;
-  int i, length;
+  const char *s;
+  char       *p;
+  int         i, length;
 
-  s      = (char *) string;
-  length = string ? strlen(string) : 0;
+  s      = strptr;
+  length = strptr ? strlen(strptr) : 0;
   p      = *outptr;
 
   *p++ = '(';
@@ -276,10 +277,11 @@
 static void
 write_name (char **outptr, char *endptr, const char *name)
 {
-  char *s, *p;
-  int i, length;
+  const char *s;
+  char       *p;
+  int         i, length;
 
-  s      = (char *) name;
+  s      = name;
   length = name ? strlen(name) : 0;
   p      = *outptr;
 #ifndef is_delim

Modified: trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c	2019-05-26 04:55:48 UTC (rev 51226)
@@ -130,22 +130,25 @@
 set_default_pdf_filename(void)
 {
   const char *dvi_base;
+  const char *suffix;
+  size_t      len = 0;
 
   dvi_base = xbasename(dvi_filename);
-  if (dpx_conf.compat_mode == dpx_mode_mpost_mode &&
-      strlen(dvi_base) > 4 &&
-      FILESTRCASEEQ(".mps", dvi_base + strlen(dvi_base) - 4)) {
-    pdf_filename = NEW(strlen(dvi_base)+1, char);
-    strncpy(pdf_filename, dvi_base, strlen(dvi_base) - 4);
-    pdf_filename[strlen(dvi_base)-4] = '\0';
-  } else if (strlen(dvi_base) > 4 &&
-             (FILESTRCASEEQ(".dvi", dvi_base+strlen(dvi_base)-4) ||
-              FILESTRCASEEQ(".xdv", dvi_base+strlen(dvi_base)-4))) {
-    pdf_filename = NEW(strlen(dvi_base)+1, char);
-    strncpy(pdf_filename, dvi_base, strlen(dvi_base)-4);
-    pdf_filename[strlen(dvi_base)-4] = '\0';
+  len      = strlen(dvi_base) - strlen(".dvi");
+  suffix   = dvi_base + len;
+  if (dpx_conf.compat_mode == dpx_mode_mpost_mode && len > 0 &&
+      FILESTRCASEEQ(".mps", suffix)) {
+    pdf_filename = NEW(len+strlen(".pdf")+1, char);
+    strncpy(pdf_filename, dvi_base, len);
+    pdf_filename[len] = '\0';
+  } else if (len > 0 &&
+             (FILESTRCASEEQ(".dvi", suffix) ||
+              FILESTRCASEEQ(".xdv", suffix))) {
+    pdf_filename = NEW(len+strlen(".pdf")+1, char);
+    strncpy(pdf_filename, dvi_base, len);
+    pdf_filename[len] = '\0';
   } else {
-    pdf_filename = NEW(strlen(dvi_base)+5, char);
+    pdf_filename = NEW(strlen(dvi_base)+strlen(".pdf")+1, char);
     strcpy(pdf_filename, dvi_base);
   }
 

Modified: trunk/Build/source/texk/dvipdfm-x/pdfdev.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfdev.c	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/pdfdev.c	2019-05-26 04:55:48 UTC (rev 51226)
@@ -1,6 +1,6 @@
 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
 
-    Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
+    Copyright (C) 2002-2019 by Jin-Hwan Cho and Shunsaku Hirata,
     the dvipdfmx project team.
     
     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -1963,7 +1963,7 @@
 }
 
 void
-pdf_dev_end_actualtext ()
+pdf_dev_end_actualtext (void)
 {
   graphics_mode();
 

Modified: trunk/Build/source/texk/dvipdfm-x/pdfdev.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfdev.h	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/pdfdev.h	2019-05-26 04:55:48 UTC (rev 51226)
@@ -1,6 +1,6 @@
 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
 
-    Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
+    Copyright (C) 2002-2019 by Jin-Hwan Cho and Shunsaku Hirata,
     the dvipdfmx project team.
     
     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -219,6 +219,6 @@
 extern void   pdf_dev_pop_coord(void);
 
 extern void   pdf_dev_begin_actualtext (uint16_t *unicodes, int len);
-extern void   pdf_dev_end_actualtext ();
+extern void   pdf_dev_end_actualtext (void);
 
 #endif /* _PDFDEV_H_ */

Modified: trunk/Build/source/texk/dvipdfm-x/pdfdoc.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/pdfdoc.c	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/pdfdoc.c	2019-05-26 04:55:48 UTC (rev 51226)
@@ -2545,9 +2545,10 @@
   if (manual_thumb_enabled) {
     if (strlen(filename) > 4 &&
         !strncmp(".pdf", filename + strlen(filename) - 4, 4)) {
-      thumb_basename = NEW(strlen(filename)-4+1, char);
-      strncpy(thumb_basename, filename, strlen(filename)-4);
-      thumb_basename[strlen(filename)-4] = 0;
+      size_t len = strlen(filename) - strlen(".pdf");
+      thumb_basename = NEW(len+1, char);
+      strncpy(thumb_basename, filename, len);
+      thumb_basename[len] = 0;
     } else {
       thumb_basename = NEW(strlen(filename)+1, char);
       strcpy(thumb_basename, filename);

Modified: trunk/Build/source/texk/dvipdfm-x/spc_dvips.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/spc_dvips.c	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/spc_dvips.c	2019-05-26 04:55:48 UTC (rev 51226)
@@ -1,6 +1,6 @@
 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
 
-    Copyright (C) 2002-2018 by Jin-Hwan Cho and Shunsaku Hirata,
+    Copyright (C) 2002-2019 by Jin-Hwan Cho and Shunsaku Hirata,
     the dvipdfmx project team.
     
     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -353,7 +353,7 @@
   return 0;
 }
 
-static int calculate_PS (char *string, int length, double *res1, double *res2, double *res3, double *res4, double *res5, double *res6);
+static int calculate_PS (char *strptr, int length, double *res1, double *res2, double *res3, double *res4, double *res5, double *res6);
 
 static int
 spc_handler_ps_tricks_bput (struct spc_env *spe, struct spc_arg *args, int must_def, int pre_def)
@@ -483,7 +483,7 @@
   static const char *post = "concat matrix currentmatrix ==";
 
   cmd = calloc(l + 41, 1);
-  strncpy(cmd, "matrix setmatrix ", 17);
+  strncpy(cmd, "matrix setmatrix ", 18);
   strncpy(cmd + 17, args->curptr, l);
   concat = strstr(cmd, "concat");
   if (concat != 0) {
@@ -1027,7 +1027,7 @@
 #endif
 
 static
-int calculate_PS (char *string, int length, double *res1, double *res2, double *res3, double *res4, double *res5, double *res6) {
+int calculate_PS (char *strptr, int length, double *res1, double *res2, double *res3, double *res4, double *res5, double *res6) {
   char *formula, *cmd;
   FILE *fp, *coord;
   int k;
@@ -1049,7 +1049,7 @@
     fprintf(fp, "(%s) run\n", page_defs);
   if (temporary_defs)
     fprintf(fp, "(%s) run\n", temporary_defs);
-  fwrite(string, 1, length, fp);
+  fwrite(strptr, 1, length, fp);
   fclose(fp);
 #ifdef MIKTEX
   {

Modified: trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/spc_pdfm.c	2019-05-26 04:55:48 UTC (rev 51226)
@@ -453,12 +453,12 @@
 static int
 maybe_reencode_utf8(pdf_obj *instring)
 {
-  unsigned char* inbuf;
-  int            inlen;
-  int            non_ascii = 0;
-  unsigned char* cp;
-  unsigned char* op;
-  unsigned char  wbuf[WBUF_SIZE];
+  unsigned char       *inbuf;
+  int                  inlen;
+  int                  non_ascii = 0;
+  const unsigned char *cp;
+  unsigned char       *op;
+  unsigned char        wbuf[WBUF_SIZE];
 
   if (!instring)
     return 0;

Modified: trunk/Build/source/texk/dvipdfm-x/system.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/system.h	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/system.h	2019-05-26 04:55:48 UTC (rev 51226)
@@ -1,6 +1,6 @@
 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
 
-    Copyright (C) 2002-2016 by Jin-Hwan Cho and Shunsaku Hirata,
+    Copyright (C) 2002-2019 by Jin-Hwan Cho and Shunsaku Hirata,
     the dvipdfmx project team.
     
     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks at kettering.edu>
@@ -32,7 +32,9 @@
 #endif
 
 #ifdef WIN32
+#ifdef _MSC_VER
 #  pragma warning(disable : 4101 4018)
+#endif /* _MSC_VER */
 #endif /* WIN32 */
 
 #endif /* _SYSTEM_H_ */

Modified: trunk/Build/source/texk/dvipdfm-x/truetype.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/truetype.c	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/truetype.c	2019-05-26 04:55:48 UTC (rev 51226)
@@ -1,6 +1,6 @@
 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
 
-    Copyright (C) 2007-2018 by Jin-Hwan Cho and Shunsaku Hirata,
+    Copyright (C) 2007-2019 by Jin-Hwan Cho and Shunsaku Hirata,
     the dvipdfmx project team.
     
     This program is free software; you can redistribute it and/or modify
@@ -129,7 +129,7 @@
     length = tt_get_ps_fontname(sfont, fontname, 255);
     if (length < 1) {
       length = MIN(strlen(ident), 255);
-      strncpy(fontname, ident, length);
+      memcpy(fontname, ident, length);
     }
     fontname[length] = '\0';
     for (n = 0; n < length; n++) {

Modified: trunk/Build/source/texk/dvipdfm-x/tt_post.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_post.c	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/tt_post.c	2019-05-26 04:55:48 UTC (rev 51226)
@@ -63,6 +63,7 @@
    *   -- https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6post.html
    *
    * But there are no restriction in Microsoft's OpenType spec.
+   */
 
       if (idx > 32767) {
         /* Although this is strictly speaking out of spec, it seems to work

Modified: trunk/Build/source/texk/dvipdfm-x/xbb.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/xbb.c	2019-05-25 23:38:45 UTC (rev 51225)
+++ trunk/Build/source/texk/dvipdfm-x/xbb.c	2019-05-26 04:55:48 UTC (rev 51226)
@@ -107,8 +107,8 @@
 
 static char *make_xbb_filename(const char *name)
 {
-  int i;
   char *result;
+  int   i;
 
   for (i = 0; i < sizeof(extensions) / sizeof(extensions[0]); i++) {
     if (strlen(extensions[i]) < strlen(name) &&
@@ -117,12 +117,14 @@
   }
   if (i == sizeof(extensions) / sizeof(extensions[0])) {
     WARN("%s: Filename does not end in a recognizable extension.\n", name);
-    result = NEW(strlen(name)+5, char);  /* 5 = ".xbb" + trailing 0 */
+    result = NEW(strlen(name)+strlen(".xbb")+1, char);
     strcpy(result, name);
   } else { /* Remove extension */
-    result = NEW(strlen(name)-strlen(extensions[i])+5, char);  /* 5 = ".xbb" + trailing 0 */
-    strncpy(result, name, strlen(name)-strlen(extensions[i]));
-    result[strlen(name)-strlen(extensions[i])] = 0;
+    size_t len;
+    len    = strlen(name) - strlen(extensions[i]);
+    result = NEW(len+strlen(".xbb")+1, char);
+    strncpy(result, name, len);
+    result[len] = 0;
   }
   strcat(result, ((dpx_conf.compat_mode == dpx_mode_compat_mode) ? ".bb" : ".xbb"));
   return result;



More information about the tex-live-commits mailing list