about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--analyzer/pgmhist.c6
-rw-r--r--analyzer/pnmpsnr.c2
-rw-r--r--converter/other/pamtompfont.c2
-rw-r--r--converter/other/pamtotiff.c3
-rw-r--r--doc/HISTORY20
-rw-r--r--editor/pbmpscale.c2
-rw-r--r--editor/pnmmontage.c27
-rw-r--r--other/pampick.c1
-rw-r--r--version.mk2
9 files changed, 53 insertions, 12 deletions
diff --git a/analyzer/pgmhist.c b/analyzer/pgmhist.c
index 5db1c0e6..fc55b1a7 100644
--- a/analyzer/pgmhist.c
+++ b/analyzer/pgmhist.c
@@ -40,9 +40,11 @@ parseCommandLine(int argc, const char ** argv,
     optEntry * option_def;
     unsigned int option_def_index;
     
-    MALLOCARRAY(option_def, 100);
+    MALLOCARRAY_NOFAIL(option_def, 100);
 
-    option_def_index = 0;   /* incremented by OPTENTRY */
+    option_def_index = 0;   /* incremented by OPTENT3 */
+
+    OPTENTINIT;
 
     opt.opt_table = option_def;
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
diff --git a/analyzer/pnmpsnr.c b/analyzer/pnmpsnr.c
index c32f7d64..1160fff6 100644
--- a/analyzer/pnmpsnr.c
+++ b/analyzer/pnmpsnr.c
@@ -150,7 +150,7 @@ main (int argc, char **argv) {
     
     pnm_init(&argc, argv);
 
-    if (argc < 2) 
+    if (argc-1 < 2) 
         pm_error("Takes two arguments:  specifications of the two files.");
     else {
         filespec1 = argv[1];
diff --git a/converter/other/pamtompfont.c b/converter/other/pamtompfont.c
index db5fc633..7de6396c 100644
--- a/converter/other/pamtompfont.c
+++ b/converter/other/pamtompfont.c
@@ -53,6 +53,8 @@ parseCommandLine(int argc, char ** argv,
 
     option_def_index = 0;   /* incremented by OPTENTRY */
 
+    OPTENTINIT;
+
     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 */
diff --git a/converter/other/pamtotiff.c b/converter/other/pamtotiff.c
index 2082b3bd..1c4666fa 100644
--- a/converter/other/pamtotiff.c
+++ b/converter/other/pamtotiff.c
@@ -120,9 +120,6 @@ validateTagList(struct optNameValue const taglist[]) {
             case TIFFTAG_ROWSPERSTRIP:
             case TIFFTAG_PLANARCONFIG:
             case TIFFTAG_COLORMAP:
-            case TIFFTAG_RESOLUTIONUNIT:
-            case TIFFTAG_XRESOLUTION:
-            case TIFFTAG_YRESOLUTION:
                 pm_error("You cannot specify a '%s' tag with -tag.  "
                          "Pamtotiff controls that internally or via other "
                          "options.", tagName);
diff --git a/doc/HISTORY b/doc/HISTORY
index 071470d7..feefe9e6 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,26 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+12.12.04 BJH  Release 10.60.04
+
+              pamtotiff: fix bug: XRESOLUTION, YRESOLUTION, and RESOLUTIONUNIT
+              not allowed in -tags.  Broken at least since 10.35.
+
+              pnmmontage: fix totally wrong output.  Broken in 10.44
+              (August 2008).
+
+              pnmmontage: fix random stuff placed in unoccupied space in the
+              output image.  Always broken (program was new in 9.10 (January
+              2001).
+
+              pnmpsnr: fix crash when invoked (invalidly) with only one
+              argument.  Always broken.
+
+              pbmpscale, pgmhist, pampick, pamtompfont: fix wild pointer
+              in command line parsing.  Bug has always been there in 
+              pampick, pamtompfont, since 10.50 (March 2010) in pbmpscale,
+              since 10.44 (September 2008) in pgmhist.              
+
 12.11.18 BJH  Release 10.60.03
 
               Xbmtopbm: fix incorrect output, memory leak.  Thanks Prophet of
diff --git a/editor/pbmpscale.c b/editor/pbmpscale.c
index e8a3f4c2..afe2bdd4 100644
--- a/editor/pbmpscale.c
+++ b/editor/pbmpscale.c
@@ -96,6 +96,8 @@ parseCommandLine(int argc, const char ** const argv,
 
     option_def_index = 0;   /* incremented by OPTENT3 */
 
+    OPTENTINIT;
+
     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 */
diff --git a/editor/pnmmontage.c b/editor/pnmmontage.c
index 77425760..8016fd77 100644
--- a/editor/pnmmontage.c
+++ b/editor/pnmmontage.c
@@ -108,7 +108,7 @@ parseCommandLine(int argc, const char ** argv,
             pm_error("Filename '%s' contains a \":\", which is forbidden "
                      "with -data", argv[i+1]);
         else
-            cmdlineP->inFileName[i] = strdup(argv[1+1]);
+            cmdlineP->inFileName[i] = strdup(argv[i+1]);
     }
 }
 
@@ -366,6 +366,21 @@ adjustMaxval(tuple *            const tuplerow,
 
 
 static void
+makeRowBlack(struct pam * const pamP,
+             tuple *      const tuplerow) {
+
+    unsigned int col;
+
+    for (col = 0; col < pamP->width; ++col) {
+        unsigned int plane;
+        for (plane = 0; plane < pamP->depth; ++plane)
+            tuplerow[col][plane] = 0;
+    }
+}
+
+
+
+static void
 writePam(struct pam *       const outpamP,
          unsigned int       const nfiles,
          const coord *      const coords,
@@ -380,6 +395,9 @@ writePam(struct pam *       const outpamP,
 
     for (i = 0; i < outpamP->height; ++i) {
         int j;
+
+        makeRowBlack(outpamP, tuplerow);  /* initial value */
+
         for (j = 0; j < nfiles; ++j) {
             if (coords[j].y <= i && i < coords[j].y + imgs[j].height) {
                 pnm_readpamrow(&imgs[j], &tuplerow[coords[j].x]);
@@ -631,11 +649,10 @@ main(int argc, const char **argv) {
     pnm_setminallocationdepth(&outimg, outimg.depth);
 
     outimg.size = sizeof(outimg);
-    outimg.len = sizeof(outimg);
+    outimg.len = PAM_STRUCT_SIZE(allocation_depth);
+    pnm_setminallocationdepth(&outimg, outimg.depth);
+    outimg.plainformat = false;
     outimg.file = stdout;
-    outimg.bytes_per_sample = 0;
-    for (i = outimg.maxval; i; i >>= 8)
-        ++outimg.bytes_per_sample;
  
     writePam(&outimg, nfiles, coords, imgs);
 
diff --git a/other/pampick.c b/other/pampick.c
index 8177cae1..5229502d 100644
--- a/other/pampick.c
+++ b/other/pampick.c
@@ -113,6 +113,7 @@ parseCommandLine(int argc, char ** argv,
        specifies an option.  But when we add an option in the future,
        it will go right here with an OPTENT3() macro invocation.
     */
+    OPTENTINIT;
 
     opt.opt_table = option_def;
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
diff --git a/version.mk b/version.mk
index a6c19b4f..8e12db7d 100644
--- a/version.mk
+++ b/version.mk
@@ -1,4 +1,4 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 60
-NETPBM_POINT_RELEASE = 3
+NETPBM_POINT_RELEASE = 4