From b1221ade6452c09d131477a425f300d334dc5cbe Mon Sep 17 00:00:00 2001 From: abma Date: Tue, 16 Dec 2014 23:41:10 +0100 Subject: [PATCH] fix some errors/warnings found by static code analyzer --- code/3DSHelper.h | 2 +- code/ASEParser.cpp | 4 ++-- code/B3DImporter.cpp | 2 +- code/FindInstancesProcess.cpp | 3 +-- code/LWSLoader.cpp | 6 +++--- code/PlyParser.cpp | 2 +- code/Q3BSPFileImporter.cpp | 2 +- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/code/3DSHelper.h b/code/3DSHelper.h index adf1a2ff4..28b31c2b6 100644 --- a/code/3DSHelper.h +++ b/code/3DSHelper.h @@ -468,7 +468,7 @@ struct aiFloatKey {return mTime < o.mTime;} bool operator > (const aiFloatKey& o) const - {return mTime < o.mTime;} + {return mTime > o.mTime;} #endif }; diff --git a/code/ASEParser.cpp b/code/ASEParser.cpp index b1bee0461..cba206d72 100644 --- a/code/ASEParser.cpp +++ b/code/ASEParser.cpp @@ -1525,7 +1525,7 @@ void Parser::ParseLV3MeshWeightsBlock(ASE::Mesh& mesh) continue; } // Number of bones - if (TokenMatch(filePtr,"MESH_NUMBONE" ,11)) + if (TokenMatch(filePtr,"MESH_NUMBONE" ,12)) { ParseLV4MeshLong(iNumBones); continue; @@ -1559,7 +1559,7 @@ void Parser::ParseLV4MeshBones(unsigned int iNumBones,ASE::Mesh& mesh) ++filePtr; // Mesh bone with name ... - if (TokenMatch(filePtr,"MESH_BONE_NAME" ,16)) + if (TokenMatch(filePtr,"MESH_BONE_NAME" ,14)) { // parse an index ... if(SkipSpaces(&filePtr)) diff --git a/code/B3DImporter.cpp b/code/B3DImporter.cpp index 53c744d54..20e4cff94 100644 --- a/code/B3DImporter.cpp +++ b/code/B3DImporter.cpp @@ -548,7 +548,7 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){ void B3DImporter::ReadBB3D( aiScene *scene ){ _textures.clear(); - _materials.size(); + _materials.clear(); _vertices.clear(); _meshes.clear(); diff --git a/code/FindInstancesProcess.cpp b/code/FindInstancesProcess.cpp index 278f01115..3b8578142 100644 --- a/code/FindInstancesProcess.cpp +++ b/code/FindInstancesProcess.cpp @@ -85,8 +85,7 @@ bool CompareBones(const aiMesh* orig, const aiMesh* inst) aiBone* oha = inst->mBones[i]; if (aha->mNumWeights != oha->mNumWeights || - aha->mOffsetMatrix != oha->mOffsetMatrix || - aha->mNumWeights != oha->mNumWeights) { + aha->mOffsetMatrix != oha->mOffsetMatrix) { return false; } diff --git a/code/LWSLoader.cpp b/code/LWSLoader.cpp index 0ff3f9e10..bfd4b395c 100644 --- a/code/LWSLoader.cpp +++ b/code/LWSLoader.cpp @@ -464,7 +464,7 @@ std::string LWSImporter::FindLWOFile(const std::string& in) std::string tmp; if (in.length() > 3 && in[1] == ':'&& in[2] != '\\' && in[2] != '/') { - tmp = in[0] + (":\\" + in.substr(2)); + tmp = in[0] + (std::string(":\\") + in.substr(2)); } else tmp = in; @@ -480,12 +480,12 @@ std::string LWSImporter::FindLWOFile(const std::string& in) // \Scenes\\<*>.lws // where is optional. - std::string test = ".." + (io->getOsSeparator() + tmp); + std::string test = std::string("..") + (io->getOsSeparator() + tmp); if (io->Exists(test)) { return test; } - test = ".." + (io->getOsSeparator() + test); + test = std::string("..") + (io->getOsSeparator() + test); if (io->Exists(test)) { return test; } diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 67f5b0bc8..6687ca9ed 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -182,7 +182,7 @@ PLY::ESemantic PLY::Property::ParseSemantic(const char* pCur,const char** pCurOu { eOut = PLY::EST_Opacity; } - else if (TokenMatch(pCur,"specular_power",6)) + else if (TokenMatch(pCur,"specular_power",14)) { eOut = PLY::EST_PhongPower; } diff --git a/code/Q3BSPFileImporter.cpp b/code/Q3BSPFileImporter.cpp index c7b829843..2c87d2a82 100644 --- a/code/Q3BSPFileImporter.cpp +++ b/code/Q3BSPFileImporter.cpp @@ -630,7 +630,7 @@ aiFace *Q3BSPFileImporter::getNextFace( aiMesh *pMesh, unsigned int &rFaceIdx ) bool Q3BSPFileImporter::importTextureFromArchive( const Q3BSP::Q3BSPModel *pModel, Q3BSP::Q3BSPZipArchive *pArchive, aiScene*, aiMaterial *pMatHelper, int textureId ) { - if ( NULL == pArchive || NULL == pArchive || NULL == pMatHelper ) { + if ( NULL == pArchive || NULL == pMatHelper ) { return false; }