about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-04-06 15:52:49 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-04-06 15:52:49 +0000
commit805d780d7b8808604f7f7ae42b78f39b2edbf106 (patch)
tree1f07c97d88d6715c0040d46c9314f3153fed1974
parent5c347cd98a0bffcf3a81498a5ab595377254da6d (diff)
downloadnetpbm-mirror-805d780d7b8808604f7f7ae42b78f39b2edbf106.tar.gz
netpbm-mirror-805d780d7b8808604f7f7ae42b78f39b2edbf106.tar.xz
netpbm-mirror-805d780d7b8808604f7f7ae42b78f39b2edbf106.zip
Fix more bugs with non-palette image due to special value of -1 for cmapsize changing to 0 in 10.54
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1468 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/ppm/ppmtobmp.c8
-rw-r--r--doc/HISTORY5
2 files changed, 7 insertions, 6 deletions
diff --git a/converter/ppm/ppmtobmp.c b/converter/ppm/ppmtobmp.c
index 684b3f22..7939b4d5 100644
--- a/converter/ppm/ppmtobmp.c
+++ b/converter/ppm/ppmtobmp.c
@@ -190,7 +190,7 @@ BMPwritefileheader(FILE *        const fp,
     PutByte(fp, 'M');
 
     /* cbSize */
-    PutLong(fp, BMPlenfile(class, bitcount, -1, x, y));
+    PutLong(fp, BMPlenfile(class, bitcount, 0, x, y));
     
     /* xHotSpot */
     PutShort(fp, 0);
@@ -199,7 +199,7 @@ BMPwritefileheader(FILE *        const fp,
     PutShort(fp, 0);
     
     /* offBits */
-    PutLong(fp, BMPoffbits(class, bitcount, -1));
+    PutLong(fp, BMPoffbits(class, bitcount, 0));
     
     return 14;
 }
@@ -510,7 +510,7 @@ bmpEncode(FILE *           const ifP,
 
     nbyte += BMPwritebits(ifP, x, y, colortype, bpp, pixels, maxval,
                           colorMapP->cht);
-    if (nbyte != BMPlenfile(class, bpp, -1, x, y))
+    if (nbyte != BMPlenfile(class, bpp, 0, x, y))
         pm_error(er_internal, "BmpEncode 2");
 }
 
@@ -581,7 +581,7 @@ bmpEncodePbm(FILE *           const ifP,
             nbyte += bytesWritten;
     }
 
-    if (nbyte != BMPlenfile(class, 1, -1, cols, rows))
+    if (nbyte != BMPlenfile(class, 1, 0, cols, rows))
         pm_error(er_internal, "bmpEncodePbm 2");
 }
 
diff --git a/doc/HISTORY b/doc/HISTORY
index cf65ec8c..42c8bb05 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -10,8 +10,9 @@ not yet  BJH  Release 10.55.00
               Standard Input from invoker's Standard Input when you don't
               supply a Standard Output accepter.  Broken in 10.40.00.
 
-              ppmtopbm: fix bug: crash ("internal error") on image without
-              palette (e.g. black and white).  Introduced in 10.54.
+              ppmtopbm: fix bug: crash ("internal error") or bogus failure or
+              incorrect output on image without palette (e.g. black and
+              white).  Introduced in 10.54.
 
               pnmtops: fix floating point exception or bogus width/height
               too large error.  Introduced in 10.53.