diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-11-12 03:03:18 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-11-12 03:03:18 +0100 |
commit | 7ca42663e0ff492be6c5bdf0f9168b47302fd22c (patch) | |
tree | fecbb3995db1543ef5334933cbe70c5e7c125503 /src/3rdparty/libtiff/libtiff/tif_luv.c | |
parent | 0d150412b607680ea6ce79baf60c2d2709d5f057 (diff) | |
parent | 3d157f9773a2db1a3096a86e5170ace975646ca3 (diff) | |
download | qtimageformats-7ca42663e0ff492be6c5bdf0f9168b47302fd22c.tar.gz |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I48926bf0b3f2dac7806ff30e06e5e317c7fe018c
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_luv.c')
-rw-r--r-- | src/3rdparty/libtiff/libtiff/tif_luv.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_luv.c b/src/3rdparty/libtiff/libtiff/tif_luv.c index 46d2dff..6fe4858 100644 --- a/src/3rdparty/libtiff/libtiff/tif_luv.c +++ b/src/3rdparty/libtiff/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 @@ -1501,7 +1506,7 @@ LogLuvSetupEncode(TIFF* tif) switch (td->td_photometric) { case PHOTOMETRIC_LOGLUV: if (!LogLuvInitState(tif)) - break; + return (0); if (td->td_compression == COMPRESSION_SGILOG24) { tif->tif_encoderow = LogLuvEncode24; switch (sp->user_datafmt) { @@ -1534,7 +1539,7 @@ LogLuvSetupEncode(TIFF* tif) break; case PHOTOMETRIC_LOGL: if (!LogL16InitState(tif)) - break; + return (0); tif->tif_encoderow = LogL16Encode; switch (sp->user_datafmt) { case SGILOGDATAFMT_FLOAT: @@ -1550,7 +1555,7 @@ LogLuvSetupEncode(TIFF* tif) TIFFErrorExt(tif->tif_clientdata, module, "Inappropriate photometric interpretation %d for SGILog compression; %s", td->td_photometric, "must be either LogLUV or LogL"); - break; + return (0); } sp->encoder_state = 1; return (1); |