Procházet zdrojové kódy

Merge pull request #27 from assimp/clang-fixes

Clang fixes based on this clang build: https://travis-ci.org/assimp/assimp/jobs/6158706

This silences false positives and fixes any real issues pointed out by clang - at least two of which were critical.
Alexander Gessler před 12 roky
rodič
revize
68f3f4c80a

+ 7 - 0
code/FBXConverter.cpp

@@ -419,6 +419,8 @@ private:
 			return "Scaling";
 		case TransformationComp_ScalingPivotInverse:
 			return "ScalingPivotInverse";
+		case TransformationComp_MAXIMUM: // this is to silence compiler warnings
+			break;
 		}
 
 		ai_assert(false);
@@ -454,6 +456,8 @@ private:
 			return "Lcl Scaling";
 		case TransformationComp_ScalingPivotInverse:
 			return "ScalingPivotInverse";
+		case TransformationComp_MAXIMUM: // this is to silence compiler warnings
+			break;
 		}
 
 		ai_assert(false);
@@ -1608,6 +1612,9 @@ private:
 
 			case FileGlobalSettings::FrameRate_CUSTOM:
 				return customFPSVal;
+
+			case FileGlobalSettings::FrameRate_MAX: // this is to silence compiler warnings
+				break;
 		}
 
 		ai_assert(false);

+ 3 - 0
code/FBXUtil.cpp

@@ -72,6 +72,9 @@ const char* TokenTypeString(TokenType t)
 
 		case TokenType_KEY:
 			return "TOK_KEY";
+
+		case TokenType_BINARY_DATA:
+			return "TOK_BINARY_DATA";
 	}
 
 	ai_assert(false);

+ 1 - 1
code/IFCBoolean.cpp

@@ -245,7 +245,7 @@ bool IntersectsBoundaryProfile( const IfcVector3& e0, const IfcVector3& e1, cons
 			// directly on the vertex between two segments.
 			if (!intersected_boundary_points.empty() && intersected_boundary_segments.back()==i-1 ) {
 				const IfcVector3 diff = intersected_boundary_points.back() - p;
-				if(IfcVector3((diff.x, diff.y)).SquareLength() < 1e-7) {
+				if(IfcVector2(diff.x, diff.y).SquareLength() < 1e-7) {
 					continue;
 				}
 			}

+ 5 - 4
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] + (":\\" + in.substr(2));
 	}
 	else tmp = in;
 
@@ -480,11 +480,12 @@ std::string LWSImporter::FindLWOFile(const std::string& in)
 	// <folder>\Scenes\<hh>\<*>.lws
 	// where <hh> is optional.
 
-	std::string test = ".." + io->getOsSeparator() + tmp; 
-	if (io->Exists(test))
+	std::string test = ".." + (io->getOsSeparator() + tmp); 
+	if (io->Exists(test)) {
 		return test;
+	}
 
-	test = ".." + io->getOsSeparator() + test; 
+	test = ".." + (io->getOsSeparator() + test); 
 	if (io->Exists(test)) {
 		return test;
 	}

+ 0 - 1
code/MD5Loader.cpp

@@ -187,7 +187,6 @@ void MD5Importer::LoadFileIntoMemory (IOStream* file)
 	ai_assert(fileSize);
 
 	// allocate storage and copy the contents of the file to a memory buffer
-	pScene = pScene;
 	mBuffer = new char[fileSize+1];
 	file->Read( (void*)mBuffer, 1, fileSize);
 	iLineNumber = 1;

+ 3 - 0
code/XGLLoader.cpp

@@ -77,8 +77,11 @@ struct free_it
 	void* free;
 };
 
+namespace Assimp { // this has to be in here because LogFunctions is in ::Assimp
 template<> const std::string LogFunctions<XGLImporter>::log_prefix = "XGL: ";
 
+}
+
 static const aiImporterDesc desc = {
 	"XGL Importer",
 	"",