about summary refs log tree commit diff
path: root/converter/pbm
diff options
context:
space:
mode:
Diffstat (limited to 'converter/pbm')
-rw-r--r--converter/pbm/atktopbm.c2
-rw-r--r--converter/pbm/g3topbm.c12
-rw-r--r--converter/pbm/icontopbm.c12
-rw-r--r--converter/pbm/mrftopbm.c2
-rw-r--r--converter/pbm/pbmto4425.c2
-rw-r--r--converter/pbm/pbmtoatk.c2
-rw-r--r--converter/pbm/pbmtoln03.c5
-rw-r--r--converter/pbm/pbmtolps.c2
-rw-r--r--converter/pbm/pbmtonokia.c20
-rw-r--r--converter/pbm/pbmtopk.c2
-rw-r--r--converter/pbm/pbmtoxbm.c2
-rw-r--r--converter/pbm/pbmtozinc.c2
-rw-r--r--converter/pbm/pktopbm.c2
-rw-r--r--converter/pbm/xbmtopbm.c4
14 files changed, 35 insertions, 36 deletions
diff --git a/converter/pbm/atktopbm.c b/converter/pbm/atktopbm.c
index c4a81808..62664999 100644
--- a/converter/pbm/atktopbm.c
+++ b/converter/pbm/atktopbm.c
@@ -273,7 +273,7 @@ ReadATKRaster(FILE * const file,
 
     /* read the keyword */
     fscanf(file, " %5s", keyword);
-    if (!STREQ(keyword, "bits"))
+    if (!streq(keyword, "bits"))
       pm_error ("keyword is not 'bits'!");
 
     fscanf(file, " %d %d %d ", &objectid, &width, &height);
diff --git a/converter/pbm/g3topbm.c b/converter/pbm/g3topbm.c
index 1eefee96..261b6c39 100644
--- a/converter/pbm/g3topbm.c
+++ b/converter/pbm/g3topbm.c
@@ -18,6 +18,8 @@
   contributing their work to the public domain.
 ===========================================================================*/
 
+#define _BSD_SOURCE   /* Make nstring.h define strcaseeq() */
+
 #include "pbm.h"
 #include "shhopt.h"
 #include "nstring.h"
@@ -100,15 +102,15 @@ parseCommandLine(int argc, char ** const argv,
         if (cmdlineP->expectedLineSize < 1)
             pm_error("-width must be at least 1");
     } else if (paper_sizeSpec) {
-        if (STRCASEEQ(paperSize, "A6"))
+        if (strcaseeq(paperSize, "A6"))
             cmdlineP->expectedLineSize = 864;
-        else if (STRCASEEQ(paperSize, "A5"))
+        else if (strcaseeq(paperSize, "A5"))
             cmdlineP->expectedLineSize = 1216;
-        else if (STRCASEEQ(paperSize, "A4"))
+        else if (strcaseeq(paperSize, "A4"))
             cmdlineP->expectedLineSize = 1728;
-        else if (STRCASEEQ(paperSize, "B4"))
+        else if (strcaseeq(paperSize, "B4"))
             cmdlineP->expectedLineSize = 2048;
-        else if (STRCASEEQ(paperSize, "A3"))
+        else if (strcaseeq(paperSize, "A3"))
             cmdlineP->expectedLineSize = 2432;
         else
             pm_error("Unrecognized value for -paper_size '%s'.  "
diff --git a/converter/pbm/icontopbm.c b/converter/pbm/icontopbm.c
index d6dba8ae..a0d1bd2b 100644
--- a/converter/pbm/icontopbm.c
+++ b/converter/pbm/icontopbm.c
@@ -46,35 +46,35 @@ ReadIconFile(FILE *                const file,
         }
         variable[i] = '\0';
 
-        if ( STREQ( variable, "*/" )&& gotsome )
+        if ( streq( variable, "*/" )&& gotsome )
             break;
 
         if ( fscanf( file, "%d", &value ) != 1 )
             continue;
 
-        if ( STREQ( variable, "Width" ) )
+        if ( streq( variable, "Width" ) )
         {
             *widthP = value;
             gotsome = 1;
         }
-        else if ( STREQ( variable, "Height" ) )
+        else if ( streq( variable, "Height" ) )
         {
             *heightP = value;
             gotsome = 1;
         }
-        else if ( STREQ( variable, "Depth" )  )
+        else if ( streq( variable, "Depth" )  )
         {
             if ( value != 1 )
                 pm_error( "invalid depth" );
             gotsome = 1;
         }
-        else if ( STREQ( variable, "Format_version" ) )
+        else if ( streq( variable, "Format_version" ) )
         {
             if ( value != 1 )
                 pm_error( "invalid Format_version" );
             gotsome = 1;
         }
-        else if ( STREQ( variable, "Valid_bits_per_item" ) )
+        else if ( streq( variable, "Valid_bits_per_item" ) )
         {
             if ( value != 16 )
                 pm_error( "invalid Valid_bits_per_item" );
diff --git a/converter/pbm/mrftopbm.c b/converter/pbm/mrftopbm.c
index 696fe839..9cf93d47 100644
--- a/converter/pbm/mrftopbm.c
+++ b/converter/pbm/mrftopbm.c
@@ -176,7 +176,7 @@ main(int argc, char *argv[]) {
 
     expandAll = FALSE;  /* initial assumption */
 
-    if (argc-1 >= 1 && STREQ(argv[1], "-a")) {
+    if (argc-1 >= 1 && streq(argv[1], "-a")) {
         expandAll = TRUE;
         argc--,argv++;
     }
diff --git a/converter/pbm/pbmto4425.c b/converter/pbm/pbmto4425.c
index 605b12d5..1d97ac6a 100644
--- a/converter/pbm/pbmto4425.c
+++ b/converter/pbm/pbmto4425.c
@@ -145,7 +145,7 @@ main(int argc, char * argv[]) {
         pbmfile = argv[argn];
     }
 
-    if(STREQ(pbmfile, "-"))
+    if(streq(pbmfile, "-"))
     {
         pbmfp = stdin;
     }
diff --git a/converter/pbm/pbmtoatk.c b/converter/pbm/pbmtoatk.c
index de7adf63..dd829776 100644
--- a/converter/pbm/pbmtoatk.c
+++ b/converter/pbm/pbmtoatk.c
@@ -137,7 +137,7 @@ main(int argc, char *argv[]) {
     else if (argc-1 == 1) {
         ifd = pm_openr( argv[1] );
         strcpy(name, argv[1]);
-        if (STREQ( name, "-"))
+        if (streq( name, "-"))
             strcpy(name, "noname");
         
         if ((cp = strchr(name, '.')) != 0)
diff --git a/converter/pbm/pbmtoln03.c b/converter/pbm/pbmtoln03.c
index 07c8629f..f7cf53c7 100644
--- a/converter/pbm/pbmtoln03.c
+++ b/converter/pbm/pbmtoln03.c
@@ -219,13 +219,8 @@ main (int argc, char **argv) {
    if( argn != argc )
       pm_usage(usage);
 
-
-   /* Initialize pbm file */
    pbm_readpbminit (input, &width, &height, &format) ;
 
-   if (format != PBM_FORMAT && format != RPBM_FORMAT)
-      pm_error ("input not in PBM format") ;
-
 /*
  * In explanation of the sequence below:
  *      <ESC>[!p        DECSTR  soft terminal reset
diff --git a/converter/pbm/pbmtolps.c b/converter/pbm/pbmtolps.c
index 13a14e2b..5adef4c8 100644
--- a/converter/pbm/pbmtolps.c
+++ b/converter/pbm/pbmtolps.c
@@ -112,7 +112,7 @@ main(int argc, char ** argv) {
 	pbm_init(&argc, argv);
 
     i = 1;
-    if (i < argc && STREQ(argv[i], "-dpi")) {
+    if (i < argc && streq(argv[i], "-dpi")) {
         if (i == argc - 1)
             pm_usage(usage);
         sscanf(argv[i + 1], "%f", &dpi);
diff --git a/converter/pbm/pbmtonokia.c b/converter/pbm/pbmtonokia.c
index 58d0ec5b..ebcd813d 100644
--- a/converter/pbm/pbmtonokia.c
+++ b/converter/pbm/pbmtonokia.c
@@ -4,7 +4,7 @@
    Copyright information is at end of file.
 */
 
-#define _BSD_SOURCE    /* Make sure strcasecmp() is in string.h */
+#define _BSD_SOURCE    /* Make sure strcaseeq() is in nstring.h */
 #include <string.h>
 #include <assert.h>
 
@@ -96,17 +96,17 @@ parseCommandLine(int argc, char ** argv,
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (fmtSpec) {
-        if (STRCASEEQ(fmtOpt, "HEX_NOL"))
+        if (strcaseeq(fmtOpt, "HEX_NOL"))
             cmdlineP->outputFormat = FMT_HEX_NOL;
-        else if (STRCASEEQ(fmtOpt, "HEX_NGG"))
+        else if (strcaseeq(fmtOpt, "HEX_NGG"))
             cmdlineP->outputFormat = FMT_HEX_NGG;
-        else if (STRCASEEQ(fmtOpt, "HEX_NPM"))
+        else if (strcaseeq(fmtOpt, "HEX_NPM"))
             cmdlineP->outputFormat = FMT_HEX_NPM;
-        else if (STRCASEEQ(fmtOpt, "NOL"))
+        else if (strcaseeq(fmtOpt, "NOL"))
             cmdlineP->outputFormat = FMT_NOL;
-        else if (STRCASEEQ(fmtOpt, "NGG"))
+        else if (strcaseeq(fmtOpt, "NGG"))
             cmdlineP->outputFormat = FMT_NGG;
-        else if (STRCASEEQ(fmtOpt, "NPM"))
+        else if (strcaseeq(fmtOpt, "NPM"))
             cmdlineP->outputFormat = FMT_NPM;
         else
             pm_error("-fmt option must be HEX_NGG, HEX_NOL, HEX_NPM, "
@@ -153,7 +153,8 @@ freeCmdline(struct cmdlineInfo const cmdline) {
 
 
 static void
-checkSize(int cols, int rows){
+validateSize(unsigned int const cols,
+             unsigned int const rows){
 
     if (cols > 255)
         pm_error("This program cannot handle files with more than 255 "
@@ -469,7 +470,8 @@ main(int    argc,
     ifP = pm_openr(cmdline.inputFileName);
     bits = pbm_readpbm(ifP, &cols, &rows);
     pm_close(ifP);
-    checkSize(cols, rows);
+
+    validateSize(cols, rows);
 
     switch (cmdline.outputFormat) {
     case FMT_HEX_NGG:
diff --git a/converter/pbm/pbmtopk.c b/converter/pbm/pbmtopk.c
index b84818b1..a9683190 100644
--- a/converter/pbm/pbmtopk.c
+++ b/converter/pbm/pbmtopk.c
@@ -172,7 +172,7 @@ pbmtopk_add_suffix(char * const name,
     char *slash = strrchr(name, '/');
     char *dot = strrchr(name, '.');
 
-    if ((dot && slash ? dot < slash : !dot) && !STREQ(name, "-"))
+    if ((dot && slash ? dot < slash : !dot) && !streq(name, "-"))
         strcat(name, suffix);
 }
 
diff --git a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c
index eb45f11b..0051194c 100644
--- a/converter/pbm/pbmtoxbm.c
+++ b/converter/pbm/pbmtoxbm.c
@@ -130,7 +130,7 @@ generateName(char          const filenameArg[],
    "noname".  Also, if the argument is null or ends in a slash, we
    return "noname".
 -----------------------------------------------------------------------------*/
-    if (STREQ(filenameArg, "-"))
+    if (streq(filenameArg, "-"))
         *nameP = strdup("noname");
     else {
         int nameIndex, argIndex;
diff --git a/converter/pbm/pbmtozinc.c b/converter/pbm/pbmtozinc.c
index d39b71bc..2df39f0d 100644
--- a/converter/pbm/pbmtozinc.c
+++ b/converter/pbm/pbmtozinc.c
@@ -49,7 +49,7 @@ main(int argc, char * argv[]) {
 	{
         ifp = pm_openr( argv[1] );
         strcpy( name, argv[1] );
-        if ( STREQ( name, "-" ) )
+        if ( streq( name, "-" ) )
             strcpy( name, "noname" );
 
         if ( ( cp = strchr( name, '.' ) ) != 0 )
diff --git a/converter/pbm/pktopbm.c b/converter/pbm/pktopbm.c
index 32ed4fde..a3584ee5 100644
--- a/converter/pbm/pktopbm.c
+++ b/converter/pbm/pktopbm.c
@@ -50,7 +50,7 @@ pktopbm_add_suffix(char *       const name,
     char * const slash = strrchr(name, '/');
     char * const dot   = strrchr(name, '.');
     
-    if ((dot && slash ? dot < slash : !dot) && !STREQ(name, "-"))
+    if ((dot && slash ? dot < slash : !dot) && !streq(name, "-"))
         strcat(name, suffix);
 }
 
diff --git a/converter/pbm/xbmtopbm.c b/converter/pbm/xbmtopbm.c
index 63be16ef..135b79f1 100644
--- a/converter/pbm/xbmtopbm.c
+++ b/converter/pbm/xbmtopbm.c
@@ -80,10 +80,10 @@ parseWidthHeightLine(const char *   const line,
             type = underscorePos + 1;
         else
             type = nameAndType;
-        if (STREQ(type, "width")) {
+        if (streq(type, "width")) {
             *gotWidthP = TRUE;
             *widthP = value;
-        } else if (STREQ(type, "height")) {
+        } else if (streq(type, "height")) {
             *gotHeightP = TRUE;
             *heightP = value;
         }