From 07f939bf59efb20057f18c5ae2d35c2ee0cca971 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 23 Mar 2019 11:09:42 +0100 Subject: tif_luv.c: silence CoverityScan false positive. CID 1400231, 1400251, 1400254, 1400272, 1400318, 1400356 --- libtiff/tif_luv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libtiff/tif_luv.c') 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 -- cgit v1.2.1