Simply avoid warnings of modern gcc - enscript - GNU Enscript
 (HTM) git clone git://thinkerwim.org/enscript.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 0779ca6512bf93e8f8dfe53c1a3446adb2475acc
 (DIR) parent 1b76685a8e405f54bae2b0f131588e8018e80f71
 (HTM) Author: Werner Fink <werner@suse.de>
       Date:   Tue, 23 Jan 2018 15:26:50 +0100
       
       Simply avoid warnings of modern gcc
       
       Signed-off-by: Werner Fink <werner@suse.de>
       Signed-off-by: James Cloos <cloos@jhcloos.com>
       
       Diffstat:
         M afmlib/afmparse.c                   |       2 +-
         M compat/regex.c                      |      12 ++++++------
         M compat/xalloc.c                     |       6 +++---
         M src/gsint.h                         |       2 +-
         M src/main.c                          |       3 ++-
         M src/psgen.c                         |      30 ++++++++++++++----------------
         M src/util.c                          |      10 ++++++----
         M states/main.c                       |       2 +-
         M states/utils.c                      |       2 +-
       
       9 files changed, 35 insertions(+), 34 deletions(-)
       ---
 (DIR) diff --git a/afmlib/afmparse.c b/afmlib/afmparse.c
       @@ -620,7 +620,7 @@ static void
        get_key (AFMHandle handle, ParseCtx *ctx, AFMKey *key_return)
        {
          int key;
       -  char msg[256];
       +  char msg[1024+16];
        
          while (1)
            {
 (DIR) diff --git a/compat/regex.c b/compat/regex.c
       @@ -2400,11 +2400,12 @@ regex_compile (pattern, size, syntax, bufp)
                    case ')':
                      if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
        
       -              if (COMPILE_STACK_EMPTY)
       +              if (COMPILE_STACK_EMPTY) {
                        if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
                          goto normal_backslash;
                        else
                          FREE_STACK_RETURN (REG_ERPAREN);
       +              }
        
                    handle_close:
                      if (fixup_alt_jump)
       @@ -2420,11 +2421,12 @@ regex_compile (pattern, size, syntax, bufp)
                        }
        
                      /* See similar code for backslashed left paren above.  */
       -              if (COMPILE_STACK_EMPTY)
       +              if (COMPILE_STACK_EMPTY) {
                        if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
                          goto normal_char;
                        else
                          FREE_STACK_RETURN (REG_ERPAREN);
       +              }
        
                      /* Since we just checked for an empty stack above, this
                         ``can't happen''.  */
       @@ -3106,8 +3108,6 @@ re_compile_fastmap (bufp)
          char *destination;
        #endif
          /* We don't push any register information onto the failure stack.  */
       -  unsigned num_regs = 0;
       -
          register char *fastmap = bufp->fastmap;
          unsigned char *pattern = bufp->buffer;
          unsigned char *p = pattern;
       @@ -4801,8 +4801,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
                       register from the stack, since lowest will == highest in
                       `pop_failure_point'.  */
                    active_reg_t dummy_low_reg, dummy_high_reg;
       -            unsigned char *pdummy;
       -            const char *sdummy;
       +            unsigned char *pdummy __attribute__ ((__unused__));
       +            const char *sdummy __attribute__ ((__unused__));
        
                    DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
                    POP_FAILURE_POINT (sdummy, pdummy,
 (DIR) diff --git a/compat/xalloc.c b/compat/xalloc.c
       @@ -67,7 +67,7 @@ xmalloc (size)
          ptr = malloc (size);
          if (ptr == NULL)
            {
       -      fprintf (stderr, _("xmalloc(): couldn't allocate %d bytes\n"), size);
       +      fprintf (stderr, _("xmalloc(): couldn't allocate %zd bytes\n"), size);
              exit (1);
            }
        
       @@ -85,7 +85,7 @@ xcalloc (num, size)
          ptr = calloc (num, size);
          if (ptr == NULL)
            {
       -      fprintf (stderr, _("xcalloc(): couldn't allocate %d bytes\n"), size);
       +      fprintf (stderr, _("xcalloc(): couldn't allocate %zd bytes\n"), size);
              exit (1);
            }
        
       @@ -106,7 +106,7 @@ xrealloc (ptr, size)
          nptr = realloc (ptr, size);
          if (nptr == NULL)
            {
       -      fprintf (stderr, _("xrealloc(): couldn't reallocate %d bytes\n"), size);
       +      fprintf (stderr, _("xrealloc(): couldn't reallocate %zd bytes\n"), size);
              exit (1);
            }
        
 (DIR) diff --git a/src/gsint.h b/src/gsint.h
       @@ -130,7 +130,7 @@ extern double atan2 ___P ((double, double));
          (('0' <= (ch) && (ch) <= '9') || (ch) == '.' || (ch) == '-' || (ch) == '+')
        
        /* Return the width of the character <ch> */
       -#define CHAR_WIDTH(ch) (font_widths[(unsigned char) (ch)])
       +#define FNT_CHAR_WIDTH(ch) (font_widths[(unsigned char) (ch)])
        
        /* Current point y movement from line to line. */
        #define LINESKIP (Fpt.h + baselineskip)
 (DIR) diff --git a/src/main.c b/src/main.c
       @@ -1468,7 +1468,8 @@ name             width\theight\tllx\tlly\turx\tury\n\
              buffer_append (&buffer, enscript_library);
              buffer_append (&buffer, "/hl/*.st");
        
       -      system (buffer_ptr (&buffer));
       +      if (system (buffer_ptr (&buffer)) < 0)
       +        perror("system");
              exit (0);
            }
        
 (DIR) diff --git a/src/psgen.c b/src/psgen.c
       @@ -585,8 +585,8 @@ process_file (char *fname_arg, InputStream *is, int is_toc)
           * Count possible line number spaces.  This should be enought for 99999
           * lines
           */
       -  linenumber_space = CHAR_WIDTH ('0') * 5 + 1.0;
       -  linenumber_margin = CHAR_WIDTH (':') + CHAR_WIDTH ('m');
       +  linenumber_space = FNT_CHAR_WIDTH ('0') * 5 + 1.0;
       +  linenumber_margin = FNT_CHAR_WIDTH (':') + FNT_CHAR_WIDTH ('m');
        
          /* We got a new input file. */
          input_filenum++;
       @@ -1137,7 +1137,7 @@ large for page\n"),
        /* Help macros. */
        
        /* Check if character <ch> fits to current line. */
       -#define FITS_ON_LINE(ch) ((linepos + CHAR_WIDTH (ch) < linew) || col == 0)
       +#define FITS_ON_LINE(ch) ((linepos + FNT_CHAR_WIDTH (ch) < linew) || col == 0)
        
        /* Is line buffer empty? */
        #define BUFFER_EMPTY() (bufpos == 0)
       @@ -1160,13 +1160,13 @@ large for page\n"),
        #define EMIT(ch)                 \
          do {                                \
            APPEND_CHAR (ch);                \
       -    linepos += CHAR_WIDTH (ch);        \
       +    linepos += FNT_CHAR_WIDTH (ch);        \
            col++;                        \
          } while (0)
        
        #define UNEMIT(ch)                \
          do {                                \
       -    linepos -= CHAR_WIDTH (ch); \
       +    linepos -= FNT_CHAR_WIDTH (ch); \
            col--;                        \
          } while (0)
        
       @@ -1690,7 +1690,7 @@ get_next_token (InputStream *is, double linestart, double linepos,
                    {
                      /* Proportional font. */
        
       -              double grid = tabsize * CHAR_WIDTH (' ');
       +              double grid = tabsize * FNT_CHAR_WIDTH (' ');
                      col++;
        
                      /* Move linepos to the next multiple of <grid>. */
       @@ -1748,9 +1748,9 @@ get_next_token (InputStream *is, double linestart, double linepos,
                  if (ch == bs)
                    {
                      if (BUFFER_EMPTY () || !EXISTS (buffer[bufpos - 1]))
       -                linepos -= CHAR_WIDTH ('m');
       +                linepos -= FNT_CHAR_WIDTH ('m');
                      else
       -                linepos -= CHAR_WIDTH (buffer[bufpos - 1]);
       +                linepos -= FNT_CHAR_WIDTH (buffer[bufpos - 1]);
        
                      done = DONE_DONE;
                      break;
       @@ -1775,7 +1775,7 @@ get_next_token (InputStream *is, double linestart, double linepos,
                                APPEND_CHAR (buf[i]);
        
                              /* Update current point counters manually. */
       -                      linepos += CHAR_WIDTH (ch);
       +                      linepos += FNT_CHAR_WIDTH (ch);
                              col++;
                            }
                          else if (ch == '(' || ch == ')' || ch == '\\')
       @@ -1848,7 +1848,7 @@ get_next_token (InputStream *is, double linestart, double linepos,
        
                      /* Count length. */
                      for (i = 0; buf[i]; i++)
       -                len += CHAR_WIDTH (buf[i]);
       +                len += FNT_CHAR_WIDTH (buf[i]);
        
                      if (linepos + len < linew || col == 0)
                        {
       @@ -2472,7 +2472,7 @@ recognize_eps_file (Token *token)
                          /* No, this BoundingBox comment is corrupted. */
                          MESSAGE (0, (stderr, _("EPS file \"%s\" contains malformed \
        %%%%BoundingBox row:\n\"%.*s\"\n"),
       -                               token->u.epsf.filename, strlen (buf) - 1, buf));
       +                               token->u.epsf.filename, (int)(strlen (buf) - 1), buf));
                          break;
                        }
                    }
       @@ -2599,7 +2599,7 @@ read_float (InputStream *is, int units, int horizontal)
        
                case 'l':                /* lines or characters */
                  if (horizontal)
       -            val *= CHAR_WIDTH ('m');
       +            val *= FNT_CHAR_WIDTH ('m');
                  else
                    val *= LINESKIP;
                  break;
       @@ -2728,7 +2728,7 @@ print_line_number (double x, double y, double space, double margin,
          int i;
          char *saved_Fname = "";
          FontPoint saved_Fpt;
       -  InputEncoding saved_Fencoding;
       +  InputEncoding saved_Fencoding = 0;
        
          saved_Fpt.w = 0.0;
          saved_Fpt.h = 0.0;
       @@ -2758,7 +2758,7 @@ print_line_number (double x, double y, double space, double margin,
          /* Count linenumber string length. */
          sprintf (buf, "%d", linenum);
          for (i = 0; buf[i]; i++)
       -    len += CHAR_WIDTH (buf[i]);
       +    len += FNT_CHAR_WIDTH (buf[i]);
        
          /* Print line numbers. */
          OUTPUT ((cofp, "%g %g M (%s:) s\n", x + space - len, y, buf));
       @@ -2781,8 +2781,6 @@ print_line_number (double x, double y, double space, double margin,
         * The name of the divert file, shared between divert() and undivert()
         * functions.
         */
       -static char divertfname[512];
       -
        static void
        divert ()
        {
 (DIR) diff --git a/src/util.c b/src/util.c
       @@ -639,7 +639,7 @@ paste_file (char *name, char *suffix)
        
                  if (j >= sizeof (name) - 1)
                    FATAL ((stderr, _("%s:%d: %%Format: too long name, maxlen=%d"),
       -                    buffer_ptr (ctx.fullname), line, sizeof (name) - 1));
       +                    buffer_ptr (ctx.fullname), line, (int)(sizeof (name) - 1)));
        
                  /* Find the start of the format string. */
                  for (; buf[i] && isspace (buf[i]); i++)
       @@ -1370,7 +1370,8 @@ format_user_string (char *context_name, char *str)
                          break;
        
                        case 'c':        /* `%c' trailing component of pwd. */
       -                  getcwd (buf, sizeof (buf));
       +                  if (!getcwd (buf, sizeof (buf)))
       +                    perror("getcwd");
                          cp = strrchr (buf, '/');
                          if (cp)
                            cp++;
       @@ -1386,7 +1387,8 @@ format_user_string (char *context_name, char *str)
                          break;
        
                        case 'd':        /* `%d' current working directory */
       -                  getcwd (buf, sizeof (buf));
       +                  if (!getcwd (buf, sizeof (buf)))
       +                    perror("getcwd");
                          APPEND_STR (buf);
                          break;
        
       @@ -1854,7 +1856,7 @@ parse_float (char *string, int units, int horizontal)
        
                case 'l':
                  if (horizontal)
       -            val *= CHAR_WIDTH ('m');
       +            val *= FNT_CHAR_WIDTH ('m');
                  else
                    val *= LINESKIP;
                  break;
 (DIR) diff --git a/states/main.c b/states/main.c
       @@ -371,7 +371,7 @@ main (argc, argv)
              if (cp)
                {
                  path = xmalloc (cp - defs_file + 3);
       -          sprintf (path, ".%c%.*s", PATH_SEPARATOR, cp - defs_file, defs_file);
       +          sprintf (path, ".%c%.*s", PATH_SEPARATOR, (int)(cp - defs_file), defs_file);
                }
              else
                path = ".";
 (DIR) diff --git a/states/utils.c b/states/utils.c
       @@ -833,7 +833,7 @@ eval_expr (expr, env)
                {
                  Environment *nenv = NULL;
                  ListItem *i, *e;
       -          List *stmts;
       +          List *stmts __attribute__ ((__unused__));
                  List *lst;
                  Cons *args_locals;