about summary refs log tree commit diff
path: root/converter/ppm
diff options
context:
space:
mode:
Diffstat (limited to 'converter/ppm')
-rw-r--r--converter/ppm/411toppm.c4
-rw-r--r--converter/ppm/pcxtoppm.c12
-rw-r--r--converter/ppm/picttoppm.c3
-rw-r--r--converter/ppm/ppmtoarbtxt.c4
-rw-r--r--converter/ppm/ppmtoascii.c3
-rw-r--r--converter/ppm/ppmtobmp.c9
-rw-r--r--converter/ppm/ppmtogif.c7
-rw-r--r--converter/ppm/ppmtoicr.c10
-rw-r--r--converter/ppm/ppmtopcx.c9
-rw-r--r--converter/ppm/ppmtosixel.c2
-rw-r--r--converter/ppm/ppmtospu.c7
-rw-r--r--converter/ppm/ppmtoterm.c8
-rw-r--r--converter/ppm/ppmtowinicon.c11
-rw-r--r--converter/ppm/ppmtoxpm.c56
-rw-r--r--converter/ppm/winicontoppm.c9
-rw-r--r--converter/ppm/ximtoppm.c6
-rw-r--r--converter/ppm/yuvtoppm.c3
17 files changed, 69 insertions, 94 deletions
diff --git a/converter/ppm/411toppm.c b/converter/ppm/411toppm.c
index a50e5145..9d338fa7 100644
--- a/converter/ppm/411toppm.c
+++ b/converter/ppm/411toppm.c
@@ -86,8 +86,6 @@ parseCommandLine(int argc, const char ** argv,
 -----------------------------------------------------------------------------*/
 
     optEntry * option_def;
-        /* Instructions to OptParseOptions2 on how to parse our options.
-         */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -106,7 +104,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (cmdlineP->width <= 0)
diff --git a/converter/ppm/pcxtoppm.c b/converter/ppm/pcxtoppm.c
index 05e09d73..f06dd4e8 100644
--- a/converter/ppm/pcxtoppm.c
+++ b/converter/ppm/pcxtoppm.c
@@ -87,13 +87,13 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def = malloc( 100*sizeof( optEntry ) );
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;
     optStruct3 opt;
 
     unsigned int option_def_index;
 
+    MALLOCARRAY_NOFAIL(option_def, 100);
+
     option_def_index = 0;   /* incremented by OPTENT3 */
     OPTENT3(0, "stdpalette",     OPT_FLAG,   NULL,
             &cmdlineP->stdpalette,    0 );
@@ -101,10 +101,10 @@ parseCommandLine(int argc, const char ** argv,
             &cmdlineP->verbose,       0 );
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char**)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdline_p and others. */
 
     if (argc-1 < 1)
diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c
index 8ca553bd..fc73a92c 100644
--- a/converter/ppm/picttoppm.c
+++ b/converter/ppm/picttoppm.c
@@ -78,7 +78,6 @@ parseCommandLine(int argc,
 --------------------------------------------------------------------------*/
     optEntry * option_def;
     optStruct3 opt;
-        /* Instructions to pm_optParseOptions3 on how to parse our options. */
 
     unsigned int option_def_index;
 
@@ -102,7 +101,7 @@ parseCommandLine(int argc,
     opt.short_allowed = false;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;   /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (!fontdirSpec)
diff --git a/converter/ppm/ppmtoarbtxt.c b/converter/ppm/ppmtoarbtxt.c
index cb2c388b..a8d7a004 100644
--- a/converter/ppm/ppmtoarbtxt.c
+++ b/converter/ppm/ppmtoarbtxt.c
@@ -62,8 +62,6 @@ parseCommandLine(int argc, const char ** argv,
    in argv!
 -----------------------------------------------------------------------------*/
     optEntry * option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options.
-         */
     optStruct3 opt;
 
     unsigned int hdSpec, tlSpec;
@@ -84,7 +82,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
     free(option_def);
 
     if (!hdSpec)
diff --git a/converter/ppm/ppmtoascii.c b/converter/ppm/ppmtoascii.c
index 524bcd2c..b7c6669d 100644
--- a/converter/ppm/ppmtoascii.c
+++ b/converter/ppm/ppmtoascii.c
@@ -102,7 +102,6 @@ parseCommandLine(int argc, const char **argv,
                  struct cmdlineInfo * const cmdlineP) {
 
     optEntry * option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -118,7 +117,7 @@ parseCommandLine(int argc, const char **argv,
     opt.short_allowed = false;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (dim1x2Spec && dim2x4Spec)
diff --git a/converter/ppm/ppmtobmp.c b/converter/ppm/ppmtobmp.c
index 8590c5ef..ed44b83a 100644
--- a/converter/ppm/ppmtobmp.c
+++ b/converter/ppm/ppmtobmp.c
@@ -17,6 +17,7 @@
 #define _BSD_SOURCE 1    /* Make sure strdup() is in string.h */
 #define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
 
+#include <stdbool.h>
 #include <assert.h>
 #include <string.h>
 
@@ -87,8 +88,6 @@ parseCommandLine(int argc, const char ** argv,
    in argv!
 -----------------------------------------------------------------------------*/
     optEntry * option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options.
-         */
     optStruct3 opt;
 
     unsigned int windowsSpec, os2Spec, mapfileSpec;
@@ -106,10 +105,10 @@ parseCommandLine(int argc, const char ** argv,
             &mapfileSpec,             0);
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
 
     if (windowsSpec && os2Spec)
         pm_error("Can't specify both -windows and -os2 options.");
diff --git a/converter/ppm/ppmtogif.c b/converter/ppm/ppmtogif.c
index 0564b7b4..b50a934d 100644
--- a/converter/ppm/ppmtogif.c
+++ b/converter/ppm/ppmtogif.c
@@ -14,6 +14,7 @@
 #define _BSD_SOURCE   /* Make sure strdup() is in string.h */
 #define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
 
+#include <stdbool.h>
 #include <assert.h>
 #include <string.h>
 #include <stdio.h>
@@ -144,10 +145,10 @@ parseCommandLine(int argc, const char ** argv,
         */
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (latex2htmlhack)
diff --git a/converter/ppm/ppmtoicr.c b/converter/ppm/ppmtoicr.c
index de21fc68..2c9fd3a1 100644
--- a/converter/ppm/ppmtoicr.c
+++ b/converter/ppm/ppmtoicr.c
@@ -50,9 +50,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -75,10 +73,10 @@ parseCommandLine(int argc, const char ** argv,
             &rleSpec,        0);
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We may have parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We may have parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (!expandSpec)
diff --git a/converter/ppm/ppmtopcx.c b/converter/ppm/ppmtopcx.c
index 5b7e1003..68ad4db0 100644
--- a/converter/ppm/ppmtopcx.c
+++ b/converter/ppm/ppmtopcx.c
@@ -17,6 +17,7 @@
 ** http://bespin.org/~qz/pc-gpe/pcx.txt
 ** http://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
 */
+#include <stdbool.h>
 #include <assert.h>
 
 #include "pm_c_util.h"
@@ -83,8 +84,6 @@ parseCommandLine(int argc, const char ** argv,
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
     optEntry * option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -112,10 +111,10 @@ parseCommandLine(int argc, const char ** argv,
     OPTENT3(0, "ypos",  OPT_INT, &cmdlineP->ypos, &yposSpec,   0);
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3( &argc, (char **)argv, opt, sizeof(opt), 0 );
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0 );
         /* Uses and sets argc, argv, and some of *cmdline_p and others. */
 
     if (!xposSpec)
diff --git a/converter/ppm/ppmtosixel.c b/converter/ppm/ppmtosixel.c
index 4fdf6a66..24454214 100644
--- a/converter/ppm/ppmtosixel.c
+++ b/converter/ppm/ppmtosixel.c
@@ -102,7 +102,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = false; /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;   /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     cmdlineP->charWidth = opt7Bit ? CHARWIDTH_7BIT : CHARWIDTH_8BIT;
diff --git a/converter/ppm/ppmtospu.c b/converter/ppm/ppmtospu.c
index df0fb970..4ba70f02 100644
--- a/converter/ppm/ppmtospu.c
+++ b/converter/ppm/ppmtospu.c
@@ -5,6 +5,7 @@
  *  Copyright (C) 1990, Steve Belczyk
  */
 
+#include <stdbool.h>
 #include <assert.h>
 #include <stdio.h>
 
@@ -56,10 +57,10 @@ parseCommandLine(int argc, const char ** argv,
             NULL,                       &d4Spec, 0);
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
 
diff --git a/converter/ppm/ppmtoterm.c b/converter/ppm/ppmtoterm.c
index 6e41a8cb..b1d94fa2 100644
--- a/converter/ppm/ppmtoterm.c
+++ b/converter/ppm/ppmtoterm.c
@@ -19,6 +19,7 @@
 **
 */
 
+#include <stdbool.h>
 #include <assert.h>
 #include <string.h>
 
@@ -43,7 +44,6 @@ parseCommandLine(int argc, const char ** argv,
                  struct cmdlineInfo * const cmdlineP) {
 
     optEntry * option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -54,10 +54,10 @@ parseCommandLine(int argc, const char ** argv,
     OPTENT3(0, "verbose", OPT_FLAG, NULL, &cmdlineP->verbose, 0);
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 < 1)
diff --git a/converter/ppm/ppmtowinicon.c b/converter/ppm/ppmtowinicon.c
index 69baa2f6..2d8ddaf7 100644
--- a/converter/ppm/ppmtowinicon.c
+++ b/converter/ppm/ppmtowinicon.c
@@ -10,6 +10,7 @@
 ** implied warranty.
 */
 
+#include <stdbool.h>
 #include <assert.h>
 #include <math.h>
 #include <string.h>
@@ -57,9 +58,7 @@ parseCommandLine(int                  argc,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -79,10 +78,10 @@ parseCommandLine(int                  argc,
             &cmdlineP->verbose,            0);
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (!outputSpec)
diff --git a/converter/ppm/ppmtoxpm.c b/converter/ppm/ppmtoxpm.c
index 2167acb2..9cbab8f3 100644
--- a/converter/ppm/ppmtoxpm.c
+++ b/converter/ppm/ppmtoxpm.c
@@ -97,9 +97,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -125,10 +123,10 @@ parseCommandLine(int argc, const char ** argv,
     cmdlineP->rgb = NULL;      /* no rgb file specified */
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We may have parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We may have parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 == 0)
@@ -271,8 +269,7 @@ static void
 genCmap(colorhist_vector const chv,
         unsigned int     const ncolors,
         pixval           const maxval,
-        colorhash_table  const colornameHash,
-        const char **    const colornames,
+        ppm_ColorDict *  const colorDictP,
         bool             const includeTransparent,
         CixelMap **      const cmapP,
         unsigned int *   const transIndexP,
@@ -290,14 +287,10 @@ genCmap(colorhist_vector const chv,
    This map includes an entry for transparency, whether the raster uses
    it or not.  We return its index as *transIndexP.
 
-   In the map, identify colors by the names given by 'colornameHash' and
-   colornames[].  'colornameHash' maps a color in 'pixel' form to an
-   index into colornames[]; colornames[] contains the text to identify the
-   color in the XPM format.  The colors in 'colornameHash' have maxval 255.
-   If a color is not in 'colornameHash', use hexadecimal notation in the
-   output colormap.
+   In the map, identify colors by the names given by *colorDictP.  If a color
+   is not in *colorDictP, use hexadecimal notation in the output colormap.
 
-   But if 'colornameHash' is null, don't use color names at all.  Just use
+   But if *colorDictP is null, don't use color names at all.  Just use
    hexadecimal notation.
 
    Return as *charsPerPixel the number of characters, or digits, that
@@ -338,13 +331,13 @@ genCmap(colorhist_vector const chv,
 
         PPM_DEPTH(color255, color, maxval, 255);
 
-        if (colornameHash == NULL)
+        if (!colorDictP)
             colorname = NULL;
         else {
             int colornameIndex;
-            colornameIndex = ppm_lookupcolor(colornameHash, &color255);
+            colornameIndex = ppm_lookupcolor(colorDictP->cht, &color255);
             if (colornameIndex >= 0)
-                colorname = strdup(colornames[colornameIndex]);
+                colorname = strdup(colorDictP->name[colornameIndex]);
             else
                 colorname = NULL;
         }
@@ -537,7 +530,7 @@ computecolorhash(pixel **          const pixels,
                     ++ncolors;
                 }
             } else
-                *transparentSomewhereP = TRUE;
+                *transparentSomewhereP = true;
         }
     }
     *chtP                  = cht;
@@ -599,12 +592,7 @@ main(int argc, const char * *argv) {
     colorhash_table cht;
     colorhist_vector chv;
 
-    colorhash_table colornameHash;
-        /* Hash table to map colors to their names */
-    const char ** colornames;
-        /* Table of color names; 'colornameHash' yields an index into this
-           array.
-        */
+    ppm_ColorDict * colorDictP;  /* The color name dictionary we use */
 
     pixel ** pixels;
     gray ** alpha;
@@ -638,28 +626,26 @@ main(int argc, const char * *argv) {
                     &chv, &cht, &ncolors, &transparentSomewhere);
 
     if (cmdline.hexonly)
-        colornameHash = NULL;
+        colorDictP = NULL;
     else if (cmdline.rgb)
-        ppm_readcolornamefile(cmdline.rgb, TRUE, &colornameHash, &colornames);
+        colorDictP = ppm_colorDict_new(cmdline.rgb, true);
     else
-        ppm_readcolornamefile(NULL, FALSE, &colornameHash, &colornames);
+        colorDictP = ppm_colorDict_new(NULL, false);
 
     /* Now generate the character-pixel colormap table. */
-    genCmap(chv, ncolors, maxval,
-            colornameHash, colornames, transparentSomewhere,
+    genCmap(chv, ncolors, maxval, colorDictP, transparentSomewhere,
             &cmap, &transIndex, &cmapSize, &charsPerPixel);
 
     writeXpmFile(stdout, pixels, alpha, alphaMaxval,
                  cmdline.name, cols, rows, cmapSize,
                  charsPerPixel, cmap, cht, transIndex);
 
-    if (colornameHash) {
-        ppm_freecolorhash(colornameHash);
-        ppm_freecolornames(colornames);
-    }
+    if (colorDictP)
+        ppm_colorDict_destroy(colorDictP);
     destroyCmap(cmap, cmapSize);
     ppm_freearray(pixels, rows);
-    if (alpha) pgm_freearray(alpha, rows);
+    if (alpha)
+        pgm_freearray(alpha, rows);
 
     return 0;
 }
diff --git a/converter/ppm/winicontoppm.c b/converter/ppm/winicontoppm.c
index 54bc0809..f7847df5 100644
--- a/converter/ppm/winicontoppm.c
+++ b/converter/ppm/winicontoppm.c
@@ -18,6 +18,7 @@
 #define _BSD_SOURCE 1      /* Make sure strdup() is in string.h */
 #define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
 
+#include <stdbool.h>
 #include <math.h>
 #include <string.h>
 #include <assert.h>
@@ -66,8 +67,6 @@ parseCommandLine (int argc, const char ** argv,
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
     optEntry * option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -87,10 +86,10 @@ parseCommandLine (int argc, const char ** argv,
             &cmdlineP->verbose,        0 );
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 < 1)
diff --git a/converter/ppm/ximtoppm.c b/converter/ppm/ximtoppm.c
index b82463c3..c5ba7e80 100644
--- a/converter/ppm/ximtoppm.c
+++ b/converter/ppm/ximtoppm.c
@@ -57,10 +57,10 @@ parseCommandLine(int argc, const char ** argv,
             &cmdlineP->alphaFilename, &alphaoutSpec, 0);
 
     opt.opt_table = option_def;
-    opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
-    opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
+    opt.short_allowed = false;  /* We have no short (old-fashioned) options */
+    opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char**)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and all of *cmdlineP. */
 
     if (!alphaoutSpec)
diff --git a/converter/ppm/yuvtoppm.c b/converter/ppm/yuvtoppm.c
index 87f541e5..5ee250e2 100644
--- a/converter/ppm/yuvtoppm.c
+++ b/converter/ppm/yuvtoppm.c
@@ -43,7 +43,6 @@ parseCommandLine(int argc, const char ** argv,
                  struct CmdlineInfo * const cmdlineP) {
 
     optEntry * option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options */
     optStruct3 opt;
     unsigned int option_def_index;
 
@@ -55,7 +54,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 < 2)