Commit 669b1b78 authored by Jan Möbius's avatar Jan Möbius

cppcheck

parent 4afdd5ad
Pipeline #10642 canceled with stage
in 17 minutes and 12 seconds
...@@ -216,7 +216,7 @@ decimate(const std::string &_ifname, ...@@ -216,7 +216,7 @@ decimate(const std::string &_ifname,
using namespace std; using namespace std;
Mesh mesh; Mesh mesh;
OpenMesh::IO::Options opt; OpenMesh::IO::Options readopt;
OpenMesh::Utils::Timer timer; OpenMesh::Utils::Timer timer;
// ---------------------------------------- read source mesh // ---------------------------------------- read source mesh
...@@ -227,7 +227,7 @@ decimate(const std::string &_ifname, ...@@ -227,7 +227,7 @@ decimate(const std::string &_ifname,
if (gverbose) if (gverbose)
clog << _ifname << endl; clog << _ifname << endl;
if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, opt)) ) if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, readopt)) )
{ {
cerr << " ERROR: read failed!" << endl; cerr << " ERROR: read failed!" << endl;
return rc; return rc;
...@@ -238,7 +238,7 @@ decimate(const std::string &_ifname, ...@@ -238,7 +238,7 @@ decimate(const std::string &_ifname,
{ {
// ---- 0 - For module NormalFlipping one needs face normals // ---- 0 - For module NormalFlipping one needs face normals
if ( !opt.check( OpenMesh::IO::Options::FaceNormal ) ) if ( !readopt.check( OpenMesh::IO::Options::FaceNormal ) )
{ {
if ( !mesh.has_face_normals() ) if ( !mesh.has_face_normals() )
mesh.request_face_normals(); mesh.request_face_normals();
...@@ -420,11 +420,11 @@ decimate(const std::string &_ifname, ...@@ -420,11 +420,11 @@ decimate(const std::string &_ifname,
ofname.insert(++pos, n ); ofname.insert(++pos, n );
} }
OpenMesh::IO::Options opt; OpenMesh::IO::Options writeopt;
//opt += OpenMesh::IO::Options::Binary; //opt += OpenMesh::IO::Options::Binary;
if ( !OpenMesh::IO::write_mesh(mesh, ofname, opt ) ) if ( !OpenMesh::IO::write_mesh(mesh, ofname, writeopt ) )
{ {
std::cerr << " Cannot write decimated mesh to file '" std::cerr << " Cannot write decimated mesh to file '"
<< ofname << "'\n"; << ofname << "'\n";
......
...@@ -137,7 +137,7 @@ private: ...@@ -137,7 +137,7 @@ private:
/// coarsen mesh down to _n vertices /// coarsen mesh down to _n vertices
void coarsen(unsigned int _n); void coarsen(unsigned int _n);
virtual void keyPressEvent(QKeyEvent* _event); virtual void keyPressEvent(QKeyEvent* _event) override;
// mesh data // mesh data
bool animateRefinement_; bool animateRefinement_;
......
...@@ -89,17 +89,17 @@ protected: ...@@ -89,17 +89,17 @@ protected:
inline static Scalar compute_limit_weight(uint _valence) inline static Scalar compute_limit_weight(uint _valence)
{ {
double proj_weight = compute_proj_weight(_valence); double proj_weight_value = compute_proj_weight(_valence);
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
double weight = (3.0/8.0)/(1.0 - proj_weight + (3.0/8.0)); double weight = (3.0/8.0)/(1.0 - proj_weight_value + (3.0/8.0));
return (Scalar)weight; return (Scalar)weight;
} }
inline static Scalar compute_step_weight(uint _valence) inline static Scalar compute_step_weight(uint _valence)
{ {
double proj_weight = compute_proj_weight(_valence); double proj_weight_value = compute_proj_weight(_valence);
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
double weight = proj_weight - (3.0/8.0); double weight = proj_weight_value - (3.0/8.0);
return (Scalar)weight; return (Scalar)weight;
} }
......
...@@ -112,7 +112,7 @@ public: ...@@ -112,7 +112,7 @@ public:
{} {}
template <class _Point> template <class _Point>
QuadricT(const _Point& _pt) explicit QuadricT(const _Point& _pt)
{ {
set_distance_to_point(_pt); set_distance_to_point(_pt);
} }
......
...@@ -133,11 +133,13 @@ protected: ...@@ -133,11 +133,13 @@ protected:
bool check(BaseExporter& _be, Options _opt) const bool check(BaseExporter& _be, Options _opt) const
{ {
return (_opt.check(Options::VertexNormal ) <= _be.has_vertex_normals()) // Check for all Options. When we want to write them (_opt.check() ) , they have to be available ( has_ )
&& (_opt.check(Options::VertexTexCoord)<= _be.has_vertex_texcoords()) // Converts to not A (write them) or B (available)
&& (_opt.check(Options::VertexColor) <= _be.has_vertex_colors()) return ( !_opt.check(Options::VertexNormal ) || _be.has_vertex_normals())
&& (_opt.check(Options::FaceNormal) <= _be.has_face_normals()) && ( !_opt.check(Options::VertexTexCoord)|| _be.has_vertex_texcoords())
&& (_opt.check(Options::FaceColor) <= _be.has_face_colors()); && ( !_opt.check(Options::VertexColor) || _be.has_vertex_colors())
&& ( !_opt.check(Options::FaceNormal) || _be.has_face_normals())
&& ( !_opt.check(Options::FaceColor) || _be.has_face_colors());
} }
}; };
......
...@@ -100,24 +100,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream ...@@ -100,24 +100,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream
{ {
#if defined(WIN32) #if defined(WIN32)
std::string::size_type dot = _filename.find_last_of("\\/"); std::string::size_type dotposition = _filename.find_last_of("\\/");
#else #else
std::string::size_type dot = _filename.rfind("/"); std::string::size_type dotposition = _filename.rfind("/");
#endif #endif
if (dot == std::string::npos){ if (dotposition == std::string::npos){
path_ = "./"; path_ = "./";
objName_ = _filename; objName_ = _filename;
}else{ }else{
path_ = _filename.substr(0,dot+1); path_ = _filename.substr(0,dotposition+1);
objName_ = _filename.substr(dot+1); objName_ = _filename.substr(dotposition+1);
} }
//remove the file extension //remove the file extension
dot = objName_.find_last_of("."); dotposition = objName_.find_last_of(".");
if(dot != std::string::npos) if(dotposition != std::string::npos)
objName_ = objName_.substr(0,dot); objName_ = objName_.substr(0,dotposition);
} }
bool result = write(out, _be, _opt, _precision); bool result = write(out, _be, _opt, _precision);
......
...@@ -40,7 +40,7 @@ bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, Options ...@@ -40,7 +40,7 @@ bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, Options
bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const
{ {
Vec3f v, n; Vec3f n;
Vec2f t; Vec2f t;
VertexHandle vh; VertexHandle vh;
OpenMesh::Vec3f c; OpenMesh::Vec3f c;
...@@ -78,7 +78,7 @@ bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std ...@@ -78,7 +78,7 @@ bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std
_out << "POINTS " << _be.n_vertices() << " float\n"; _out << "POINTS " << _be.n_vertices() << " float\n";
size_t nv = _be.n_vertices(); size_t nv = _be.n_vertices();
for (size_t i = 0; i < nv; ++i) { for (size_t i = 0; i < nv; ++i) {
Vec3f v = _be.point(VertexHandle(int(i))); const Vec3f v = _be.point(VertexHandle(int(i)));
_out << v[0] << ' ' << v[1] << ' ' << v[2] << '\n'; _out << v[0] << ' ' << v[1] << ' ' << v[2] << '\n';
} }
......
...@@ -92,7 +92,7 @@ class multiplex_target : public basic_multiplex_target ...@@ -92,7 +92,7 @@ class multiplex_target : public basic_multiplex_target
{ {
public: public:
explicit multiplex_target(T& _t) : target_(_t) {} explicit multiplex_target(T& _t) : target_(_t) {}
virtual void operator<<(const std::string& _s) { target_ << _s; } virtual void operator<<(const std::string& _s) override { target_ << _s; }
private: private:
T& target_; T& target_;
}; };
......
...@@ -99,7 +99,7 @@ public: ...@@ -99,7 +99,7 @@ public:
public: public:
/// Default constructor /// Default constructor
PropertyT(const std::string& _name = "<unknown>") explicit PropertyT(const std::string& _name = "<unknown>")
: BaseProperty(_name) : BaseProperty(_name)
{} {}
......
...@@ -94,7 +94,7 @@ public: //-------------------------------------------------------- public types ...@@ -94,7 +94,7 @@ public: //-------------------------------------------------------- public types
typedef typename ModuleList::iterator ModuleListIterator; typedef typename ModuleList::iterator ModuleListIterator;
public: //------------------------------------------------------ public methods public: //------------------------------------------------------ public methods
BaseDecimaterT(Mesh& _mesh); explicit BaseDecimaterT(Mesh& _mesh);
virtual ~BaseDecimaterT(); virtual ~BaseDecimaterT();
/** Initialize decimater and decimating modules. /** Initialize decimater and decimating modules.
......
...@@ -89,7 +89,7 @@ public: //-------------------------------------------------------- public types ...@@ -89,7 +89,7 @@ public: //-------------------------------------------------------- public types
public: //------------------------------------------------------ public methods public: //------------------------------------------------------ public methods
/// Constructor /// Constructor
DecimaterT( Mesh& _mesh ); explicit DecimaterT( Mesh& _mesh );
/// Destructor /// Destructor
~DecimaterT(); ~DecimaterT();
......
...@@ -72,7 +72,7 @@ class ModIndependentSetsT: public ModBaseT<MeshT> { ...@@ -72,7 +72,7 @@ class ModIndependentSetsT: public ModBaseT<MeshT> {
; ;
/// Constructor /// Constructor
ModIndependentSetsT(MeshT &_mesh) : explicit ModIndependentSetsT(MeshT &_mesh) :
Base(_mesh, true) { Base(_mesh, true) {
} }
......
...@@ -208,9 +208,9 @@ public: ...@@ -208,9 +208,9 @@ public:
// the smaller the factor, the smaller normal_deviation_ gets // the smaller the factor, the smaller normal_deviation_ gets
// thus creating a stricter constraint // thus creating a stricter constraint
// division by error_tolerance_factor_ is for normalization // division by error_tolerance_factor_ is for normalization
Scalar normal_deviation = normal_deviation_ * static_cast<Scalar>( 180.0 / M_PI * _factor / this->error_tolerance_factor_); Scalar normal_deviation_value = normal_deviation_ * static_cast<Scalar>( 180.0 / M_PI * _factor / this->error_tolerance_factor_);
set_normal_deviation(normal_deviation); set_normal_deviation(normal_deviation_value);
this->error_tolerance_factor_ = _factor; this->error_tolerance_factor_ = _factor;
} }
} }
......
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
public: public:
/// Constructor /// Constructor
ModNormalFlippingT( MeshT &_mesh) : Base(_mesh, true) explicit ModNormalFlippingT( MeshT &_mesh) : Base(_mesh, true)
{ {
set_max_normal_deviation( 90.0f ); set_max_normal_deviation( 90.0f );
const bool mesh_has_normals = _mesh.has_face_normals(); const bool mesh_has_normals = _mesh.has_face_normals();
...@@ -159,8 +159,8 @@ public: ...@@ -159,8 +159,8 @@ public:
// the smaller the factor, the smaller max_deviation_ gets // the smaller the factor, the smaller max_deviation_ gets
// thus creating a stricter constraint // thus creating a stricter constraint
// division by error_tolerance_factor_ is for normalization // division by error_tolerance_factor_ is for normalization
double max_normal_deviation = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_; double max_normal_deviation_value = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_;
set_max_normal_deviation(max_normal_deviation); set_max_normal_deviation(max_normal_deviation_value);
this->error_tolerance_factor_ = _factor; this->error_tolerance_factor_ = _factor;
} }
} }
......
...@@ -97,7 +97,7 @@ class ModRoundnessT : public ModBaseT<MeshT> ...@@ -97,7 +97,7 @@ class ModRoundnessT : public ModBaseT<MeshT>
public: public:
/// Constructor /// Constructor
ModRoundnessT( MeshT &_dec ) : explicit ModRoundnessT( MeshT &_dec ) :
Base(_dec, false), Base(_dec, false),
min_r_(-1.0) min_r_(-1.0)
{ } { }
......
...@@ -258,9 +258,9 @@ public: ...@@ -258,9 +258,9 @@ public:
bool check() bool check()
{ {
bool ok(true); bool ok(true);
unsigned int i, j; for (unsigned int i=0; i<size(); ++i)
for (i=0; i<size(); ++i)
{ {
unsigned int j;
if (((j=left(i))<size()) && interface_.greater(entry(i), entry(j))) if (((j=left(i))<size()) && interface_.greater(entry(i), entry(j)))
{ {
omerr() << "Heap condition violated\n"; omerr() << "Heap condition violated\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment