about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-12-15 02:24:20 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-12-15 02:24:20 +0000
commitc85e6aae67d557791c2e15992d2df2839a5d0bf6 (patch)
tree66af91c1da371c2c3395e454f95a8b1ff6b28af4
parent2b622324b146ce341c82ed384e3fff286ebfce11 (diff)
downloadnetpbm-mirror-c85e6aae67d557791c2e15992d2df2839a5d0bf6.tar.gz
netpbm-mirror-c85e6aae67d557791c2e15992d2df2839a5d0bf6.tar.xz
netpbm-mirror-c85e6aae67d557791c2e15992d2df2839a5d0bf6.zip
Release 10.47.48
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@2062 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/pbm/pbmtoepsi.c22
-rw-r--r--doc/HISTORY15
-rw-r--r--editor/pnmshear.c7
-rw-r--r--generator/ppmpat.c18
-rw-r--r--version.mk2
5 files changed, 56 insertions, 8 deletions
diff --git a/converter/pbm/pbmtoepsi.c b/converter/pbm/pbmtoepsi.c
index b770a7c4..5eccc298 100644
--- a/converter/pbm/pbmtoepsi.c
+++ b/converter/pbm/pbmtoepsi.c
@@ -151,6 +151,13 @@ findPrincipalImage(bit ** const bits,
             }
         }
     }
+
+    if(bottom == -MAXINT) {  /* No black pixels encountered */ 
+        pm_message("Blank page");
+        top = left = 0;
+        bottom = rows-1;  right = cols-1;
+	}
+
     *topP = top;
     *bottomP = bottom;
     *leftP = left;
@@ -238,13 +245,20 @@ main(int argc, char * argv[]) {
 
         for (row = top; row <= bottom; row++) {
             int col;
+	    int outChars = 2;
+	    printf("%% ");
 
-            printf("%% ");
+            for (col = left; col <= right; col += 8) {
+                if (outChars == 72) {
+		  printf("\n%% ");
+                  outChars = 2;
+		}  
 
-            for (col = left; col <= right; col += 8) 
                 printf("%02x", eightPixels(bits, row, col, cols));
-
-            printf("\n");
+                outChars += 2;
+	    }
+	    if (outChars > 0)
+                printf("\n");
         }
         printf("%%%%EndImage\n");
         printf("%%%%EndPreview\n");
diff --git a/doc/HISTORY b/doc/HISTORY
index 94b4d3b1..e627a5e6 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,21 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+13.12.15 BJH  Release 10.47.48
+
+              pbmtoepsi: fix handling of all-white image.  Always broken.
+              Thanks Prophet of the Way <afu@wta.att.ne.jp>.
+
+              pbmtoepsi: fix excessively long raster line.  Always broken.
+              Thanks Prophet of the Way <afu@wta.att.ne.jp>.
+
+              pnmshear: fix incorrect determination of background color.
+              Always broken.
+
+              ppmpat: fix crash with -squig with aspect ratio < 1:25 or
+              > 25:1. Thanks Prophet of the Way <afu@wta.att.ne.jp>.
+              Always broken.
+
 13.12.03 BJH  Release 10.47.47
 
               Fix wild pointer dereference when memory allocation for a string
diff --git a/editor/pnmshear.c b/editor/pnmshear.c
index d85658e5..359df299 100644
--- a/editor/pnmshear.c
+++ b/editor/pnmshear.c
@@ -241,14 +241,15 @@ main(int argc, char * argv[]) {
     pnm_writepnminit(stdout, newcols, rows, newmaxval, newformat, 0);
     newxelrow = pnm_allocrow(newcols);
     
-    bgxel = backgroundColor(cmdline.background, xelrow, cols, newmaxval,
-                            format);
-
     for (row = 0; row < rows; ++row) {
         double shearCols;
 
         pnm_readpnmrow(ifP, xelrow, cols, newmaxval, format);
 
+        if (row == 0)
+            bgxel = backgroundColor(cmdline.background,
+                                    xelrow, cols, newmaxval, format);
+
         if (cmdline.angle > 0.0)
             shearCols = row * shearfac;
         else
diff --git a/generator/ppmpat.c b/generator/ppmpat.c
index 09d90815..772fa51d 100644
--- a/generator/ppmpat.c
+++ b/generator/ppmpat.c
@@ -862,6 +862,19 @@ static ppmd_point sq_offs[SQ_MAXCIRCLE_POINTS];
 
 
 
+static void
+validateSquigAspect(unsigned int const cols,
+                    unsigned int const rows) {
+
+    if (cols / rows >= 25 || rows / cols >= 25)
+        pm_error("Image too narrow.  Aspect ratio: %u/%u=%f "
+                 "is outside accepted range: 0.04 - 25.0",
+                 cols, rows, (float)cols/rows ); 
+
+}
+
+
+
 static ppmd_point
 vectorSum(ppmd_point const a,
           ppmd_point const b) {
@@ -1066,6 +1079,8 @@ squig(pixel **     const pixels,
       pixval       const maxval) {
 
     int i;
+
+    validateSquigAspect(cols, rows);
     
     clearImageToBlack(pixels, cols, rows, maxval);
 
@@ -1091,6 +1106,9 @@ squig(pixel **     const pixels,
             unsigned int j;
 
             for (j = 1; j < SQ_POINTS - 1; ++j) {
+              /* validateSquigAspect() assures that
+                 cols - 2 * radius, rows -2 * radius are positive
+              */
                 c[j].x = (rand() % (cols - 2 * radius)) + radius;
                 c[j].y = (rand() % (rows - 2 * radius)) + radius;
             }
diff --git a/version.mk b/version.mk
index 6176226f..cc9af0bc 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 47
-NETPBM_POINT_RELEASE = 47
+NETPBM_POINT_RELEASE = 48