Commit ab60deae authored by Jan Möbius's avatar Jan Möbius

Fixed various cppcheck warnings

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16342 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9d98e5e0
......@@ -1579,9 +1579,6 @@ void DrawMeshT<Mesh>::updatePickingFaces(ACG::GLState& _state )
pickFaceVertexBuf_.resize(3 * numTris_);
pickFaceColBuf_.resize(3 * numTris_);
// Index to the current buffer position
unsigned int bufferIndex = 0;
for (unsigned int i = 0; i < numTris_; ++i)
{
const Vec4uc pickColor = _state.pick_get_name_color ( triToFaceMap_[i] );
......@@ -1610,9 +1607,6 @@ void DrawMeshT<Mesh>::updatePickingAny(ACG::GLState& _state )
pickFaceVertexBuf_.resize(3 * numTris_);
pickAnyFaceColBuf_.resize(3 * numTris_);
// Index to the current buffer position
unsigned int bufferIndex = 0;
for (unsigned int i = 0; i < numTris_; ++i)
{
const Vec4uc pickColor = _state.pick_get_name_color ( triToFaceMap_[i] );
......
......@@ -131,7 +131,7 @@ GLState::GLState(bool _updateGL)
colorPicking_(true)
{
if (stateStack_.size() == 0)
if ( stateStack_.empty() )
{
stateStack_.push_back(GLStateContext());
......
......@@ -187,7 +187,6 @@ _raycollision_non_directional(Node* _node, RayCollisionData& _data) const
else
{
Scalar tmin, tmax;
bool used = false;
if ( _node->left_child_ && ACG::Geometry::axisAlignedBBIntersection( _data.ref, _data.ray, _node->left_child_->bb_min, _node->left_child_->bb_max, tmin, tmax)) {
_raycollision_non_directional(_node->left_child_, _data);
}
......@@ -227,7 +226,6 @@ _raycollision_directional(Node* _node, RayCollisionData& _data) const
else
{
Scalar tmin, tmax;
bool used = false;
if ( _node->left_child_ && ACG::Geometry::axisAlignedBBIntersection( _data.ref, _data.ray, _node->left_child_->bb_min, _node->left_child_->bb_max, tmin, tmax)) {
_raycollision_directional(_node->left_child_, _data);
}
......
......@@ -213,8 +213,6 @@ draw(GLState& _state, const DrawModes::DrawMode& _drawMode) {
GLenum prev_depth = _state.depthFunc();
unsigned int arrays = NONE;
glPushAttrib(GL_ENABLE_BIT);
/// get bound texture buffer and target
......
......@@ -148,7 +148,7 @@ int componentCount(MeshT* _mesh ) {
handles.push_back( vh );
//grow from found vertex
while( handles.size() > 0 ){
while( ! handles.empty() ){
typename MeshT::VertexHandle current = handles.back();
handles.pop_back();
......
......@@ -599,10 +599,6 @@ normalSurfacePoint(double _u, double _v)
assert(_u >= loweru() && _u <= upperu());
assert(_v >= lowerv() && _v <= upperv());
int pn = degree_n();
int pm = degree_m();
Point derivu( derivativeSurfacePoint(_u,_v,1,0));
Point derivv( derivativeSurfacePoint(_u,_v,0,1));
......
......@@ -62,7 +62,7 @@ bool getSourcePolylines( std::vector<PolyLine*>& _polylines )
std::cerr << "ERROR: Polyine get_source_polylines fatal error\n";
}
return (_polylines.size() > 0 );
return ( !_polylines.empty() );
}
......@@ -82,7 +82,7 @@ bool getTargetPolylines( std::vector<PolyLine*>& _polylines )
std::cerr << "ERROR: Polyine getTargetPolylines fatal error\n";
}
return (_polylines.size() > 0 );
return ( !_polylines.empty() );
}
......
......@@ -586,7 +586,7 @@ Core::init() {
msgBox.setText("No external plugin renderers available!");
msgBox.setInformativeText("The build in renderer is only a very limited one and is missing many features.\nYou should build and use the other free renderers shipped with OpenFlipper.");
msgBox.setIcon(QMessageBox::Warning);
int ret = msgBox.exec();
msgBox.exec();
}
}
......
......@@ -369,13 +369,13 @@ void InfoMeshObjectPlugin::printMeshInfo( MeshT* _mesh , int _id, unsigned int _
float maxX = FLT_MIN;
float minX = FLT_MAX;
float sumX = 0.0;
//float sumX = 0.0;
float maxY = FLT_MIN;
float minY = FLT_MAX;
float sumY = 0.0;
//float sumY = 0.0;
float maxZ = FLT_MIN;
float minZ = FLT_MAX;
float sumZ = 0.0;
//float sumZ = 0.0;
int minV = 999;
int maxV = 0;
int sumV = 0;
......@@ -388,13 +388,13 @@ void InfoMeshObjectPlugin::printMeshInfo( MeshT* _mesh , int _id, unsigned int _
typename MeshT::Point p = _mesh->point( v_it.handle() );
if (p[0] < minX) minX = p[0];
if (p[0] > maxX) maxX = p[0];
sumX += p[0];
//sumX += p[0];
if (p[1] < minY) minY = p[1];
if (p[1] > maxY) maxY = p[1];
sumY += p[1];
//sumY += p[1];
if (p[2] < minZ) minZ = p[2];
if (p[2] > maxZ) maxZ = p[2];
sumZ += p[2];
//sumZ += p[2];
......@@ -439,7 +439,7 @@ void InfoMeshObjectPlugin::printMeshInfo( MeshT* _mesh , int _id, unsigned int _
float sumA = 0.0;
float maxI = FLT_MIN;
float minI = FLT_MAX;
float sumI = 0.0;
//float sumI = 0.0;
float maxD = FLT_MIN;
float minD = FLT_MAX;
float sumD = 0.0;
......@@ -467,19 +467,19 @@ void InfoMeshObjectPlugin::printMeshInfo( MeshT* _mesh , int _id, unsigned int _
if (angle < minI) minI = angle;
if (angle > maxI) maxI = angle;
sumI += angle;
//sumI += angle;
angle = OpenMesh::rad_to_deg(acos(OpenMesh::sane_aarg( MathTools::sane_normalized(v2 - v1) | MathTools::sane_normalized(v0 - v1) )));
if (angle < minI) minI = angle;
if (angle > maxI) maxI = angle;
sumI += angle;
//sumI += angle;
angle = OpenMesh::rad_to_deg(acos(OpenMesh::sane_aarg( MathTools::sane_normalized(v1 - v2) | MathTools::sane_normalized(v0 - v2) )));
if (angle < minI) minI = angle;
if (angle > maxI) maxI = angle;
sumI += angle;
//sumI += angle;
//compute dihedral angles
typename MeshT::FaceFaceIter ff_it;
......
......@@ -1002,7 +1002,7 @@ me_merge( QMouseEvent* _event )
if (target_idx == cur_pol->line()->n_vertices() - 1 || target_idx == 0) {
if (target_idx == 0) {
cur_pol->line()->invert();
target_idx = cur_pol->line()->n_vertices() - 1;
//target_idx = cur_pol->line()->n_vertices() - 1;
}
// save references
......
......@@ -845,7 +845,6 @@ balanace_area(unsigned int _iters, bool _use_projection)
typename Mesh::CVVIter vv_it;
typename Mesh::Scalar w, ww;
typename Mesh::Point u, n;
bool omit;
DiffGeoT<Mesh> diffgeo(mesh_);
......@@ -902,7 +901,6 @@ balanace_area(unsigned int _iters, bool _use_projection)
{
u.vectorize(0.0);
ww = 0;
omit = false;
for (vv_it=mesh_.cvv_iter(v_it); vv_it; ++vv_it)
{
......
......@@ -47,12 +47,13 @@ template< typename MeshT >
void TextureControlPlugin::getOriginalHistogram(std::vector< double>& _x, std::vector< double>& _y,
int _textureid, MeshT& _mesh,
OpenMesh::VPropHandleT< double > _texProp) {
_x.clear();
_y.clear();
for ( typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it) {
double value = _mesh.property(_texProp, v_it);
}
// TODO: That did not make any sense here
// _x.clear();
// _y.clear();
//
// for ( typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it) {
// double value = _mesh.property(_texProp, v_it);
// }
}
......
......@@ -258,17 +258,17 @@ void TopologyPlugin::add_face(QMouseEvent* _event) {
TriMesh::FaceVertexIter fv_it(m,fh);
TriMesh::VertexHandle closest = fv_it.handle();
float shortest_distance = (m.point(closest) - hit_point).sqrnorm();
// float shortest_distance = (m.point(closest) - hit_point).sqrnorm();
++fv_it;
if ( (m.point(fv_it.handle() ) - hit_point).sqrnorm() < shortest_distance ) {
shortest_distance = (m.point(fv_it.handle() ) - hit_point).sqrnorm();
// shortest_distance = (m.point(fv_it.handle() ) - hit_point).sqrnorm();
closest = fv_it.handle();
}
++fv_it;
if ( (m.point(fv_it.handle() ) - hit_point).sqrnorm() < shortest_distance ) {
shortest_distance = (m.point(fv_it.handle() ) - hit_point).sqrnorm();
// shortest_distance = (m.point(fv_it.handle() ) - hit_point).sqrnorm();
closest = fv_it.handle();
}
......@@ -610,16 +610,16 @@ void TopologyPlugin::flip_edge(QMouseEvent* _event) {
++fe_it;
TriMesh::HalfedgeHandle e3 = m.halfedge_handle(fe_it.handle(),0);
double min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e1 )), m.point(m.from_vertex_handle( e1 )));
const double min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e1 )), m.point(m.from_vertex_handle( e1 )));
TriMesh::EdgeHandle closest_edge = m.edge_handle(e1);
if ( ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e2 )), m.point(m.from_vertex_handle( e2 ))) < min_dist ) {
min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e2 )),m.point(m.from_vertex_handle( e2 )));
// min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e2 )),m.point(m.from_vertex_handle( e2 )));
closest_edge = m.edge_handle(e2);
}
if ( ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e3 )),m.point(m.from_vertex_handle( e3 ))) < min_dist) {
min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e3 )),m.point(m.from_vertex_handle( e3 )));
// min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e3 )),m.point(m.from_vertex_handle( e3 )));
closest_edge = m.edge_handle(e3);
}
......@@ -673,16 +673,16 @@ void TopologyPlugin::collapse_edge(QMouseEvent* _event) {
++fe_it;
TriMesh::HalfedgeHandle e3 = m.halfedge_handle(fe_it.handle(),0);
double min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e1 )), m.point(m.from_vertex_handle( e1 )));
const double min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e1 )), m.point(m.from_vertex_handle( e1 )));
TriMesh::HalfedgeHandle closest_edge = e1;
if ( ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e2 )), m.point(m.from_vertex_handle( e2 ))) < min_dist ) {
min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e2 )),m.point(m.from_vertex_handle( e2 )));
// min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e2 )),m.point(m.from_vertex_handle( e2 )));
closest_edge = e2;
}
if ( ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e3 )),m.point(m.from_vertex_handle( e3 ))) < min_dist) {
min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e3 )),m.point(m.from_vertex_handle( e3 )));
// min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e3 )),m.point(m.from_vertex_handle( e3 )));
closest_edge = e3;
}
......@@ -784,16 +784,16 @@ void TopologyPlugin::split_edge(QMouseEvent* _event) {
++fe_it;
TriMesh::HalfedgeHandle e3 = m.halfedge_handle(fe_it.handle(),0);
double min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e1 )), m.point(m.from_vertex_handle( e1 )));
const double min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e1 )), m.point(m.from_vertex_handle( e1 )));
TriMesh::EdgeHandle closest_edge = m.edge_handle(e1);
if ( ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e2 )), m.point(m.from_vertex_handle( e2 ))) < min_dist ) {
min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e2 )),m.point(m.from_vertex_handle( e2 )));
// min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e2 )),m.point(m.from_vertex_handle( e2 )));
closest_edge = m.edge_handle(e2);
}
if ( ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e3 )),m.point(m.from_vertex_handle( e3 ))) < min_dist) {
min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e3 )),m.point(m.from_vertex_handle( e3 )));
// min_dist = ACG::Geometry::distPointLineSquared(hit_point,m.point(m.to_vertex_handle( e3 )),m.point(m.from_vertex_handle( e3 )));
closest_edge = m.edge_handle(e3);
}
......
......@@ -871,8 +871,6 @@ void FilePLYPlugin::writeHeader(std::ofstream& _os, MeshT* _mesh, bool _binary)
template <class MeshT>
bool FilePLYPlugin::writeMeshFileAscii(QString _filename, MeshT* _mesh) {
std::string filename = std::string(_filename.toUtf8());
// Get desired properties
bool gui = OpenFlipper::Options::gui() && (saveVertexNormal_ != 0) /*buttons initialized*/;
// If in no gui mode -> request as much as possible
......@@ -980,8 +978,6 @@ bool FilePLYPlugin::writeMeshFileAscii(QString _filename, MeshT* _mesh) {
template <class MeshT>
bool FilePLYPlugin::writeMeshFileBinary(QString _filename, MeshT* _mesh) {
std::string filename = std::string(_filename.toUtf8());
// Get desired properties
bool gui = OpenFlipper::Options::gui() && (saveVertexNormal_ != 0) /*buttons initialized*/;
// If in no gui mode -> request as much as possible
......
......@@ -484,7 +484,6 @@ bool FileVTKPlugin::loadMeshLines(QString _spec,QTextStream& _in,MeshT*& _mesh)
quint32 index;
if ( _in.status() == QTextStream::Ok ) {
std::vector< OpenMesh::VertexHandle > handles;
if ( !binary_ ) {
for ( unsigned int i = 0 ; i < valence; ++i )
......@@ -529,7 +528,6 @@ bool FileVTKPlugin::loadMeshPolygons(QString _spec,QTextStream& _in,MeshT*& _mes
std::cerr << "loadMeshPolygons" << std::endl;
bool ok = true;
std::vector< std::vector< OpenMesh::VertexHandle > > invalidFaces;
// Split the header line into components
QStringList polygonsLine = _spec.split(" ",QString::SkipEmptyParts);
......
......@@ -323,7 +323,6 @@ void DepthPeelingPlugin::drawQuadProj(float x0, float y0, float w, float h)
void DepthPeelingPlugin::traverseLightNodes( BaseNode* _node)
{
std::vector<int> pLightTypes;
if (_node)
{
......@@ -948,7 +947,7 @@ DepthPeelingPlugin::traverseDraw( BaseNode* _node, Action& _action, ACG::SceneGr
// If its hidden, ignore it.
// If it should not be rendered in this pass, ignore it too.
if ( (_node->traverseMode() & BaseNode::ChildrenFirst ) && (_node->status() != BaseNode::HideNode) && _node->multipassNodeActive(_pass) )
process_children &= traverseDrawApplyAction(_node, _action, _globalDrawMode, _pass, _peelPass);
traverseDrawApplyAction(_node, _action, _globalDrawMode, _pass, _peelPass);
// Call the leave function of the node (if available and active in multipass).
if ( _node->multipassStatusActive(_pass) )
......
......@@ -1442,8 +1442,6 @@ void MeshObjectSelectionPlugin::saveIniFile(INIFile& _ini, int _id) {
return;
}
std::vector<int> ids;
// The objects section should already exist
QString sectionName = object->name();
if(!_ini.section_exists(sectionName)) {
......
......@@ -339,13 +339,15 @@ void MeshObjectSelectionPlugin::paintSphereSelection(MeshT* _mesh
for(uint i=0; i <vertex_handles.size(); i++)
_mesh->status(vertex_handles[i]).set_tagged(true);
if(vertex_handles.size()> 0)tagged = true;
if( ! vertex_handles.empty() )
tagged = true;
}
if( (_primitiveType & edgeType_) || (_primitiveType & halfedgeType_)) {
for(uint i=0; i <edge_handles.size(); i++)
_mesh->status(edge_handles[i]).set_tagged(true);
if(edge_handles.size()> 0)tagged = true;
if( !edge_handles.empty() )
tagged = true;
}
if(_primitiveType & faceType_) {
if(vertex_handles.size()== fVertices) {
......@@ -662,7 +664,7 @@ void MeshObjectSelectionPlugin::componentsMeshSelection(MeshT* _mesh, uint _fh,
std::set<typename MeshT::VertexHandle> unprocessed;
unprocessed.insert(current);
while(unprocessed.size() > 0) {
while( !unprocessed.empty() ) {
// Select current vertex
current = *unprocessed.begin();
......@@ -704,7 +706,7 @@ void MeshObjectSelectionPlugin::componentsMeshSelection(MeshT* _mesh, uint _fh,
if(!firstEdge.is_valid()) return;
bool selected = _mesh->status(firstEdge).selected();
while(unprocessed.size() > 0) {
while( !unprocessed.empty() ) {
// Select all edges incident to current face
current = *unprocessed.begin();
......@@ -750,7 +752,7 @@ void MeshObjectSelectionPlugin::componentsMeshSelection(MeshT* _mesh, uint _fh,
std::set<typename MeshT::FaceHandle> unprocessed;
unprocessed.insert(current);
while(unprocessed.size() > 0) {
while( !unprocessed.empty() ) {
// Select all edges incident to current face
current = *unprocessed.begin();
......
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