about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2010-05-31 16:43:28 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2010-05-31 16:43:28 +0000
commit184129a8bf5d3a4260564422b6a57ad076718004 (patch)
tree98c73b8e3523c92cf12e3d7960449107a507fc09
parent6cf2bd8716116d0f75d5d37e1c46372b5657c154 (diff)
downloadnetpbm-mirror-184129a8bf5d3a4260564422b6a57ad076718004.tar.gz
netpbm-mirror-184129a8bf5d3a4260564422b6a57ad076718004.tar.xz
netpbm-mirror-184129a8bf5d3a4260564422b6a57ad076718004.zip
Release 10.35.75
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@1232 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--Makefile.version2
-rwxr-xr-xbuildtools/configure.pl32
-rw-r--r--converter/other/pnmtopalm/palmtopnm.c67
-rw-r--r--doc/HISTORY11
-rw-r--r--editor/pamscale.c1
5 files changed, 90 insertions, 23 deletions
diff --git a/Makefile.version b/Makefile.version
index 126423fb..ca1c436d 100644
--- a/Makefile.version
+++ b/Makefile.version
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 35
-NETPBM_POINT_RELEASE = 74
+NETPBM_POINT_RELEASE = 75
diff --git a/buildtools/configure.pl b/buildtools/configure.pl
index 2f301ab7..4089596a 100755
--- a/buildtools/configure.pl
+++ b/buildtools/configure.pl
@@ -1054,27 +1054,27 @@ sub getLinuxsvgaLibrary($@) {
     my ($svgalib, $svgalibhdr_dir);
 
     if ($platform eq "GNU") {
-        {
-            my $default;
+        my $default;
 
-            if (-d('/usr/link/svgalib')) {
-                $default = '/usr/link/svgalib/libvga.so';
-            } elsif (-d('/usr/lib/svgalib')) {
-                $default = '/usr/lib/svgalib/libvga.so';
-            } else {
-                $default = 'libvga.so';
-            }
-            
-            print("What is your Svgalib library?\n");
+        if (-d('/usr/link/svgalib')) {
+            $default = '/usr/link/svgalib/libvga.so';
+        } elsif (-d('/usr/lib/svgalib')) {
+            $default = '/usr/lib/svgalib/libvga.so';
+        } elsif (system('ldconfig -p | grep libvga &>/dev/null') == 0) {
+            $default = 'libvga.so';
+        } else {
+            $default = 'none';
+        }
             
-            my $response = prompt("library filename or 'none'", $default);
+        print("What is your Svgalib library?\n");
+        
+        my $response = prompt("library filename or 'none'", $default);
             
-            if ($response ne "none") {
-                $svgalib = $response;
-            }
+        if ($response ne 'none') {
+            $svgalib = $response;
         }
     }
-    if (defined($svgalib)) {
+    if (defined($svgalib) && $svgalib ne 'none') {
         my $default;
         
         if (-d('/usr/include/svgalib')) {
diff --git a/converter/other/pnmtopalm/palmtopnm.c b/converter/other/pnmtopalm/palmtopnm.c
index f2febef1..82d1f6fb 100644
--- a/converter/other/pnmtopalm/palmtopnm.c
+++ b/converter/other/pnmtopalm/palmtopnm.c
@@ -788,8 +788,8 @@ readRleRow(FILE *          const ifP,
         if (j + incount > bytesPerRow)
             pm_error("Bytes in RLE compressed row exceed bytes per row.  "
                      "Bytes per row is %u.  A run length of %u bytes "
-                     "pushes the bytes in this row up to %u bytes (and then"
-                     "we gave up.", bytesPerRow, incount, j + incount);
+                     "pushes the bytes in this row up to %u bytes (and then "
+                     "we gave up).", bytesPerRow, incount, j + incount);
         pm_readcharu(ifP, &inval);
         memset(palmrow + j, inval, incount);
         j += incount;
@@ -799,6 +799,52 @@ readRleRow(FILE *          const ifP,
 
 
 static void
+readPackBitsRow16(FILE *          const ifP,
+                  unsigned char * const palmrow,
+                  unsigned int    const bytesPerRow) {
+
+    /*  From the Palm OS Programmer's API Reference:
+  
+        Although the [...] spec is byte-oriented, the 16-bit algorithm is
+        identical [to the 8-bit algorithm]: just substitute "word" for "byte".
+    */
+    unsigned int j;
+
+    for (j = 0;  j < bytesPerRow; ) {
+        char incount;
+        pm_readchar(ifP, &incount);
+        if (incount < 0) { 
+            /* How do we handle incount == -128 ? */
+            unsigned int const runlength = (-incount + 1) * 2;
+            unsigned int k;
+            unsigned short inval;
+            pm_readlittleshortu(ifP, &inval);
+            for (k = 0; (k < runlength) && (j + k + 1 < bytesPerRow); k += 2) {
+                memcpy(palmrow + j + k, &inval, 2);
+            }
+            j += runlength;
+        } else {
+            /* We just read the stream of shorts as a stream of chars */
+            unsigned int const nonrunlength = (incount + 1) * 2;
+            unsigned int k;
+            for (k = 0; (k < nonrunlength) && (j + k < bytesPerRow); ++k) {
+                unsigned char inval;
+                pm_readcharu(ifP, &inval);
+                palmrow[j + k] = inval;
+            }
+            j += nonrunlength;
+        }
+        if (j > bytesPerRow) 
+            pm_error("Bytes in PackBits compressed row exceed bytes per row.  "
+                     "Bytes per row is %u.  "
+                     "The bytes in this row were pushed up to %u bytes "
+                     "(and then we gave up).", bytesPerRow, j);
+    }
+} 
+
+
+
+static void
 readPackBitsRow(FILE *          const ifP,
                 unsigned char * const palmrow,
                 unsigned int    const bytesPerRow) {
@@ -813,12 +859,13 @@ readPackBitsRow(FILE *          const ifP,
             unsigned int const runlength = -incount + 1;
             unsigned char inval;
             pm_readcharu(ifP, &inval);
-            memset(palmrow + j, inval, runlength);
+            if (j + runlength < bytesPerRow) 
+                memset(palmrow + j, inval, runlength);
             j += runlength;
         } else {
             unsigned int const nonrunlength = incount + 1;
             unsigned int k;
-            for (k = 0; k < nonrunlength; ++k) {
+            for (k = 0; k < nonrunlength && j + k < bytesPerRow; ++k) {
                 unsigned char inval;
                 pm_readcharu(ifP, &inval);
                 palmrow[j + k] = inval;
@@ -826,7 +873,10 @@ readPackBitsRow(FILE *          const ifP,
             j += nonrunlength;
         }
         if (j > bytesPerRow) 
-            pm_error("Bytes in PackBits compressed row exceed bytes per row.");
+            pm_error("Bytes in PackBits compressed row exceed bytes per row.  "
+                     "Bytes per row is %u.  "
+                     "The bytes in this row were pushed up to %u bytes "
+                     "(and then we gave up).", bytesPerRow, j);
     }
 } 
 
@@ -852,6 +902,7 @@ readDecompressedRow(FILE *                   const ifP,
                     unsigned char *          const lastrow,
                     enum palmCompressionType const compressionType,
                     unsigned int             const bytesPerRow,
+                    unsigned int             const pixelSize,
                     bool                     const firstRow) {
 /*----------------------------------------------------------------------------
    Read a row from Palm file 'ifP', in uncompressed form (i.e. decompress if
@@ -880,7 +931,10 @@ readDecompressedRow(FILE *                   const ifP,
         readScanlineRow(ifP, palmrow, lastrow, bytesPerRow, firstRow);
         break;
     case COMPRESSION_PACKBITS:
-        readPackBitsRow(ifP, palmrow, bytesPerRow);
+        if (pixelSize != 16)
+            readPackBitsRow(ifP, palmrow, bytesPerRow);
+        else
+            readPackBitsRow16(ifP, palmrow, bytesPerRow);
         break;
     case COMPRESSION_NONE:
         readUncompressedRow(ifP, palmrow, bytesPerRow);
@@ -1031,6 +1085,7 @@ writePnm(FILE *            const ofP,
         readDecompressedRow(ifP, palmrow, lastrow, 
                             palmHeader.compressionType, 
                             palmHeader.bytesPerRow,
+                            palmHeader.pixelSize,
                             row == 0);
 
         if (palmHeader.directColor) {
diff --git a/doc/HISTORY b/doc/HISTORY
index 350c4332..f2b3ae98 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,17 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+10.05.31 BJH  Release 10.35.75
+
+              palmtopnm: fix for pixel size 16.  Thanks Paul Bolle
+              <pebolle@tiscali.nl>.
+
+              pamscale: fix -reduce.  Introduced in 10.27.
+
+              configure: default to 'none' for Svgalib if it doesn't appear to
+              be installed (per 'ldconfig').  Ported from 10.38, released
+              March 2007.
+
 10.03.24 BJH  Release 10.35.74
 
               pbmtext: don't crash when font file contains a blank line.
diff --git a/editor/pamscale.c b/editor/pamscale.c
index 94f67414..5136c2cd 100644
--- a/editor/pamscale.c
+++ b/editor/pamscale.c
@@ -683,6 +683,7 @@ parseCommandLine(int argc,
     } else if (reduce != -1) {
         cmdlineP->scaleType = SCALE_SEPARATE;
         parseFilespecOnlyParms(argc, argv, cmdlineP);
+        cmdlineP->xsize = cmdlineP->ysize = 0;
         cmdlineP->xscale = cmdlineP->yscale = 
             ((double) 1.0) / ((double) reduce);
         pm_message("reducing by %d gives scale factor of %f.",