summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerouault <erouault>2015-08-31 15:05:57 +0000
committererouault <erouault>2015-08-31 15:05:57 +0000
commita09d7f2a0e34eb614e056e27c7c3f5eb8ec17edb (patch)
tree8111e07ffe08b454ce5126428af382e8c8b25727
parent25b030313f9b0fb838272ce88663c4f97d3d8b8d (diff)
downloadlibtiff-a09d7f2a0e34eb614e056e27c7c3f5eb8ec17edb.tar.gz
* libtiff/tif_predict.c: pedantic change to add explicit masking
with 0xff before casting to uchar in floating-point horizontal differencing and accumulation routines.
-rw-r--r--ChangeLog6
-rw-r--r--libtiff/tif_predict.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 5db95cf3..1933ae42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
2015-08-31 Even Rouault <even.rouault at spatialys.com>
+
+ * libtiff/tif_predict.c: pedantic change to add explicit masking
+ with 0xff before casting to uchar in floating-point horizontal
+ differencing and accumulation routines.
+
+2015-08-31 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_predict.c: fix generation of output with 16 bit
or 32 bit integer, when byte swapping is needed, in
diff --git a/libtiff/tif_predict.c b/libtiff/tif_predict.c
index b4fc5045..1388dde5 100644
--- a/libtiff/tif_predict.c
+++ b/libtiff/tif_predict.c
@@ -1,4 +1,4 @@
-/* $Id: tif_predict.c,v 1.34 2015-08-31 14:36:10 erouault Exp $ */
+/* $Id: tif_predict.c,v 1.35 2015-08-31 15:05:57 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -389,7 +389,8 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
return;
while (count > stride) {
- REPEAT4(stride, cp[stride] += cp[0]; cp++)
+ REPEAT4(stride, cp[stride] =
+ (unsigned char) ((cp[stride] + cp[0]) & 0xff); cp++)
count -= stride;
}
@@ -602,7 +603,7 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
cp = (uint8 *) cp0;
cp += cc - stride - 1;
for (count = cc; count > stride; count -= stride)
- REPEAT4(stride, cp[stride] -= cp[0]; cp--)
+ REPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--)
}
static int