about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-11-28 17:54:01 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2021-11-28 17:54:01 +0000
commit3c556d3931167936ef5bfb3ba1ff569049aa1b87 (patch)
treeb7215cc36a6db1b7eb347de3bbd108ee25b02ac4
parent69159a2344b68080541b98d448fb1b44d149930c (diff)
downloadnetpbm-mirror-3c556d3931167936ef5bfb3ba1ff569049aa1b87.tar.gz
netpbm-mirror-3c556d3931167936ef5bfb3ba1ff569049aa1b87.tar.xz
netpbm-mirror-3c556d3931167936ef5bfb3ba1ff569049aa1b87.zip
Release 10.96.04
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4199 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/pnmtopalm/palmtopnm.c22
-rw-r--r--doc/HISTORY6
-rw-r--r--version.mk2
3 files changed, 19 insertions, 11 deletions
diff --git a/converter/other/pnmtopalm/palmtopnm.c b/converter/other/pnmtopalm/palmtopnm.c
index 445f7839..a2c644b7 100644
--- a/converter/other/pnmtopalm/palmtopnm.c
+++ b/converter/other/pnmtopalm/palmtopnm.c
@@ -825,11 +825,12 @@ readPackBitsRow16(FILE *          const ifP,
     unsigned int j;
 
     for (j = 0;  j < bytesPerRow; ) {
-        char incount;
-        pm_readchar(ifP, &incount);
-        if (incount < 0) {
+        unsigned char incountByte;
+        pm_readcharu(ifP, &incountByte);
+        if (incountByte & 0x80) {
+            int const signedIncount = (signed char)incountByte;
             /* How do we handle incount == -128 ? */
-            unsigned int const runlength = (-incount + 1) * 2;
+            unsigned int const runlength = (-signedIncount + 1) * 2;
             unsigned int k;
             unsigned short inval;
             pm_readlittleshortu(ifP, &inval);
@@ -840,7 +841,7 @@ readPackBitsRow16(FILE *          const ifP,
             j += runlength;
         } else {
             /* We just read the stream of shorts as a stream of chars */
-            unsigned int const nonrunlength = (incount + 1) * 2;
+            unsigned int const nonrunlength = (incountByte + 1) * 2;
             unsigned int k;
             for (k = 0; (k < nonrunlength) && (j + k <= bytesPerRow); ++k) {
                 unsigned char inval;
@@ -868,18 +869,19 @@ readPackBitsRow(FILE *          const ifP,
     unsigned int j;
 
     for (j = 0;  j < bytesPerRow; ) {
-        char incount;
-        pm_readchar(ifP, &incount);
-        if (incount < 0) {
+        unsigned char incountByte;
+        pm_readcharu(ifP, &incountByte);
+        if (incountByte & 0x80) {
             /* How do we handle incount == -128 ? */
-            unsigned int const runlength = -incount + 1;
+            int const signedIncount = (char)incountByte;
+            unsigned int const runlength = -signedIncount + 1;
             unsigned char inval;
             pm_readcharu(ifP, &inval);
             if (j + runlength <= bytesPerRow)
                 memset(palmrow + j, inval, runlength);
             j += runlength;
         } else {
-            unsigned int const nonrunlength = incount + 1;
+            unsigned int const nonrunlength = incountByte + 1;
             unsigned int k;
             for (k = 0; k < nonrunlength && j + k <= bytesPerRow; ++k) {
                 unsigned char inval;
diff --git a/doc/HISTORY b/doc/HISTORY
index dcdf908f..b658c0ed 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,12 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+21.11.28 BJH  Release 10.96.04
+
+              palmtopnm: Fix bug: fails with PackBits input on platform with
+              default unsigned char, such as ppc64.  Always broken.  (Ability
+              to convert PackBits input was new in Netpbm 10.27 (March 2005).
+              
 21.11.07 BJH  Release 10.96.03
 
               sunicontopnm, escp2topbm, mgrtopbm, ybmtopbm, pamcut, pbmpscale,
diff --git a/version.mk b/version.mk
index 2e335a82..3c785ffc 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 96
-NETPBM_POINT_RELEASE = 3
+NETPBM_POINT_RELEASE = 4