about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile.version2
-rw-r--r--doc/HISTORY11
-rw-r--r--editor/pnmnlfilt.c7
-rw-r--r--generator/pbmtext.c23
-rw-r--r--lib/util/wordaccess_64_le.h2
5 files changed, 24 insertions, 21 deletions
diff --git a/Makefile.version b/Makefile.version
index 07f6baed..8f54448c 100644
--- a/Makefile.version
+++ b/Makefile.version
@@ -1,4 +1,4 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 41
-NETPBM_POINT_RELEASE = 01
+NETPBM_POINT_RELEASE = 02
 
diff --git a/doc/HISTORY b/doc/HISTORY
index 586915f6..e7baab07 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,17 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+08.01.31 BJH  Release 10.41.02
+
+              pnmnlfilt: fix internal error "impossible alpha value".
+
+              pbmtext: fail cleanly if input line is > 5000 characters.
+
+              pbmtext: fix negative -space .
+
+              Fix fast endianness stuff for 64 bit LE; bypass a compiler
+              bug that causes compile failure.
+
 08.01.15 BJH  Release 10.41.01
 
               pamundice: Fix bogus error about missing "-instem" option.
diff --git a/editor/pnmnlfilt.c b/editor/pnmnlfilt.c
index 1f8daac0..bde0cd82 100644
--- a/editor/pnmnlfilt.c
+++ b/editor/pnmnlfilt.c
@@ -133,7 +133,6 @@ int noisevariance;
 */
 static  xel *irows[3];
 static  xel *irow0, *irow1, *irow2, *orow;
-static  double radius=0.0,alpha= -1.0;
 static  int rows, cols, format, oformat, row, col;
 static  int (*atfunc)(int *);
 static  xelval maxval;
@@ -1011,7 +1010,7 @@ main(int argc, char *argv[]) {
     /* force output to max precision without forcing new 2-byte format */
     omaxval = MIN(maxval, PPM_MAXMAXVAL);
         
-    atfunc = atfuncs[atfilt_setup(alpha, radius,
+    atfunc = atfuncs[atfilt_setup(cmdline.alpha, cmdline.radius,
                                   (double)omaxval/(double)maxval)];
 
     if (oformat < PGM_TYPE) {
@@ -1030,10 +1029,6 @@ main(int argc, char *argv[]) {
     eof = FALSE;  /* We're already in the middle of the first image */
     imageSeq = 0;
     while (!eof) {
-        /* Set the ugly global variables, until we can fix this */
-        alpha = cmdline.alpha;
-        radius = cmdline.radius;
-
         do_one_frame(ifP);
         pm_nextimage(ifP, &eof);
         if (!eof) {
diff --git a/generator/pbmtext.c b/generator/pbmtext.c
index 2f4d18c7..e83f1b0c 100644
--- a/generator/pbmtext.c
+++ b/generator/pbmtext.c
@@ -304,10 +304,8 @@ get_line_dimensions(const char line[], const struct font * const font_p,
                 int full_pixels;  /* integer part of accumulated_ics */
                 accumulated_ics += intercharacter_space;
                 full_pixels = (int) accumulated_ics;
-                if (full_pixels > 0) {
-                    *bwid_p += full_pixels;
-                    accumulated_ics -= full_pixels;
-                }
+                *bwid_p += full_pixels;
+                accumulated_ics -= full_pixels;
             }
             lastGlyphP = glyphP;
             *bwid_p += glyphP->xadd;
@@ -506,13 +504,11 @@ placeCharacterInOutput(char                      const lastch,
                     cursorP->widthSoFar += fontP->glyph[glyphIndex]->x;
             } else {
                 /* handle extra intercharacter space (-space option) */
-                unsigned int fullPixels;  /* integer part of accumulatedIcs */
+                int fullPixels;  /* integer part of accumulatedIcs */
                 cursorP->accumulatedIcs += cursorP->intercharacterSpace;
                 fullPixels = (int) cursorP->accumulatedIcs;
-                if (fullPixels > 0) {
-                    cursorP->widthSoFar += fullPixels;
-                    cursorP->accumulatedIcs -= fullPixels;
-                }
+                cursorP->widthSoFar     += fullPixels;
+                cursorP->accumulatedIcs -= fullPixels;
             }
             cursorP->widthSoFar += fontP->glyph[glyphIndex]->xadd;
         }
@@ -615,10 +611,8 @@ truncateText(struct text   const inputText,
                     int fullPixels;  /* integer part of accumulatedIcs */
                     accumulatedIcs += intercharacterSpace;
                     fullPixels = (int) intercharacterSpace;
-                    if (fullPixels > 0) {
-                        widthSoFar += fullPixels;
-                        accumulatedIcs -= fullPixels;
-                    }
+                    widthSoFar     += fullPixels;
+                    accumulatedIcs -= fullPixels;
                 }
                 widthSoFar += fontP->glyph[lastch]->xadd;
             }
@@ -663,6 +657,9 @@ getText(const char          cmdline_text[],
         
         lineCount = 0;  /* initial value */
         while (fgets(buf, sizeof(buf), stdin) != NULL) {
+            if (strlen(buf) + 1 >= sizeof(buf))
+                pm_error("A line of input text is longer than %u characters."
+                         "Cannot process.", sizeof(buf)-1);
             fixControlChars(buf, fontP);
             if (lineCount >= maxlines) {
                 maxlines *= 2;
diff --git a/lib/util/wordaccess_64_le.h b/lib/util/wordaccess_64_le.h
index 83bbf2bf..ad316df2 100644
--- a/lib/util/wordaccess_64_le.h
+++ b/lib/util/wordaccess_64_le.h
@@ -46,7 +46,7 @@ wordintClz(wordint const x){
 
     /* Find the data type closest to 64 bits, and file off any extra. */
     else if ((s=sizeof(long int)) >= 8)
-        return (__builtin_clzl((int)x << (s - 8) * 8));
+        return (__builtin_clzl((long int)x << (s - 8) * 8));
     else if ((s=sizeof(long long int)) >= 8)
         return (__builtin_clzll((long long int)x << (s - 8) * 8));
     else