summaryrefslogtreecommitdiff
path: root/libtiff/tif_luv.c
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-03-23 11:09:42 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-03-23 11:09:42 +0100
commit07f939bf59efb20057f18c5ae2d35c2ee0cca971 (patch)
treee3e2ccbeb641733762657507c24067a5787b08f4 /libtiff/tif_luv.c
parentdd2dfe1d6ac02fac7232888861d354dafc1d8e96 (diff)
downloadlibtiff-git-07f939bf59efb20057f18c5ae2d35c2ee0cca971.tar.gz
tif_luv.c: silence CoverityScan false positive. CID 1400231, 1400251, 1400254, 1400272, 1400318, 1400356
Diffstat (limited to 'libtiff/tif_luv.c')
-rw-r--r--libtiff/tif_luv.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c
index aa35ea07..192fa261 100644
--- a/libtiff/tif_luv.c
+++ b/libtiff/tif_luv.c
@@ -742,9 +742,14 @@ LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
#undef exp2 /* Conflict with C'99 function */
#define exp2(x) exp(M_LN2*(x))
-#define itrunc(x,m) ((m)==SGILOGENCODE_NODITHER ? \
- (int)(x) : \
- (int)((x) + rand()*(1./RAND_MAX) - .5))
+static int itrunc(double x, int m)
+{
+ if( m == SGILOGENCODE_NODITHER )
+ return (int)x;
+ /* Silence CoverityScan warning about bad crypto function */
+ /* coverity[dont_call] */
+ return (int)(x + rand()*(1./RAND_MAX) - .5);
+}
#if !LOGLUV_PUBLIC
static