about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-12-05 04:36:00 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-12-05 04:36:00 +0000
commit823be2c11c870129aac78e7c9a62b83b8d9a3f33 (patch)
tree89e50aedd78b95e38eaa221ab2161c6a914dbfb6
parent896a26371189fe2a394f9b0a1fc9c6e684b56c19 (diff)
downloadnetpbm-mirror-823be2c11c870129aac78e7c9a62b83b8d9a3f33.tar.gz
netpbm-mirror-823be2c11c870129aac78e7c9a62b83b8d9a3f33.tar.xz
netpbm-mirror-823be2c11c870129aac78e7c9a62b83b8d9a3f33.zip
Fix integer promotion mess
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1801 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--doc/HISTORY9
-rw-r--r--generator/ppmpat.c4
2 files changed, 8 insertions, 5 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 7820af61..e0ef10bd 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -18,6 +18,9 @@ not yet  BJH  Release 10.61.00
               pamtotiff: fix bug: XRESOLUTION, YRESOLUTION, and RESOLUTIONUNIT
               not allowed in -tags.  Broken at least since 10.35.
 
+              pnmpsnr: fix crash when invoked (invalidly) with only one
+              argument.  Always broken.
+
               pnmmontage: fix totally wrong output.  Broken in 10.44
               (August 2008).
 
@@ -25,9 +28,6 @@ not yet  BJH  Release 10.61.00
               output image.  Always broken (program was new in 9.10 (January
               2001).
 
-              pnmpsnr: fix crash when invoked (invalidly) with only one
-              argument.  Always broken.
-
               pbmpscale, pgmhist, pampick, pamtompfont: fix wild pointer
               in command line parsing.  Bug has always been there in 
               pampick, pamtompfont, since 10.50 (March 2010) in pbmpscale,
@@ -42,6 +42,9 @@ not yet  BJH  Release 10.61.00
               pamgauss: Fix bug: erroneously says -maxval is too big on 64 bit
               system.  Always broken (Pamgauss was added in 10.23 (July 2004).
 
+              ppmpat: Fix bug: wrong output with -poles.  Broken in 10.47
+              (June 2009).
+
               Add tests.  Thanks Prophet of the Way <afu@wta.att.ne.jp>.
 
 12.09.30 BJH  Release 10.60.00
diff --git a/generator/ppmpat.c b/generator/ppmpat.c
index 100b4978..2e8092b3 100644
--- a/generator/ppmpat.c
+++ b/generator/ppmpat.c
@@ -843,8 +843,8 @@ poles(pixel **     const pixels,
             dist1 = dist2 = (SQR((double)cols) + SQR((double)rows));
             for (i = 0; i < poleCt; ++i) {
                 double const newdist =
-                    (double)(col - xs[i]) * (col - xs[i]) +
-                    (double)(row - ys[i]) * (row - ys[i]);
+                    (double)((int)col - xs[i]) * ((int)col - xs[i]) +
+                    (double)((int)row - ys[i]) * ((int)row - ys[i]);
                 if (newdist < dist1) {
                     dist2  = dist1;
                     color2 = color1;