Commit 6687eabe authored by Christopher Tenter's avatar Christopher Tenter

fix several cppcheck warnings

parent 6d0648b3
Pipeline #3751 passed with stage
in 64 minutes and 19 seconds
......@@ -86,7 +86,7 @@ const float GLState::default_shininess(100.f);
bool GLState::depthFuncLock_ = false;
bool GLState::depthRangeLock_ = false;
bool GLState::blendFuncSeparateLock_[2] = { false };
bool GLState::blendFuncSeparateLock_[] = { false };
bool GLState::blendEquationLock_ = false;
bool GLState::blendColorLock_ = false;
bool GLState::alphaFuncLock_ = false;
......@@ -101,9 +101,9 @@ bool GLState::programLock_ = false;
std::deque <GLStateContext> GLState::stateStack_;
std::bitset<0xFFFF+1> GLState::glStateLock_;
int GLState::glBufferTargetLock_[4] = {0};
int GLState::glTextureStageLock_[16] = {0};
bool GLState::framebufferLock_[2] = {false};
int GLState::glBufferTargetLock_[] = {0};
int GLState::glTextureStageLock_[] = {0};
bool GLState::framebufferLock_[] = {false};
int GLState::maxTextureCoords_ = 0;
int GLState::maxCombinedTextureImageUnits_ = 0;
int GLState::maxDrawBuffers_ = 0;
......@@ -1142,7 +1142,7 @@ bool GLState::color_picking () const
//-----------------------------------------------------------------------------
GLenum GLState::glStateCaps[95] = {GL_ALPHA_TEST,
GLenum GLState::glStateCaps[] = {GL_ALPHA_TEST,
GL_AUTO_NORMAL,
GL_MAP2_VERTEX_3,
GL_MAP2_VERTEX_4,
......
......@@ -2336,12 +2336,24 @@ void ShaderProgGenerator::scanShaderTemplate(QStringList& _templateSrc, QString
QByteArray lineBytes = trimmedLine.toUtf8();
int templateVersion = 0;
if (sscanf(lineBytes.constData(), "#version %d", &templateVersion) == 1)
if (trimmedLine.startsWith("#version "))
{
desc_.version = std::max(templateVersion, desc_.version);
QStringList tokens = trimmedLine.split(' ');
// remove version line from template since this is added later in the build functions
it = _templateSrc.erase(it);
if (tokens.size() > 1)
{
// templateVersion
bool convOk = false;
templateVersion = tokens.at(1).toInt(&convOk);
if (convOk)
{
desc_.version = std::max(templateVersion, desc_.version);
// remove version line from template since this is added later in the build functions
it = _templateSrc.erase(it);
}
}
}
// scan layout() directive
else if (trimmedLine.startsWith("layout(") || trimmedLine.startsWith("layout ("))
......
......@@ -966,7 +966,6 @@ TranslationManipulatorNode::mouseEvent(GLState& _state, QMouseEvent* _event)
Vec3d oldPoint3D;
Vec2i newPoint2D(_event->pos().x(), _event->pos().y());
Vec3d newPoint3D;
bool rot[3], trans[3];
unsigned int i;
bool lockOldPoint = false;
......@@ -1135,6 +1134,7 @@ TranslationManipulatorNode::mouseEvent(GLState& _state, QMouseEvent* _event)
}
// set action for the different modes
bool rot[3], trans[3];
switch (mode_) {
case Rotation:
for (i = 0; i < 3; i++) {
......
......@@ -84,8 +84,9 @@ namespace GLSL {
}
void UniformPool::operator =(const UniformPool& _other) {
UniformPool& UniformPool::operator =(const UniformPool& _other) {
addPool(_other);
return *this;
}
void UniformPool::clear() {
......
......@@ -124,7 +124,7 @@ namespace GLSL {
/** \brief copy
*
*/
void operator =(const UniformPool& _other);
UniformPool& operator =(const UniformPool& _other);
private:
struct UniformBase {
......
......@@ -69,7 +69,7 @@ namespace ACG {
// static variables
char Tracing::progress_[4] = { '-', '\\', '|', '/' };
char Tracing::progress_[] = { '-', '\\', '|', '/' };
unsigned char Tracing::idx_ = 0;
......
......@@ -1527,8 +1527,8 @@ PolyLineT<PointT>::
edge_points_in_segment( const MeshT& _mesh,
const Point& _p0,
const Point& _p1,
const typename MeshT::FaceHandle _fh0,
const typename MeshT::FaceHandle _fh1,
const typename MeshT::FaceHandle& _fh0,
const typename MeshT::FaceHandle& _fh1,
std::vector<Point> & _points,
std::vector<typename MeshT::EdgeHandle>& _ehandles )
{
......
......@@ -641,8 +641,8 @@ private:
void edge_points_in_segment( const MeshT& _mesh,
const Point& _p0,
const Point& _p1,
const typename MeshT::FaceHandle _fh0,
const typename MeshT::FaceHandle _fh1,
const typename MeshT::FaceHandle& _fh0,
const typename MeshT::FaceHandle& _fh1,
std::vector<Point> & _points,
std::vector<typename MeshT::EdgeHandle>& _ehandles );
......
......@@ -257,7 +257,7 @@ inline std::string JointT<PointT>::name() const {
//-----------------------------------------------------------------------------------------------------
template<typename PointT>
inline void JointT<PointT>::setName(const std::string _name) {
inline void JointT<PointT>::setName(const std::string& _name) {
name_ = _name;
}
......
......@@ -113,7 +113,7 @@ public:
/// Access the name of the joint
inline std::string name() const;
inline void setName(const std::string _name);
inline void setName(const std::string& _name);
private:
/// An unique identifier, guaranteed to be part of a continuous sequence starting from 0
......
......@@ -97,9 +97,9 @@ SplatCloudNode::SplatCloudNode( const SplatCloud &_splatCloud, BaseNode *_parent
defaultColor_ ( Color (0,0,0) ),
defaultNormal_ ( Normal (0,0,0) ),
defaultPointsize_ ( Pointsize( 0.0) ),
splatsDrawMode_ ( DrawModes::NONE ),
dotsDrawMode_ ( DrawModes::NONE ),
pointsDrawMode_ ( DrawModes::NONE ),
splatsDrawMode_ ( DrawModes::addDrawMode( "Splats" ) ),
dotsDrawMode_ ( DrawModes::addDrawMode( "Dots" ) ),
pointsDrawMode_ ( DrawModes::addDrawMode( "Points" ) ),
pickingBaseIndex_ ( 0 ),
pickDrawMode_ ( DrawModes::NONE ), // TODO: hack, see enterPick()
vboGlId_ ( 0 ),
......@@ -112,11 +112,6 @@ SplatCloudNode::SplatCloudNode( const SplatCloud &_splatCloud, BaseNode *_parent
vboSelectionsOffset_( -1 ),
vboPickColorsOffset_( -1 )
{
// add (possibly) new drawmodes
pointsDrawMode_ = DrawModes::addDrawMode( "Points" );
dotsDrawMode_ = DrawModes::addDrawMode( "Dots" );
splatsDrawMode_ = DrawModes::addDrawMode( "Splats" );
// create a new VBO (will be invalid and rebuilt the next time drawn (or picked))
createVBO();
}
......
......@@ -1048,9 +1048,9 @@ void FileOBJPlugin::readOBJFile(QByteArray& _bufferedFile, QString _filename, OB
// Read knots at the beginning before the indices
if ( keyWrd == QLatin1String("curv") ) {
double trash;
trash = getDouble(lineData);
trash = getDouble(lineData);
// skip next two doubles in stream
getDouble(lineData);
getDouble(lineData);
}
......@@ -1576,9 +1576,9 @@ void FileOBJPlugin::checkTypes(QByteArray& _bufferedFile, QString _filename, OBJ
// Read knots at the beginning before the indices
if ( keyWrd == QLatin1String("curv") ) {
double trash;
trash = getDouble(lineData);
trash = getDouble(lineData);
// skip next two doubles in stream
getDouble(lineData);
getDouble(lineData);
}
// work on the line until nothing left to read
......
......@@ -153,7 +153,6 @@ int FileOpenVolumeMeshPlugin::loadObject(QString _filename) {
int id = -1;
bool hexMesh = false;
bool tetMesh = false;
if(!OpenFlipper::Options::nogui() && typeCheck_->currentIndex() == 0) {
hexMesh = fileManager_.isHexahedralMesh(_filename.toStdString());
......@@ -162,6 +161,7 @@ int FileOpenVolumeMeshPlugin::loadObject(QString _filename) {
}
#ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT
bool tetMesh = false;
if(!OpenFlipper::Options::nogui() && typeCheck_->currentIndex() == 0) {
tetMesh = fileManager_.isTetrahedralMesh(_filename.toStdString());
} else if (!OpenFlipper::Options::nogui() && typeCheck_->currentIndex() == 3) {
......
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