diff --git a/Doc/Tutorial/04-stl_algorithms/smooth_algo.hh b/Doc/Tutorial/04-stl_algorithms/smooth_algo.hh index b39fd82f..968cbd7b 100644 --- a/Doc/Tutorial/04-stl_algorithms/smooth_algo.hh +++ b/Doc/Tutorial/04-stl_algorithms/smooth_algo.hh @@ -13,7 +13,7 @@ public: public: // construct with a given mesh - SmootherT(Mesh& _mesh) + explicit SmootherT(Mesh& _mesh) : mesh_(_mesh) { mesh_.add_property( cog_ ); diff --git a/src/OpenMesh/Apps/Decimating/CmdOption.hh b/src/OpenMesh/Apps/Decimating/CmdOption.hh index 7a0d19b0..bbab79f4 100644 --- a/src/OpenMesh/Apps/Decimating/CmdOption.hh +++ b/src/OpenMesh/Apps/Decimating/CmdOption.hh @@ -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 diff --git a/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh b/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh index c3caec9a..bb908a61 100644 --- a/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh +++ b/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh @@ -123,7 +123,7 @@ public: /// default constructor - DecimaterViewerWidget(QWidget* _parent=0) + explicit DecimaterViewerWidget(QWidget* _parent=0) : MeshViewerWidget(_parent), animate_(false), timer_(0), diff --git a/src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh b/src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh index 6addb705..7c8c1cd4 100644 --- a/src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh +++ b/src/OpenMesh/Apps/QtViewer/MeshViewerWidget.hh @@ -82,7 +82,7 @@ class MeshViewerWidget : public MeshViewerWidgetT Q_OBJECT public: /// default constructor - MeshViewerWidget(QWidget* parent=0) : MeshViewerWidgetT(parent) + explicit MeshViewerWidget(QWidget* parent=0) : MeshViewerWidgetT(parent) {} OpenMesh::IO::Options& options() { return _options; } const OpenMesh::IO::Options& options() const { return _options; } diff --git a/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Client/VDPMClientViewerWidget.cc b/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Client/VDPMClientViewerWidget.cc index 7ce0864b..c328a872 100644 --- a/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Client/VDPMClientViewerWidget.cc +++ b/src/OpenMesh/Apps/Unsupported/Streaming-qt4/Client/VDPMClientViewerWidget.cc @@ -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)); } diff --git a/src/OpenMesh/Apps/Unsupported/Streaming/Client/VDPMClientViewerWidget.cc b/src/OpenMesh/Apps/Unsupported/Streaming/Client/VDPMClientViewerWidget.cc index 29439336..0503f456 100644 --- a/src/OpenMesh/Apps/Unsupported/Streaming/Client/VDPMClientViewerWidget.cc +++ b/src/OpenMesh/Apps/Unsupported/Streaming/Client/VDPMClientViewerWidget.cc @@ -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)); } diff --git a/src/OpenMesh/Core/IO/reader/PLYReader.cc b/src/OpenMesh/Core/IO/reader/PLYReader.cc index 107fafa7..618f347d 100644 --- a/src/OpenMesh/Core/IO/reader/PLYReader.cc +++ b/src/OpenMesh/Core/IO/reader/PLYReader.cc @@ -1062,7 +1062,7 @@ std::string get_property_name(std::string _string1, std::string _string2) { //----------------------------------------------------------------------------- -_PLYReader_::ValueType get_property_type(std::string _string1, std::string _string2) { +_PLYReader_::ValueType get_property_type(std::string& _string1, std::string& _string2) { if (_string1 == "float32" || _string2 == "float32") diff --git a/src/OpenMesh/Core/IO/reader/STLReader.cc b/src/OpenMesh/Core/IO/reader/STLReader.cc index 6dd8569b..b3c5af0a 100644 --- a/src/OpenMesh/Core/IO/reader/STLReader.cc +++ b/src/OpenMesh/Core/IO/reader/STLReader.cc @@ -176,7 +176,7 @@ class CmpVec { public: - CmpVec(float _eps=FLT_MIN) : eps_(_eps) {} + explicit CmpVec(float _eps=FLT_MIN) : eps_(_eps) {} bool operator()( const Vec3f& _v0, const Vec3f& _v1 ) const { diff --git a/src/OpenMesh/Core/IO/writer/OMWriter.cc b/src/OpenMesh/Core/IO/writer/OMWriter.cc index 964a5ebc..81f26043 100644 --- a/src/OpenMesh/Core/IO/writer/OMWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OMWriter.cc @@ -163,7 +163,7 @@ _OMWriter_::write(std::ostream& _os, BaseExporter& _be, Options _opt, std::strea #ifndef DOXY_IGNORE_THIS template struct Enabler { - Enabler( T& obj ) : obj_(obj) + explicit Enabler( T& obj ) : obj_(obj) {} ~Enabler() { obj_.enable(); } diff --git a/src/OpenMesh/Core/IO/writer/STLWriter.cc b/src/OpenMesh/Core/IO/writer/STLWriter.cc index 503fa03b..54e8f702 100644 --- a/src/OpenMesh/Core/IO/writer/STLWriter.cc +++ b/src/OpenMesh/Core/IO/writer/STLWriter.cc @@ -158,7 +158,7 @@ write_stla(const std::string& _filename, BaseExporter& _be, Options /* _opt */) - int i, nF(int(_be.n_faces())), nV; + int i, nF(int(_be.n_faces())); Vec3f a, b, c, n; std::vector vhandles; FaceHandle fh; @@ -172,7 +172,7 @@ write_stla(const std::string& _filename, BaseExporter& _be, Options /* _opt */) for (i=0; i vhandles; FaceHandle fh; @@ -226,7 +226,7 @@ write_stla(std::ostream& _out, BaseExporter& _be, Options /* _opt */, std::strea for (i=0; i vhandles; FaceHandle fh; @@ -294,7 +294,7 @@ write_stlb(const std::string& _filename, BaseExporter& _be, Options /* _opt */) for (i=0; i vhandles; FaceHandle fh; @@ -366,7 +366,7 @@ write_stlb(std::ostream& _out, BaseExporter& _be, Options /* _opt */, std::strea for (i=0; i