about summary refs log tree commit diff
path: root/converter/other/pnmtops.c
diff options
context:
space:
mode:
Diffstat (limited to 'converter/other/pnmtops.c')
-rw-r--r--converter/other/pnmtops.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c
index 45d856d0..3dd0be79 100644
--- a/converter/other/pnmtops.c
+++ b/converter/other/pnmtops.c
@@ -9,7 +9,7 @@
 
          We use methods we learned from Dirk Krause's program Bmeps.
          Previous versions used raster encoding code based on Bmeps
-         code.  This program does not used any code from Bmeps.
+         code.  This program does not use any code from Bmeps.
 
       2) Use our own filters and redefine /readstring .  This is aboriginal
          Netpbm code, from when Postscript was young.  The filters are
@@ -58,6 +58,10 @@
 
 
 
+unsigned int const psScaleFactor = 72;
+
+
+
 static void
 setSignals() {
 /*----------------------------------------------------------------------------
@@ -260,7 +264,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;
     opt.allowNegNum = FALSE;
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
 
     if (cmdlineP->mustturn && noturn)
         pm_error("You cannot specify both -turn and -noturn");
@@ -291,21 +295,21 @@ parseCommandLine(int argc, const char ** argv,
     cmdlineP->canturn =  !noturn;
     cmdlineP->showpage = !noshowpage;
 
-    validateCompDimension(width, 72, "-width value");
-    validateCompDimension(height, 72, "-height value");
+    validateCompDimension(width,  psScaleFactor, "-width value");
+    validateCompDimension(height, psScaleFactor, "-height value");
 
-    cmdlineP->width  = width * 72;
-    cmdlineP->height = height * 72;
+    cmdlineP->width  = width  * psScaleFactor;
+    cmdlineP->height = height * psScaleFactor;
 
     if (imagewidthSpec) {
-        validateCompDimension(imagewidth, 72, "-imagewidth value");
-        cmdlineP->imagewidth = imagewidth * 72;
+        validateCompDimension(imagewidth, psScaleFactor, "-imagewidth value");
+        cmdlineP->imagewidth = imagewidth * psScaleFactor;
     }
     else
         cmdlineP->imagewidth = 0;
     if (imageheightSpec) {
-        validateCompDimension(imagewidth, 72, "-imageheight value");
-        cmdlineP->imageheight = imageheight * 72;
+        validateCompDimension(imagewidth, psScaleFactor, "-imageheight value");
+        cmdlineP->imageheight = imageheight * psScaleFactor;
     }
     else
         cmdlineP->imageheight = 0;
@@ -1012,8 +1016,8 @@ validateComputableBoundingBox(float const scols,
     float const bbWidth  = llx + scols + 0.5;
     float const bbHeight = lly + srows + 0.5;
 
-    if (bbHeight < INT_MIN || bbHeight > INT_MAX ||
-        bbWidth  < INT_MIN || bbWidth  > INT_MAX)
+    if ((double)bbHeight < INT_MIN || (double)bbHeight > INT_MAX ||
+        (double)bbWidth  < INT_MIN || (double)bbWidth  > INT_MAX)
         pm_error("Bounding box dimensions %.1f x %.1f are too large "
                  "for computations.  "
                  "This probably means input image width, height, "
@@ -1268,7 +1272,7 @@ putFilters(unsigned int const postscriptLevel,
     assert(postscriptLevel > 1);
 
     /* We say to decode flate, then rle, so Caller must ensure it encodes
-       rel, then flate.
+       rle, then flate.
     */
 
     if (ascii85)