Просмотр исходного кода

Bugfix : Fixed some compiler warnings and some C99 and C++11 specific syntax. ( merged from GitHub, thanks to Riku Palomäki ).

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1225 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
kimmi 13 лет назад
Родитель
Сommit
6c1cb4f159
7 измененных файлов с 13 добавлено и 12 удалено
  1. 4 1
      code/BlenderLoader.cpp
  2. 1 1
      code/BlenderLoader.h
  3. 1 1
      code/IFCGeometry.cpp
  4. 3 3
      code/IFCLoader.cpp
  5. 1 1
      code/IFCUtil.cpp
  6. 0 4
      code/M3Importer.cpp
  7. 3 1
      code/PolyTools.h

+ 4 - 1
code/BlenderLoader.cpp

@@ -63,11 +63,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #	endif
 #endif
 
+namespace Assimp {
+	template<> const std::string LogFunctions<BlenderImporter>::log_prefix = "BLEND: ";
+}
+
 using namespace Assimp;
 using namespace Assimp::Blender;
 using namespace Assimp::Formatter;
 
-template<> const std::string LogFunctions<BlenderImporter>::log_prefix = "BLEND: ";
 static const aiLoaderDesc blenderDesc = {
 	"Blender 3D Importer \nhttp://www.blender3d.org",
 	"Assimp Team",

+ 1 - 1
code/BlenderLoader.h

@@ -95,7 +95,7 @@ enum aiLoaderFlags
 
 	aiLoaderFlags_Experimental = 0x10,
 	aiLoaderFlags_Testing = 0x20,
-	aiLoaderFlags_Production = 0x40,
+	aiLoaderFlags_Production = 0x40
 };
 
 struct aiLoaderDesc 

+ 1 - 1
code/IFCGeometry.cpp

@@ -554,7 +554,7 @@ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh) {
 	// The input polygon is arbitrarily shaped, so we might need some tries
 	// until we find a suitable normal (and it does not even need to be
 	// right in all cases, Newell's algorithm would be the correct one ... ).
-	size_t base = s-curmesh.vertcnt.back(), t = base, i, j;
+	size_t base = s-curmesh.vertcnt.back(), i, j;
 	for (i = base; i < s-1; ++i) {
 		for (j = i+1; j < s; ++j) {
 			nor = -((out[i]-any_point)^(out[j]-any_point));

+ 3 - 3
code/IFCLoader.cpp

@@ -57,14 +57,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "StreamReader.h"
 #include "MemoryIOWrapper.h"
 
+namespace Assimp {
+	template<> const std::string LogFunctions<IFCImporter>::log_prefix = "IFC: ";
+}
 
 using namespace Assimp;
 using namespace Assimp::Formatter;
 using namespace Assimp::IFC;
 
-template<> const std::string LogFunctions<IFCImporter>::log_prefix = "IFC: ";
-
-
 /* DO NOT REMOVE this comment block. The genentitylist.sh script
  * just looks for names adhering to the IfcSomething naming scheme
  * and includes all matches in the whitelist for code-generation. Thus,

+ 1 - 1
code/IFCUtil.cpp

@@ -63,7 +63,7 @@ void TempOpening::Transform(const IfcMatrix4& mat)
 // ------------------------------------------------------------------------------------------------
 aiMesh* TempMesh::ToMesh() 
 {
-	ai_assert(verts.size() == std::accumulate(vertcnt.begin(),vertcnt.end(),0));
+	ai_assert(verts.size() == std::accumulate(vertcnt.begin(),vertcnt.end(),size_t(0)));
 
 	if (verts.empty()) {
 		return NULL;

+ 0 - 4
code/M3Importer.cpp

@@ -119,7 +119,6 @@ void M3Importer::InternReadFile( const std::string& pFile, aiScene* pScene, IOSy
 	uint16* faces( NULL );
 
 	uint32 nVertices = 0;
-	uint32 nFaces = 0;
 
 	bool ok = true;
 	switch( m_pRefs[ m_pHead->MODL.ref ].type )	{
@@ -168,7 +167,6 @@ void M3Importer::InternReadFile( const std::string& pFile, aiScene* pScene, IOSy
 	
 	// Get the face data
 	faces = GetEntries<uint16>( pViews->faces );
-	nFaces = pViews->faces.nEntries;
 
 	// Convert the vertices
 	std::vector<aiVector3D> vertices;
@@ -319,8 +317,6 @@ void M3Importer::createVertexData( aiMesh *pMesh, const std::vector<aiVector3D>
 								  const std::vector<aiVector3D> &uvCoords,
 								  const std::vector<aiVector3D> &normals )
 {
-	unsigned int numIndices = 0;
-
 	pMesh->mNumVertices = pMesh->mNumFaces * 3;
 	pMesh->mVertices = new aiVector3D[ pMesh->mNumVertices ];
 	pMesh->mNumUVComponents[ 0 ] = 2;

+ 3 - 1
code/PolyTools.h

@@ -104,7 +104,9 @@ inline bool IsCCW(T* in, size_t npoints) {
 	double convex_turn;
 	double convex_sum = 0;
 
-	for (int i = 0; i < npoints - 2; i++) {
+	ai_assert(npoints >= 3);
+
+	for (size_t i = 0; i < npoints - 2; i++) {		
 		aa = ((in[i+2].x - in[i].x) * (in[i+2].x - in[i].x)) +
 			((-in[i+2].y + in[i].y) * (-in[i+2].y + in[i].y));