cppcheck: further fixes

This commit is contained in:
Ingo Weyrich
2019-08-01 14:02:38 +02:00
parent 41fc34c5c6
commit 46cbb652d5
30 changed files with 77 additions and 54 deletions

View File

@@ -31,7 +31,7 @@
#include "../rtgui/mydiagonalcurve.h" #include "../rtgui/mydiagonalcurve.h"
#include "color.h" #include "color.h"
#include "pipettebuffer.h" #include "pipettebuffer.h"
#include "noncopyable.h"
#include "LUT.h" #include "LUT.h"
#define CURVES_MIN_POLY_POINTS 1000 #define CURVES_MIN_POLY_POINTS 1000
@@ -479,7 +479,7 @@ public:
}; };
}; };
class FlatCurve : public Curve class FlatCurve : public Curve, public rtengine::NonCopyable
{ {
private: private:

View File

@@ -328,8 +328,8 @@ void DFManager::init(const Glib::ustring& pathname)
} else { } else {
printf( "%s: MEAN of \n ", i.key().c_str()); printf( "%s: MEAN of \n ", i.key().c_str());
for( std::list<Glib::ustring>::iterator iter = i.pathNames.begin(); iter != i.pathNames.end(); ++iter ) { for(std::list<Glib::ustring>::iterator path = i.pathNames.begin(); path != i.pathNames.end(); ++path) {
printf( "%s, ", iter->c_str() ); printf("%s, ", path->c_str());
} }
printf("\n"); printf("\n");

View File

@@ -277,8 +277,8 @@ void FFManager::init(const Glib::ustring& pathname)
} else { } else {
printf( "%s: MEAN of \n ", i.key().c_str()); printf( "%s: MEAN of \n ", i.key().c_str());
for( std::list<Glib::ustring>::iterator iter = i.pathNames.begin(); iter != i.pathNames.end(); ++iter ) { for(std::list<Glib::ustring>::iterator path = i.pathNames.begin(); path != i.pathNames.end(); ++path) {
printf( "%s, ", iter->c_str() ); printf("%s, ", path->c_str());
} }
printf("\n"); printf("\n");

View File

@@ -106,10 +106,10 @@ void ImProcFunctions::shadowsHighlights(LabImage *lab)
#pragma omp parallel for if (multiThread) #pragma omp parallel for if (multiThread)
#endif #endif
for (int l = 0; l < 32768; ++l) { for (int l = 0; l < 32768; ++l) {
auto base = pow_F(l / 32768.f, gamma); auto val = pow_F(l / 32768.f, gamma);
// get a bit more contrast in the shadows // get a bit more contrast in the shadows
base = sh_contrast.getVal(base); val = sh_contrast.getVal(val);
f[l] = base * 32768.f; f[l] = val * 32768.f;
} }
} else { } else {
#ifdef _OPENMP #ifdef _OPENMP
@@ -119,10 +119,10 @@ void ImProcFunctions::shadowsHighlights(LabImage *lab)
float l, a, b; float l, a, b;
float R = c, G = c, B = c; float R = c, G = c, B = c;
rgb2lab(R, G, B, l, a, b); rgb2lab(R, G, B, l, a, b);
auto base = pow_F(l / 32768.f, gamma); auto val = pow_F(l / 32768.f, gamma);
// get a bit more contrast in the shadows // get a bit more contrast in the shadows
base = sh_contrast.getVal(base); val = sh_contrast.getVal(val);
l = base * 32768.f; l = val * 32768.f;
lab2rgb(l, a, b, R, G, B); lab2rgb(l, a, b, R, G, B);
f[c] = G; f[c] = G;
} }
@@ -133,8 +133,8 @@ void ImProcFunctions::shadowsHighlights(LabImage *lab)
#pragma omp parallel for if (multiThread) #pragma omp parallel for if (multiThread)
#endif #endif
for (int l = 0; l < 32768; ++l) { for (int l = 0; l < 32768; ++l) {
auto base = pow_F(l / 32768.f, gamma); auto val = pow_F(l / 32768.f, gamma);
f[l] = base * 32768.f; f[l] = val * 32768.f;
} }
} else { } else {
#ifdef _OPENMP #ifdef _OPENMP
@@ -144,8 +144,8 @@ void ImProcFunctions::shadowsHighlights(LabImage *lab)
float l, a, b; float l, a, b;
float R = c, G = c, B = c; float R = c, G = c, B = c;
rgb2lab(R, G, B, l, a, b); rgb2lab(R, G, B, l, a, b);
auto base = pow_F(l / 32768.f, gamma); auto val = pow_F(l / 32768.f, gamma);
l = base * 32768.f; l = val * 32768.f;
lab2rgb(l, a, b, R, G, B); lab2rgb(l, a, b, R, G, B);
f[c] = G; f[c] = G;
} }

View File

@@ -20,12 +20,14 @@
#pragma once #pragma once
#include "rawimagesource.h"
#include <vector> #include <vector>
#include "rawimagesource.h"
#include "noncopyable.h"
namespace rtengine { namespace rtengine {
class PDAFLinesFilter { class PDAFLinesFilter: public rtengine::NonCopyable
{
public: public:
explicit PDAFLinesFilter(RawImage *ri); explicit PDAFLinesFilter(RawImage *ri);
~PDAFLinesFilter(); ~PDAFLinesFilter();

View File

@@ -429,6 +429,7 @@ RawImageSource::RawImageSource ()
, plistener(nullptr) , plistener(nullptr)
, scale_mul{} , scale_mul{}
, c_black{} , c_black{}
, c_white{}
, cblacksom{} , cblacksom{}
, ref_pre_mul{} , ref_pre_mul{}
, refwb_red(0.0) , refwb_red(0.0)

View File

@@ -380,7 +380,7 @@ public:
} }
} }
std::string EffectiveMaxApertureString = ""; std::string EffectiveMaxApertureString;
if (!d100) { if (!d100) {
int EffectiveMaxApertureValue; int EffectiveMaxApertureValue;

View File

@@ -190,7 +190,7 @@ public:
}; };
// a table of tags: id are offset from beginning and not identifiers // a table of tags: id are offset from beginning and not identifiers
class TagDirectoryTable: public TagDirectory class TagDirectoryTable: public TagDirectory, public rtengine::NonCopyable
{ {
protected: protected:
unsigned char *values; // Tags values are saved internally here unsigned char *values; // Tags values are saved internally here

View File

@@ -631,21 +631,21 @@ void Adjuster::setSliderValue(double val)
if (val >= logPivot) { if (val >= logPivot) {
double range = vMax - logPivot; double range = vMax - logPivot;
double x = (val - logPivot) / range; double x = (val - logPivot) / range;
val = (vMin + mid) + std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * mid; val = (vMin + mid) + std::log1p(x * (logBase - 1.0)) / std::log(logBase) * mid;
} else { } else {
double range = logPivot - vMin; double range = logPivot - vMin;
double x = (logPivot - val) / range; double x = (logPivot - val) / range;
val = (vMin + mid) - std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * mid; val = (vMin + mid) - std::log1p(x * (logBase - 1.0)) / std::log(logBase) * mid;
} }
} else { } else {
if (val >= logPivot) { if (val >= logPivot) {
double range = vMax - logPivot; double range = vMax - logPivot;
double x = (val - logPivot) / range; double x = (val - logPivot) / range;
val = logPivot + std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * range; val = logPivot + std::log1p(x * (logBase - 1.0)) / std::log(logBase) * range;
} else { } else {
double range = logPivot - vMin; double range = logPivot - vMin;
double x = (logPivot - val) / range; double x = (logPivot - val) / range;
val = logPivot - std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * range; val = logPivot - std::log1p(x * (logBase - 1.0)) / std::log(logBase) * range;
} }
} }
} }

View File

@@ -29,6 +29,7 @@
#include "options.h" #include "options.h"
#include "threadutils.h" #include "threadutils.h"
#include "thumbbrowserbase.h" #include "thumbbrowserbase.h"
#include "../rtengine/noncopyable.h"
class BatchQueueListener class BatchQueueListener
{ {
@@ -44,7 +45,8 @@ class FileCatalog;
class BatchQueue final : class BatchQueue final :
public ThumbBrowserBase, public ThumbBrowserBase,
public rtengine::BatchProcessingListener, public rtengine::BatchProcessingListener,
public LWButtonListener public LWButtonListener,
public rtengine::NonCopyable
{ {
public: public:
explicit BatchQueue (FileCatalog* aFileCatalog); explicit BatchQueue (FileCatalog* aFileCatalog);

View File

@@ -26,6 +26,7 @@
#include "thumbbrowserentrybase.h" #include "thumbbrowserentrybase.h"
#include "thumbnail.h" #include "thumbnail.h"
#include "bqentryupdater.h" #include "bqentryupdater.h"
#include "../rtengine/noncopyable.h"
class BatchQueueEntry; class BatchQueueEntry;
struct BatchQueueEntryIdleHelper { struct BatchQueueEntryIdleHelper {
@@ -34,7 +35,7 @@ struct BatchQueueEntryIdleHelper {
int pending; int pending;
}; };
class BatchQueueEntry : public ThumbBrowserEntryBase, public BQEntryUpdateListener class BatchQueueEntry : public ThumbBrowserEntryBase, public BQEntryUpdateListener, public rtengine::NonCopyable
{ {
guint8* opreview; guint8* opreview;

View File

@@ -1400,24 +1400,19 @@ void Crop::cropResized (int &x, int &y, int& x2, int& y2)
y2 = maxh - 1; y2 = maxh - 1;
} }
int X, Y;
int W; int W;
if (x < x2) { if (x < x2) {
W = x2 - x + 1; W = x2 - x + 1;
X = x;
} else { } else {
W = x - x2 + 1; W = x - x2 + 1;
X = x2;
} }
int H;
int Y;
if (y < y2) { if (y < y2) {
H = y2 - y + 1;
Y = y; Y = y;
} else { } else {
H = y - y2 + 1;
Y = y2; Y = y2;
} }
@@ -1425,6 +1420,7 @@ void Crop::cropResized (int &x, int &y, int& x2, int& y2)
W = maxw; W = maxw;
} }
int H;
if (fixr->get_active()) { if (fixr->get_active()) {
double r = getRatio (); double r = getRatio ();
@@ -1457,6 +1453,7 @@ void Crop::cropResized (int &x, int &y, int& x2, int& y2)
} }
} }
int X;
if (x < x2) { if (x < x2) {
W = x2 - x + 1; W = x2 - x + 1;
X = x; X = x;

View File

@@ -31,6 +31,7 @@
#include "cursormanager.h" #include "cursormanager.h"
#include "editbuffer.h" #include "editbuffer.h"
#include "editcoordsys.h" #include "editcoordsys.h"
#include "../rtengine/noncopyable.h"
class CropWindow; class CropWindow;
@@ -45,7 +46,7 @@ public:
}; };
class ImageArea; class ImageArea;
class CropWindow : public LWButtonListener, public CropDisplayHandler, public EditCoordSystem, public ObjectMOBuffer class CropWindow : public LWButtonListener, public CropDisplayHandler, public EditCoordSystem, public ObjectMOBuffer, public rtengine::NonCopyable
{ {
static bool initialized; static bool initialized;

View File

@@ -25,6 +25,7 @@
#include "editcallbacks.h" #include "editcallbacks.h"
#include "mydiagonalcurve.h" #include "mydiagonalcurve.h"
#include "myflatcurve.h" #include "myflatcurve.h"
#include "../rtengine/noncopyable.h"
class CurveEditorGroup; class CurveEditorGroup;
class CurveEditorSubGroup; class CurveEditorSubGroup;
@@ -38,7 +39,7 @@ class CurveEditorSubGroup;
/** @brief This class is an interface between RT and the curve editor group /** @brief This class is an interface between RT and the curve editor group
* It handles the methods related to a specific curve. It is created by CurveEditorGroup::addCurve * It handles the methods related to a specific curve. It is created by CurveEditorGroup::addCurve
*/ */
class CurveEditor : public EditSubscriber class CurveEditor : public EditSubscriber, public rtengine::NonCopyable
{ {
friend class CurveEditorGroup; friend class CurveEditorGroup;

View File

@@ -21,10 +21,11 @@
#include <gtkmm.h> #include <gtkmm.h>
#include "curveeditorgroup.h" #include "curveeditorgroup.h"
#include "../rtengine/noncopyable.h"
class DiagonalCurveEditor; class DiagonalCurveEditor;
class DiagonalCurveEditorSubGroup : public CurveEditorSubGroup, public SHCListener, public AdjusterListener class DiagonalCurveEditorSubGroup : public CurveEditorSubGroup, public SHCListener, public AdjusterListener, public rtengine::NonCopyable
{ {
friend class DiagonalCurveEditor; friend class DiagonalCurveEditor;

View File

@@ -34,6 +34,7 @@
#include "navigator.h" #include "navigator.h"
#include "progressconnector.h" #include "progressconnector.h"
#include "filepanel.h" #include "filepanel.h"
#include "../rtengine/noncopyable.h"
class EditorPanel; class EditorPanel;
class MyProgressBar; class MyProgressBar;
@@ -52,7 +53,8 @@ class EditorPanel final :
public rtengine::ProgressListener, public rtengine::ProgressListener,
public ThumbnailListener, public ThumbnailListener,
public HistoryBeforeLineListener, public HistoryBeforeLineListener,
public rtengine::HistogramListener public rtengine::HistogramListener,
public rtengine::NonCopyable
{ {
public: public:
explicit EditorPanel (FilePanel* filePanel = nullptr); explicit EditorPanel (FilePanel* filePanel = nullptr);

View File

@@ -30,6 +30,7 @@
#include "exportpanel.h" #include "exportpanel.h"
#include "extprog.h" #include "extprog.h"
#include "profilestorecombobox.h" #include "profilestorecombobox.h"
#include "../rtengine/noncopyable.h"
class ProfileStoreLabel; class ProfileStoreLabel;
class FileBrowser; class FileBrowser;
@@ -56,7 +57,8 @@ public:
class FileBrowser : public ThumbBrowserBase, class FileBrowser : public ThumbBrowserBase,
public LWButtonListener, public LWButtonListener,
public ExportPanelListener, public ExportPanelListener,
public ProfileStoreListener public ProfileStoreListener,
public rtengine::NonCopyable
{ {
private: private:
typedef sigc::signal<void> type_trash_changed; typedef sigc::signal<void> type_trash_changed;

View File

@@ -34,6 +34,7 @@
#include "thumbimageupdater.h" #include "thumbimageupdater.h"
#include "thumbnail.h" #include "thumbnail.h"
#include "thumbnaillistener.h" #include "thumbnaillistener.h"
#include "../rtengine/noncopyable.h"
class FileBrowserEntry; class FileBrowserEntry;
@@ -46,7 +47,8 @@ struct FileBrowserEntryIdleHelper {
class FileThumbnailButtonSet; class FileThumbnailButtonSet;
class FileBrowserEntry : public ThumbBrowserEntryBase, class FileBrowserEntry : public ThumbBrowserEntryBase,
public ThumbnailListener, public ThumbnailListener,
public ThumbImageUpdateListener public ThumbImageUpdateListener,
public rtengine::NonCopyable
{ {
double scale; double scale;

View File

@@ -32,6 +32,7 @@
#include "previewloader.h" #include "previewloader.h"
#include "multilangmgr.h" #include "multilangmgr.h"
#include "threadutils.h" #include "threadutils.h"
#include "../rtengine/noncopyable.h"
class FilePanel; class FilePanel;
/* /*
@@ -44,7 +45,8 @@ class FileCatalog : public Gtk::VBox,
public PreviewLoaderListener, public PreviewLoaderListener,
public FilterPanelListener, public FilterPanelListener,
public FileBrowserListener, public FileBrowserListener,
public ExportPanelListener public ExportPanelListener,
public rtengine::NonCopyable
{ {
public: public:
typedef sigc::slot<void, const Glib::ustring&> DirSelectionSlot; typedef sigc::slot<void, const Glib::ustring&> DirSelectionSlot;

View File

@@ -31,12 +31,14 @@
#include "filterpanel.h" #include "filterpanel.h"
#include "exportpanel.h" #include "exportpanel.h"
#include "progressconnector.h" #include "progressconnector.h"
#include "../rtengine/noncopyable.h"
class RTWindow; class RTWindow;
class FilePanel final : class FilePanel final :
public Gtk::HPaned, public Gtk::HPaned,
public FileSelectionListener public FileSelectionListener,
public rtengine::NonCopyable
{ {
public: public:
FilePanel (); FilePanel ();

View File

@@ -28,8 +28,6 @@
#include "toolpanel.h" #include "toolpanel.h"
#include "wbprovider.h" #include "wbprovider.h"
#include "../rtengine/noncopyable.h"
class FilmNegProvider class FilmNegProvider
{ {
public: public:
@@ -39,7 +37,6 @@ public:
}; };
class FilmNegative : class FilmNegative :
public rtengine::NonCopyable,
public ToolParamBlock, public ToolParamBlock,
public AdjusterListener, public AdjusterListener,
public FoldableToolPanel, public FoldableToolPanel,

View File

@@ -21,10 +21,11 @@
#include <gtkmm.h> #include <gtkmm.h>
#include "curveeditorgroup.h" #include "curveeditorgroup.h"
#include "../rtengine/noncopyable.h"
class FlatCurveEditor; class FlatCurveEditor;
class FlatCurveEditorSubGroup: public CurveEditorSubGroup class FlatCurveEditorSubGroup: public CurveEditorSubGroup, public rtengine::NonCopyable
{ {
friend class FlatCurveEditor; friend class FlatCurveEditor;

View File

@@ -28,6 +28,7 @@
#include "guiutils.h" #include "guiutils.h"
#include "pointermotionlistener.h" #include "pointermotionlistener.h"
#include "../rtengine/noncopyable.h"
class HistogramArea; class HistogramArea;
struct HistogramAreaIdleHelper { struct HistogramAreaIdleHelper {
@@ -51,7 +52,7 @@ public:
double log (double vsize, double val); double log (double vsize, double val);
}; };
class HistogramRGBArea : public Gtk::DrawingArea, public BackBuffer, private HistogramScaling class HistogramRGBArea : public Gtk::DrawingArea, public BackBuffer, private HistogramScaling, public rtengine::NonCopyable
{ {
private: private:
typedef const double (*TMatrix)[3]; typedef const double (*TMatrix)[3];
@@ -114,7 +115,7 @@ public:
virtual void toggleButtonMode() = 0; virtual void toggleButtonMode() = 0;
}; };
class HistogramArea : public Gtk::DrawingArea, public BackBuffer, private HistogramScaling class HistogramArea : public Gtk::DrawingArea, public BackBuffer, private HistogramScaling, public rtengine::NonCopyable
{ {
public: public:
typedef sigc::signal<void, double> type_signal_factor_changed; typedef sigc::signal<void, double> type_signal_factor_changed;
@@ -172,7 +173,7 @@ private:
void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const override; void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const override;
}; };
class HistogramPanel : public Gtk::Grid, public PointerMotionListener, public DrawModeListener class HistogramPanel : public Gtk::Grid, public PointerMotionListener, public DrawModeListener, public rtengine::NonCopyable
{ {
protected: protected:

View File

@@ -28,6 +28,7 @@
#include "../rtengine/LUT.h" #include "../rtengine/LUT.h"
#include "guiutils.h" #include "guiutils.h"
#include "options.h" #include "options.h"
#include "../rtengine/noncopyable.h"
#define RADIUS 3.5 /** radius of the control points ; must be x.5 to target the center of a pixel */ #define RADIUS 3.5 /** radius of the control points ; must be x.5 to target the center of a pixel */
#define CBAR_WIDTH 10 /** inner width of the colored bar (border excluded) */ #define CBAR_WIDTH 10 /** inner width of the colored bar (border excluded) */
@@ -55,7 +56,7 @@ enum SnapToType {
class MyCurveIdleHelper; class MyCurveIdleHelper;
class CurveEditor; class CurveEditor;
class MyCurve : public Gtk::DrawingArea, public BackBuffer, public ColorCaller, public CoordinateProvider class MyCurve : public Gtk::DrawingArea, public BackBuffer, public ColorCaller, public CoordinateProvider, public rtengine::NonCopyable
{ {
friend class MyCurveIdleHelper; friend class MyCurveIdleHelper;

View File

@@ -28,6 +28,7 @@
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/rtengine.h" #include "../rtengine/rtengine.h"
#include "../rtengine/noncopyable.h"
class PreviewListener class PreviewListener
{ {
@@ -44,7 +45,7 @@ struct PreviewHandlerIdleHelper {
int pending; int pending;
}; };
class PreviewHandler : public rtengine::PreviewImageListener class PreviewHandler : public rtengine::PreviewImageListener, public rtengine::NonCopyable
{ {
private: private:
friend int setImageUI (void* data); friend int setImageUI (void* data);

View File

@@ -28,8 +28,9 @@
#include "guiutils.h" #include "guiutils.h"
#include "profilestorecombobox.h" #include "profilestorecombobox.h"
#include "rtimage.h" #include "rtimage.h"
#include "../rtengine/noncopyable.h"
class ProfilePanel : public Gtk::Grid, public PParamsChangeListener, public ProfileStoreListener class ProfilePanel : public Gtk::Grid, public PParamsChangeListener, public ProfileStoreListener, public rtengine::NonCopyable
{ {
private: private:

View File

@@ -29,8 +29,9 @@
#if defined(__APPLE__) #if defined(__APPLE__)
#include <gtkosxapplication.h> #include <gtkosxapplication.h>
#endif #endif
#include "../rtengine/noncopyable.h"
class RTWindow : public Gtk::Window, public rtengine::ProgressListener class RTWindow : public Gtk::Window, public rtengine::ProgressListener, public rtengine::NonCopyable
{ {
private: private:

View File

@@ -23,6 +23,7 @@
#include "adjuster.h" #include "adjuster.h"
#include "guiutils.h" #include "guiutils.h"
#include "options.h" #include "options.h"
#include "../rtengine/noncopyable.h"
class FormatChangeListener class FormatChangeListener
{ {
@@ -31,7 +32,7 @@ public:
virtual void formatChanged(const Glib::ustring& format) = 0; virtual void formatChanged(const Glib::ustring& format) = 0;
}; };
class SaveFormatPanel : public Gtk::Grid, public AdjusterListener class SaveFormatPanel : public Gtk::Grid, public AdjusterListener, public rtengine::NonCopyable
{ {
protected: protected:

View File

@@ -26,6 +26,7 @@
#include "guiutils.h" #include "guiutils.h"
#include "multilangmgr.h" #include "multilangmgr.h"
#include "paramsedited.h" #include "paramsedited.h"
#include "../rtengine/noncopyable.h"
class ToolPanel; class ToolPanel;
class FoldableToolPanel; class FoldableToolPanel;
@@ -51,7 +52,7 @@ public:
ToolParamBlock(); ToolParamBlock();
}; };
class ToolPanel class ToolPanel : public rtengine::NonCopyable
{ {
protected: protected:

View File

@@ -83,6 +83,7 @@
#include "dehaze.h" #include "dehaze.h"
#include "guiutils.h" #include "guiutils.h"
#include "filmnegative.h" #include "filmnegative.h"
#include "../rtengine/noncopyable.h"
class ImageEditorCoordinator; class ImageEditorCoordinator;
@@ -99,7 +100,8 @@ class ToolPanelCoordinator :
public ICMPanelListener, public ICMPanelListener,
public ImageAreaToolListener, public ImageAreaToolListener,
public rtengine::ImageTypeListener, public rtengine::ImageTypeListener,
public FilmNegProvider public FilmNegProvider,
public rtengine::NonCopyable
{ {
protected: protected:
WhiteBalance* whitebalance; WhiteBalance* whitebalance;