Fixed some cppcheck warnings

This commit is contained in:
Jan Möbius
2018-04-05 09:08:44 +02:00
parent bd3ec6a988
commit 76e33791e0
15 changed files with 28 additions and 32 deletions

View File

@@ -56,7 +56,7 @@ public:
typedef T value_type;
CmdOption(const T& _val) : val_(_val), valid_(true), enabled_(false) { }
explicit CmdOption(const T& _val) : val_(_val), valid_(true), enabled_(false) { }
CmdOption() : val_(T()),valid_(false), enabled_(false) { }
// has been set and has a value

View File

@@ -123,7 +123,7 @@ public:
/// default constructor
DecimaterViewerWidget(QWidget* _parent=0)
explicit DecimaterViewerWidget(QWidget* _parent=0)
: MeshViewerWidget(_parent),
animate_(false),
timer_(0),

View File

@@ -82,7 +82,7 @@ class MeshViewerWidget : public MeshViewerWidgetT<MyMesh>
Q_OBJECT
public:
/// default constructor
MeshViewerWidget(QWidget* parent=0) : MeshViewerWidgetT<MyMesh>(parent)
explicit MeshViewerWidget(QWidget* parent=0) : MeshViewerWidgetT<MyMesh>(parent)
{}
OpenMesh::IO::Options& options() { return _options; }
const OpenMesh::IO::Options& options() const { return _options; }

View File

@@ -139,17 +139,15 @@ void VDPMClientViewerWidget::mesh_coloring()
vEnd(mesh_.vertices_end());
VHierarchyNodeHandle node_handle;
float ratio;
unsigned char r, g, b;
for (; vIt!=vEnd; ++vIt)
{
node_handle = mesh_.data(*vIt).vhierarchy_node_handle();
ratio = vhierarchy_.node(node_handle).ratio();
const float ratio = vhierarchy_.node(node_handle).ratio();
r = (unsigned char) ((1.0f - ratio) * myYellow[0] + ratio * myBlue[0]);
g = (unsigned char) ((1.0f - ratio) * myYellow[1] + ratio * myBlue[1]);
b = (unsigned char) ((1.0f - ratio) * myYellow[2] + ratio * myBlue[2]);
const unsigned char r = (unsigned char) ((1.0f - ratio) * myYellow[0] + ratio * myBlue[0]);
const unsigned char g = (unsigned char) ((1.0f - ratio) * myYellow[1] + ratio * myBlue[1]);
const unsigned char b = (unsigned char) ((1.0f - ratio) * myYellow[2] + ratio * myBlue[2]);
mesh_.set_color(*vIt, OpenMesh::Vec3uc(r,g,b));
}

View File

@@ -138,17 +138,15 @@ void VDPMClientViewerWidget::mesh_coloring()
vEnd(mesh_.vertices_end());
VHierarchyNodeHandle node_handle;
float ratio;
unsigned char r, g, b;
for (; vIt!=vEnd; ++vIt)
{
node_handle = mesh_.data(*vIt).vhierarchy_node_handle();
ratio = vhierarchy_.node(node_handle).ratio();
const float ratio = vhierarchy_.node(node_handle).ratio();
r = (unsigned char) ((1.0f - ratio) * myYellow[0] + ratio * myBlue[0]);
g = (unsigned char) ((1.0f - ratio) * myYellow[1] + ratio * myBlue[1]);
b = (unsigned char) ((1.0f - ratio) * myYellow[2] + ratio * myBlue[2]);
const unsigned char r = (unsigned char) ((1.0f - ratio) * myYellow[0] + ratio * myBlue[0]);
const unsigned char g = (unsigned char) ((1.0f - ratio) * myYellow[1] + ratio * myBlue[1]);
const unsigned char b = (unsigned char) ((1.0f - ratio) * myYellow[2] + ratio * myBlue[2]);
mesh_.set_color(*vIt, OpenMesh::Vec3uc(r,g,b));
}