From aacea7046c38c03282347c0d8774b93a473bd394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Thu, 31 Oct 2019 08:56:38 +0100 Subject: [PATCH] Fix Clang warnings plus some cleanups --- rtengine/gamutwarning.cc | 4 ++-- rtengine/gamutwarning.h | 3 ++- rtengine/guidedfilter.cc | 13 ++++++++----- rtengine/guidedfilter.h | 3 ++- rtengine/histmatching.cc | 26 ++++++++++++++------------ rtengine/ipdehaze.cc | 8 ++++---- rtengine/iplabregions.cc | 3 ++- rtengine/iplocalcontrast.cc | 3 ++- rtengine/ipshadowshighlights.cc | 3 ++- rtengine/pdaflinesfilter.cc | 16 +++++++--------- rtengine/pdaflinesfilter.h | 8 +++++--- rtengine/refreshmap.cc | 3 ++- rtengine/refreshmap.h | 9 ++++----- rtengine/rescale.h | 4 ++-- rtengine/rtlensfun.cc | 12 ++++++------ rtengine/rtlensfun.h | 4 +++- rtengine/tmo_fattal02.cc | 21 ++++++++++----------- rtgui/cropwindow.h | 26 ++++++++++++++------------ rtgui/guiutils.h | 17 ++++++++--------- 19 files changed, 99 insertions(+), 87 deletions(-) diff --git a/rtengine/gamutwarning.cc b/rtengine/gamutwarning.cc index 290800f90..569ea3066 100644 --- a/rtengine/gamutwarning.cc +++ b/rtengine/gamutwarning.cc @@ -29,7 +29,8 @@ #include "iccstore.h" #include "image8.h" -namespace rtengine { +namespace rtengine +{ GamutWarning::GamutWarning(cmsHPROFILE iprof, cmsHPROFILE gamutprof, RenderingIntent intent, bool gamutbpc): lab2ref(nullptr), @@ -129,5 +130,4 @@ inline void GamutWarning::mark(Image8 *image, int y, int x) image->b(y, x) = 255; } - } // namespace rtengine diff --git a/rtengine/gamutwarning.h b/rtengine/gamutwarning.h index 4e34ed431..b940b911f 100644 --- a/rtengine/gamutwarning.h +++ b/rtengine/gamutwarning.h @@ -29,7 +29,8 @@ #include "noncopyable.h" -namespace rtengine { +namespace rtengine +{ class Image8; diff --git a/rtengine/guidedfilter.cc b/rtengine/guidedfilter.cc index 70807424a..6b2adb773 100644 --- a/rtengine/guidedfilter.cc +++ b/rtengine/guidedfilter.cc @@ -29,15 +29,19 @@ * available at https://arxiv.org/abs/1505.00996 */ -#include "guidedfilter.h" #include "boxblur.h" -#include "rescale.h" +#include "guidedfilter.h" #include "imagefloat.h" +#include "rescale.h" + #define BENCHMARK #include "StopWatch.h" -namespace rtengine { -namespace { +namespace rtengine +{ + +namespace +{ int calculate_subsampling(int w, int h, int r) { @@ -60,7 +64,6 @@ int calculate_subsampling(int w, int h, int r) } // namespace - void guidedFilter(const array2D &guide, const array2D &src, array2D &dst, int r, float epsilon, bool multithread, int subsampling) { enum Op {MUL, DIVEPSILON, SUBMUL}; diff --git a/rtengine/guidedfilter.h b/rtengine/guidedfilter.h index af8ed0901..d66396c6a 100644 --- a/rtengine/guidedfilter.h +++ b/rtengine/guidedfilter.h @@ -22,7 +22,8 @@ #include "array2D.h" -namespace rtengine { +namespace rtengine +{ void guidedFilter(const array2D &guide, const array2D &src, array2D &dst, int r, float epsilon, bool multithread, int subsampling=0); diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index e85f5ee13..622933149 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -18,22 +18,24 @@ * along with RawTherapee. If not, see . */ -#include "rawimagesource.h" -#include "rtthumbnail.h" -#include "curves.h" -#include "color.h" -#include "rt_math.h" -#include "procparams.h" -#include "../rtgui/mydiagonalcurve.h" -#include "improcfun.h" -//#define BENCHMARK -#include "StopWatch.h" #include +#include "color.h" +#include "curves.h" +#include "improcfun.h" +#include "procparams.h" +#include "rawimagesource.h" +#include "rt_math.h" +#include "rtthumbnail.h" +#include "settings.h" -namespace rtengine { +//#define BENCHMARK +#include "StopWatch.h" -extern const Settings *settings; +#include "../rtgui/mydiagonalcurve.h" + +namespace rtengine +{ namespace { diff --git a/rtengine/ipdehaze.cc b/rtengine/ipdehaze.cc index 729282dbe..c9579cf05 100644 --- a/rtengine/ipdehaze.cc +++ b/rtengine/ipdehaze.cc @@ -42,9 +42,11 @@ #include "../rtgui/options.h" -namespace rtengine { +namespace rtengine +{ -namespace { +namespace +{ float normalize(Imagefloat *rgb, bool multithread) { @@ -271,7 +273,6 @@ void extract_channels(Imagefloat *img, array2D &r, array2D &g, arr } // namespace - void ImProcFunctions::dehaze(Imagefloat *img) { if (!params->dehaze.enabled || params->dehaze.strength == 0.0) { @@ -431,5 +432,4 @@ void ImProcFunctions::dehaze(Imagefloat *img) } } - } // namespace rtengine diff --git a/rtengine/iplabregions.cc b/rtengine/iplabregions.cc index 932b7e18d..cea23bc6b 100644 --- a/rtengine/iplabregions.cc +++ b/rtengine/iplabregions.cc @@ -56,7 +56,8 @@ void fastlin2log(float *x, float factor, float base, int w) } -namespace rtengine { +namespace rtengine +{ void ImProcFunctions::labColorCorrectionRegions(LabImage *lab) { diff --git a/rtengine/iplocalcontrast.cc b/rtengine/iplocalcontrast.cc index 4e6c32e7e..d6f3ebb5b 100644 --- a/rtengine/iplocalcontrast.cc +++ b/rtengine/iplocalcontrast.cc @@ -32,7 +32,8 @@ #include "improcfun.h" #include "procparams.h" -namespace rtengine { +namespace rtengine +{ void ImProcFunctions::localContrast(LabImage *lab) { diff --git a/rtengine/ipshadowshighlights.cc b/rtengine/ipshadowshighlights.cc index a1e91c4ab..0eceb5a3b 100644 --- a/rtengine/ipshadowshighlights.cc +++ b/rtengine/ipshadowshighlights.cc @@ -30,7 +30,8 @@ #include "sleef.c" -namespace rtengine { +namespace rtengine +{ void ImProcFunctions::shadowsHighlights(LabImage *lab) { diff --git a/rtengine/pdaflinesfilter.cc b/rtengine/pdaflinesfilter.cc index 350c6f758..e788c6c83 100644 --- a/rtengine/pdaflinesfilter.cc +++ b/rtengine/pdaflinesfilter.cc @@ -18,18 +18,18 @@ * along with RawTherapee. If not, see . */ +#include + +#include "camconst.h" #include "pdaflinesfilter.h" #include "rawimage.h" #include "settings.h" -#include -#include "camconst.h" -namespace rtengine { +namespace rtengine +{ -extern const Settings *settings; - - -namespace { +namespace +{ class PDAFGreenEqulibrateThreshold: public RawImageSource::GreenEqulibrateThreshold { static constexpr float BASE_THRESHOLD = 0.5f; @@ -167,8 +167,6 @@ private: } // namespace - - PDAFLinesFilter::PDAFLinesFilter(RawImage *ri): ri_(ri), W_(ri->get_width()), diff --git a/rtengine/pdaflinesfilter.h b/rtengine/pdaflinesfilter.h index e2904716e..c3d8b47f4 100644 --- a/rtengine/pdaflinesfilter.h +++ b/rtengine/pdaflinesfilter.h @@ -21,10 +21,12 @@ #pragma once #include -#include "rawimagesource.h" -#include "noncopyable.h" -namespace rtengine { +#include "noncopyable.h" +#include "rawimagesource.h" + +namespace rtengine +{ class RawImage; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 6917d856e..b77eac29c 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -526,7 +526,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { }; -namespace rtengine { +namespace rtengine +{ RefreshMapper::RefreshMapper(): next_event_(rtengine::NUMOFEVENTS) diff --git a/rtengine/refreshmap.h b/rtengine/refreshmap.h index 3f4831329..0f3e5ee90 100644 --- a/rtengine/refreshmap.h +++ b/rtengine/refreshmap.h @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __REFRESHMAP__ -#define __REFRESHMAP__ +#pragma once #include + #include "procevents.h" // Use M_VOID if you wish to update the proc params without updating the preview at all ! @@ -80,7 +80,8 @@ extern int refreshmap[]; -namespace rtengine { +namespace rtengine +{ class RefreshMapper { public: @@ -97,5 +98,3 @@ private: }; } // namespace rtengine - -#endif diff --git a/rtengine/rescale.h b/rtengine/rescale.h index 8e1f99271..70974aa48 100644 --- a/rtengine/rescale.h +++ b/rtengine/rescale.h @@ -23,7 +23,8 @@ #include "array2D.h" #include "rt_math.h" -namespace rtengine { +namespace rtengine +{ inline float getBilinearValue(const array2D &src, float x, float y) { @@ -96,5 +97,4 @@ inline void rescaleNearest(const array2D &src, array2D &dst, bool } } - } // namespace rtengine diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index 1fcb5ec26..665fbd199 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -18,15 +18,15 @@ * along with RawTherapee. If not, see . */ -#include "rtlensfun.h" -#include "imagedata.h" -#include "procparams.h" -#include "settings.h" #include -namespace rtengine { +#include "imagedata.h" +#include "procparams.h" +#include "rtlensfun.h" +#include "settings.h" -extern const Settings *settings; +namespace rtengine +{ //----------------------------------------------------------------------------- // LFModifier diff --git a/rtengine/rtlensfun.h b/rtengine/rtlensfun.h index 9c95ca3aa..7dcd96007 100644 --- a/rtengine/rtlensfun.h +++ b/rtengine/rtlensfun.h @@ -30,7 +30,8 @@ #include "lcp.h" #include "noncopyable.h" -namespace rtengine { +namespace rtengine +{ class FramesMetaData; @@ -39,6 +40,7 @@ namespace procparams struct CoarseTransformParams; struct LensProfParams; + } class LFModifier final : diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index 31671bd0c..d28606edb 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -50,32 +50,32 @@ * $Id: tmo_fattal02.cpp,v 1.3 2008/11/04 23:43:08 rafm Exp $ */ - #ifdef _OPENMP #include #endif + +#include #include #include #include -#include -#include #include +#include -#include #include #include +#include #include "array2D.h" +#include "iccstore.h" #include "imagefloat.h" #include "improcfun.h" -#include "settings.h" -#include "iccstore.h" -#include "StopWatch.h" -#include "sleef.c" #include "opthelper.h" -#include "rt_algo.h" -#include "rescale.h" #include "procparams.h" +#include "rescale.h" +#include "rt_algo.h" +#include "settings.h" +#include "sleef.c" +#include "StopWatch.h" namespace rtengine { @@ -84,7 +84,6 @@ namespace rtengine * RT code ******************************************************************************/ -extern const Settings *settings; extern MyMutex *fftwMutex; using namespace std; diff --git a/rtgui/cropwindow.h b/rtgui/cropwindow.h index be07db5c9..db44a2508 100644 --- a/rtgui/cropwindow.h +++ b/rtgui/cropwindow.h @@ -16,27 +16,31 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef _CROPWINDOW_ -#define _CROPWINDOW_ +#pragma once + +#include #include -#include "lwbutton.h" -#include "lwbuttonset.h" -#include "editenums.h" -#include "crophandler.h" -#include + #include "cropguilistener.h" -#include "pointermotionlistener.h" +#include "crophandler.h" #include "cursormanager.h" #include "editbuffer.h" #include "editcoordsys.h" +#include "editenums.h" +#include "lwbutton.h" +#include "lwbuttonset.h" +#include "pointermotionlistener.h" + #include "../rtengine/noncopyable.h" -namespace rtengine { +namespace rtengine +{ -class Coord; +struct Coord; } + class CropWindow; class CropWindowListener @@ -243,5 +247,3 @@ public: ImageArea* getImageArea(); }; - -#endif diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index 038131b9b..18b650b82 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -16,8 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#ifndef __GUI_UTILS_ -#define __GUI_UTILS_ +#pragma once #include #include @@ -26,22 +25,24 @@ #include +#include "pathutils.h" +#include "threadutils.h" + #include "../rtengine/coord.h" #include "../rtengine/noncopyable.h" -#include "threadutils.h" +namespace rtengine +{ -// for convenience... -#include "pathutils.h" - -namespace rtengine { namespace procparams { class ProcParams; struct CropParams; + } + } class RTImage; @@ -654,5 +655,3 @@ inline Gtk::Window& getToplevelWindow (Gtk::Widget* widget) { return *static_cast (widget->get_toplevel ()); } - -#endif