Преглед изворни кода

fix some errors/warnings found by static code analyzer

abma пре 10 година
родитељ
комит
b1221ade64

+ 1 - 1
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
 };

+ 2 - 2
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))

+ 1 - 1
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();

+ 1 - 2
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;
 		}
 

+ 3 - 3
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)
 	// <folder>\Scenes\<hh>\<*>.lws
 	// where <hh> 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;
 	}

+ 1 - 1
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;
 	}

+ 1 - 1
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;
 	}