From 1fa253ba635707db657b68370d2fc1a555e8d6ff Mon Sep 17 00:00:00 2001 From: heckflosse Date: Fri, 16 Nov 2018 20:48:33 +0100 Subject: [PATCH] Fix some issues reported by coverity --- rtengine/FTblockDN.cc | 4 ++-- rtengine/image16.cc | 2 +- rtengine/image16.h | 2 +- rtengine/image8.cc | 2 +- rtengine/image8.h | 2 +- rtengine/imagefloat.cc | 2 +- rtengine/imagefloat.h | 2 +- rtengine/imageio.h | 2 +- rtengine/imagesource.h | 2 +- rtengine/rawimagesource.cc | 6 +++--- rtengine/rawimagesource.h | 2 +- rtengine/stdimagesource.cc | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 8ced521d3..dfab72089 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -807,8 +807,8 @@ BENCHFUN #endif const std::size_t blox_array_size = denoiseNestedLevels * numthreads; - float *LbloxArray[blox_array_size]; - float *fLbloxArray[blox_array_size]; + float *LbloxArray[blox_array_size] = {}; + float *fLbloxArray[blox_array_size] = {}; for (std::size_t i = 0; i < blox_array_size; ++i) { LbloxArray[i] = nullptr; diff --git a/rtengine/image16.cc b/rtengine/image16.cc index c014d1c06..5ceb4f804 100644 --- a/rtengine/image16.cc +++ b/rtengine/image16.cc @@ -132,7 +132,7 @@ Image16* Image16::copy() return cp; } -void Image16::getStdImage(ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, bool first, procparams::ToneCurveParams hrp) +void Image16::getStdImage(ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp) { // compute channel multipliers diff --git a/rtengine/image16.h b/rtengine/image16.h index 1c5504bd9..804f8cc72 100644 --- a/rtengine/image16.h +++ b/rtengine/image16.h @@ -45,7 +45,7 @@ public: Image8* to8(); Imagefloat* tofloat(); - virtual void getStdImage(ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, bool first, procparams::ToneCurveParams hrp); + virtual void getStdImage(ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp); virtual const char* getType() const { diff --git a/rtengine/image8.cc b/rtengine/image8.cc index ab7393100..15a6d9acc 100644 --- a/rtengine/image8.cc +++ b/rtengine/image8.cc @@ -97,7 +97,7 @@ Image8* Image8::copy () return cp; } -void Image8::getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, bool first, procparams::ToneCurveParams hrp) +void Image8::getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp) { // compute channel multipliers float rm = 1.f, gm = 1.f, bm = 1.f; diff --git a/rtengine/image8.h b/rtengine/image8.h index 59d13c298..9bb5d51e3 100644 --- a/rtengine/image8.h +++ b/rtengine/image8.h @@ -40,7 +40,7 @@ public: Image8* copy (); - virtual void getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, bool first, procparams::ToneCurveParams hrp); + virtual void getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp); virtual const char* getType () const { diff --git a/rtengine/imagefloat.cc b/rtengine/imagefloat.cc index 2cf73204d..fd6bc1c75 100644 --- a/rtengine/imagefloat.cc +++ b/rtengine/imagefloat.cc @@ -168,7 +168,7 @@ Imagefloat* Imagefloat::copy () } // This is called by the StdImageSource class. We assume that fp images from StdImageSource don't have to deal with gamma -void Imagefloat::getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, bool first, procparams::ToneCurveParams hrp) +void Imagefloat::getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp) { // compute channel multipliers diff --git a/rtengine/imagefloat.h b/rtengine/imagefloat.h index 65c291775..d84e742ce 100644 --- a/rtengine/imagefloat.h +++ b/rtengine/imagefloat.h @@ -49,7 +49,7 @@ public: Image8* to8(); Image16* to16(); - virtual void getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, bool first, procparams::ToneCurveParams hrp); + virtual void getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp); virtual const char* getType () const { diff --git a/rtengine/imageio.h b/rtengine/imageio.h index cbf245291..0de1de1c0 100644 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -106,7 +106,7 @@ public: return sampleArrangement; } - virtual void getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, bool first, procparams::ToneCurveParams hrp) + virtual void getStdImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, bool first) { printf("getStdImage NULL!\n"); } diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index c1bd8fd64..2c7ded588 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -74,7 +74,7 @@ public: virtual void retinexPrepareBuffers (const ColorManagementParams& cmp, const RetinexParams &retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; - virtual void HLRecovery_Global (ToneCurveParams hrp) {}; + virtual void HLRecovery_Global (const ToneCurveParams &hrp) {}; virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {}; virtual void MSR (LabImage* lab, LUTf & mapcurve, bool &mapcontlutili, int width, int height, int skip, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 85e68745b..086747b1b 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -2825,7 +2825,7 @@ void RawImageSource::flushRGB() } } -void RawImageSource::HLRecovery_Global(ToneCurveParams hrp) +void RawImageSource::HLRecovery_Global(const ToneCurveParams &hrp) { if (hrp.hrenabled && hrp.method == "Color") { if(!rgbSourceModified) { @@ -3236,10 +3236,10 @@ void RawImageSource::copyOriginalPixels(const RAWParams &raw, RawImage *src, Raw } } -void RawImageSource::cfaboxblur(RawImage *riFlatFile, float* cfablur, const int boxH, const int boxW) +void RawImageSource::cfaboxblur(RawImage *riFlatFile, float* cfablur, int boxH, int boxW) { - if(boxW == 0 && boxH == 0) { // nothing to blur + if (boxW < 0 || boxH < 0 || (boxW == 0 && boxH == 0)) { // nothing to blur or negative values memcpy(cfablur, riFlatFile->data[0], W * H * sizeof(float)); return; } diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index af0c1a116..7244f4c7c 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -122,7 +122,7 @@ public: void retinexPrepareBuffers (const ColorManagementParams& cmp, const RetinexParams &retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI); void flushRawData (); void flushRGB (); - void HLRecovery_Global (ToneCurveParams hrp); + void HLRecovery_Global (const ToneCurveParams &hrp); void refinement_lassus (int PassCount); void refinement(int PassCount); void setBorder(unsigned int rawBorder) {border = rawBorder;} diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index c75995b25..241d5f81d 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -194,7 +194,7 @@ void StdImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima // the code will use OpenMP as of now. - img->getStdImage(ctemp, tran, image, pp, true, hrp); + img->getStdImage(ctemp, tran, image, pp, true); // Hombre: we could have rotated the image here too, with just few line of code, but: // 1. it would require other modifications in the engine, so "do not touch that little plonker!"