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

cppcheck warnings

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17352 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a7f1c413
......@@ -91,8 +91,8 @@ void QtBaseViewer::sync_disconnect(const QtBaseViewer* _other)
void QtBaseViewer::sync_send(const GLMatrixd&, const GLMatrixd&)
{
const GLMatrixd m = glstate_->modelview();
const GLMatrixd p = glstate_->projection();
const GLMatrixd& m = glstate_->modelview();
const GLMatrixd& p = glstate_->projection();
QByteArray datagram;
QDataStream out(&datagram, QIODevice::WriteOnly);
......
......@@ -271,15 +271,15 @@ void
QtLasso::
create_mask()
{
unsigned int w, h, size, x, y, xx, yy, i, offset;
unsigned int x, y, xx, yy, i;
GLubyte *fbuffer;
QRgb rgb, borderRgb;
// GL context
w = glstate_.viewport_width();
h = glstate_.viewport_height();
size = w*h;
const unsigned int w = glstate_.viewport_width();
const unsigned int h = glstate_.viewport_height();
const unsigned int size = w*h;
// alloc mask
......@@ -308,7 +308,7 @@ create_mask()
// mark lasso pixels
for (y = 0; y < h; ++y)
{
offset = y*w;
const unsigned int offset = y*w;
for (x = 0; x < w; ++x)
{
i = 3*(offset + x);
......
......@@ -305,11 +305,11 @@ OBJNode::read(const std::string& _filename)
int component(0), nV(0);
bool endOfVertex(false);
char *p0, *p1(s+2);
vIdx.clear();
tIdx.clear();
while(p1)
{
p0 = p1;
......@@ -317,72 +317,72 @@ OBJNode::read(const std::string& _filename)
// overwrite next separator
if (p1)
{
while (*p1 != '/' && *p1 != '\r' && *p1 != '\n' &&
*p1 != ' ' && *p1 != '\0')
p1++;
// detect end of vertex
if (*p1 != '/') endOfVertex = true;
// replace separator by '\0'
if (*p1 != '\0')
{
*p1 = '\0';
p1++; // point to next token
}
// detect end of line and break
if (*p1 == '\0' || *p1 == '\n')
p1 = 0;
while (*p1 != '/' && *p1 != '\r' && *p1 != '\n' &&
*p1 != ' ' && *p1 != '\0')
p1++;
// detect end of vertex
if (*p1 != '/') endOfVertex = true;
// replace separator by '\0'
if (*p1 != '\0')
{
*p1 = '\0';
p1++; // point to next token
}
// detect end of line and break
if (*p1 == '\0' || *p1 == '\n')
p1 = 0;
}
if (*p0 != '\0')
{
switch (component)
{
case 0: vIdx.push_back(atoi(p0)-1); break;
case 1: tIdx.push_back(atoi(p0)-1); break;
case 2: /* ignore vertex normals */ break;
}
component++;
if (endOfVertex)
{
component = 0;
nV++;
endOfVertex = false;
}
switch (component)
{
case 0: vIdx.push_back(atoi(p0)-1); break;
case 1: tIdx.push_back(atoi(p0)-1); break;
case 2: /* ignore vertex normals */ break;
}
component++;
if (endOfVertex)
{
component = 0;
nV++;
endOfVertex = false;
}
}
}
if (vIdx.size() >= 3)
{
// texture
if (vIdx.size() == tIdx.size())
{
for (unsigned int i1=1, i2=2; i2 < vIdx.size(); ++i1, ++i2)
faces_.push_back(Face(vIdx[0], vIdx[i1], vIdx[i2],
tIdx[0], tIdx[i1], tIdx[i2]));
}
// no texture
else
{
for (unsigned int i1=1, i2=2; i2 < vIdx.size(); ++i1, ++i2)
{
faces_.push_back(Face(vIdx[0], vIdx[i1], vIdx[i2]));
}
}
// texture
if (vIdx.size() == tIdx.size())
{
for (unsigned int i1=1, i2=2; i2 < vIdx.size(); ++i1, ++i2)
faces_.push_back(Face(vIdx[0], vIdx[i1], vIdx[i2],
tIdx[0], tIdx[i1], tIdx[i2]));
}
// no texture
else
{
for (unsigned int i1=1, i2=2; i2 < vIdx.size(); ++i1, ++i2)
{
faces_.push_back(Face(vIdx[0], vIdx[i1], vIdx[i2]));
}
}
}
}
s[0]=' ';
}
fclose(in);
update_face_normals();
......
......@@ -905,7 +905,6 @@ create_cp_selection_texture(GLState& /*_state*/)
return;
int texelIdx_u = 0;
int texelIdx_v = 0;
for ( int m = 0; m < cp_selection_texture_res_; ++m)
{
......@@ -919,8 +918,8 @@ create_cp_selection_texture(GLState& /*_state*/)
return;
// reset texture v coord for every new u coord
texelIdx_v = 0;
int texelIdx_v = 0;
// iterate over n direction
for ( int n = 0; n < cp_selection_texture_res_; ++n)
{
......@@ -937,15 +936,15 @@ create_cp_selection_texture(GLState& /*_state*/)
for (int i = 0; i < degree_m+1; ++i) // degree+1 basis functions (those in the span) contribute
{
int idx_m = span_u[0] + i;
for (int j = 0; j < degree_n+1; ++j) // degree+1 basis functions (those in the span) contribute
{
int idx_n = span_v[0] + j;
// basis functions sum up to 1. hence, we only have to sum up those with selected control point to get the blending weight
if (bsplineSurface_.controlpoint_selection(idx_m, idx_n))
alpha += bsplineSurface_.basisFunction( knotvec_m, idx_m, degree_m, u)
* bsplineSurface_.basisFunction( knotvec_n, idx_n, degree_n, v);
* bsplineSurface_.basisFunction( knotvec_n, idx_n, degree_n, v);
}
}
......@@ -960,8 +959,8 @@ create_cp_selection_texture(GLState& /*_state*/)
++texelIdx_u;
} // end of u direction iter
// debug, output image
// b.save("surfaceCPSelectionTexture.png", "PNG");
......@@ -1010,7 +1009,6 @@ create_knot_selection_texture(GLState& _state)
return;
int texelIdx_u = 0;
int texelIdx_v = 0;
// if a knot is selected, select all knots in the span of this knot, too
std::vector<bool> selectedKnotSpans_m(numKnots_m, false);
......@@ -1063,7 +1061,7 @@ create_knot_selection_texture(GLState& _state)
Vec2i interval_m = bsplineSurface_.interval_m(u);
// reset texture v coord for every new u coord
texelIdx_v = 0;
int texelIdx_v = 0;
for ( int n = 0; n < knot_selection_texture_res_; ++n)
{
......
......@@ -759,8 +759,8 @@ template <class PointT>
template <class MeshT, class SpatialSearchT>
void
PolyLineT<PointT>::
project_to_mesh( const std::vector<MeshT*> _mesh,
std::vector<SpatialSearchT*>* _ssearch)
project_to_mesh( const std::vector<MeshT*>& _mesh,
std::vector<SpatialSearchT*>* _ssearch)
{
typename MeshT::FaceHandle fh;
......
......@@ -249,7 +249,7 @@ public:
* @param _ssearch A spatial search to improve speed
*/
template <class MeshT, class SpatialSearchT>
void project_to_mesh( const std::vector<MeshT*> _mesh,
void project_to_mesh( const std::vector<MeshT*>& _mesh,
std::vector<SpatialSearchT*>* _ssearch = 0);
// This Block is used to pull in extended PolyLine features such as integration of
......
......@@ -126,12 +126,12 @@ PoseT<PointT>* InterpolationAnimationT<PointT>::pose(unsigned int _iFrame, Pose*
} else {
//Find the correct interpolator
Interpolator* interpolator = NULL;
unsigned long min = 0, max = 0;
unsigned long min = 0;
uint i;
for (i=0; i<interpolators_.size(); ++i) {
min = (i==0 ? 0.0 : calcAbsoluteMaxForInterpolator(i-1) + 1);
max = calcAbsoluteMaxForInterpolator(i);
const unsigned long max = calcAbsoluteMaxForInterpolator(i);
if (_iFrame >= min && _iFrame <= max) {
interpolator = interpolators_[i];
break;
......
......@@ -631,13 +631,12 @@ void SkeletonObject::showMotionPath(bool _visible)
ACG::Vec3d globTrans = ref->localTranslation(child->id());
//get animation
AnimationT<ACG::Vec3d>* animation = 0;
for (uint a = 0; a < skeleton_->animationCount(); a++){
for (unsigned int a = 0; a < skeleton_->animationCount(); a++){
AnimationHandle animHandle = AnimationHandle(a, 0 );
animation = skeleton_->animation( animHandle );
//get animation
AnimationT<ACG::Vec3d>* animation = skeleton_->animation( animHandle );
if (animation->name() == "")
continue;
......
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