about summary refs log tree commit diff
path: root/editor/pamcat.c
diff options
context:
space:
mode:
Diffstat (limited to 'editor/pamcat.c')
-rw-r--r--editor/pamcat.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/editor/pamcat.c b/editor/pamcat.c
index d8f6613e..bb0a6891 100644
--- a/editor/pamcat.c
+++ b/editor/pamcat.c
@@ -643,6 +643,8 @@ padPlanesRow(enum PlanePadMethod const planePadMethod,
 -----------------------------------------------------------------------------*/
     unsigned int plane;
 
+    assert(inpamP->allocation_depth >= outpamP->depth);
+
     for (plane = inpamP->depth; plane < outpamP->depth; ++plane) {
         unsigned int col;
 
@@ -1053,7 +1055,7 @@ main(int           argc,
 
     for (i = 0; i < cmdline.fileCt; ++i) {
         FILE * const ifP = pm_openr(cmdline.inputFileName[i]);
-        pnm_readpaminit(ifP, &inpam[i], PAM_STRUCT_SIZE(tuple_type));
+        pnm_readpaminit(ifP, &inpam[i], PAM_STRUCT_SIZE(allocation_depth));
     }
 
     outpam.file = stdout;
@@ -1061,6 +1063,9 @@ main(int           argc,
     computeOutputParms(cmdline.fileCt, cmdline.orientation, inpam,
                        cmdline.verbose, &outpam);
 
+    for (i = 0; i < cmdline.fileCt; ++i)
+        pnm_setminallocationdepth(&inpam[i], outpam.depth);
+
     pnm_writepaminit(&outpam);
 
     if (outpam.format == RPBM_FORMAT) {