Browse Source

Merge pull request #561 from LegalizeAdulthood/warnings

Fix compiler warnings
Kim Kulling 10 years ago
parent
commit
4bdf23aece

+ 4 - 3
code/3DSExporter.cpp

@@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "SceneCombiner.h"
 #include "SplitLargeMeshes.h"
 #include "StringComparison.h"
-#include "../include/assimp/IOSystem.hpp"
-#include "../include/assimp/DefaultLogger.hpp"
-#include "../include/assimp/Exporter.hpp"
+#include "../include/assimp/IOSystem.hpp"
+#include "../include/assimp/DefaultLogger.hpp"
+#include "../include/assimp/Exporter.hpp"
 #include <memory>
 
 using namespace Assimp;
@@ -324,6 +324,7 @@ void Discreet3DSExporter::WriteMaterials()
 				break;
 
 			default:
+				shading_mode_out = Discreet3DS::Flat;
 				ai_assert(false);
 			};
 			writer.PutU2(static_cast<uint16_t>(shading_mode_out));

+ 0 - 21
code/FBXParser.cpp

@@ -86,27 +86,6 @@ namespace {
 	}
 
 
-	// ------------------------------------------------------------------------------------------------
-	// print warning, do return
-	void ParseWarning(const std::string& message, const Token& token)
-	{
-		if(DefaultLogger::get()) {
-			DefaultLogger::get()->warn(Util::AddTokenText("FBX-Parser",message,&token));
-		}
-	}
-
-	// ------------------------------------------------------------------------------------------------
-/*	void ParseWarning(const std::string& message, const Element* element = NULL)
-	{
-		if(element) {
-			ParseWarning(message,element->KeyToken());
-			return;
-		}
-		if(DefaultLogger::get()) {
-			DefaultLogger::get()->warn("FBX-Parser: " + message);
-		}
-	}
-*/
 	// ------------------------------------------------------------------------------------------------
 	void ParseError(const std::string& message, TokenPtr token)
 	{

+ 0 - 10
code/IFCCurve.cpp

@@ -173,7 +173,6 @@ public:
 	// --------------------------------------------------
 	Line(const IfcLine& entity, ConversionData& conv) 
 		: Curve(entity,conv)
-		, entity(entity)
 	{
 		ConvertCartesianPoint(p,entity.Pnt);
 		ConvertVector(v,entity.Dir);
@@ -221,7 +220,6 @@ public:
 	}
 
 private:
-	const IfcLine& entity;
 	IfcVector3 p,v;
 };
 
@@ -238,7 +236,6 @@ public:
 	// --------------------------------------------------
 	CompositeCurve(const IfcCompositeCurve& entity, ConversionData& conv) 
 		: BoundedCurve(entity,conv)
-		, entity(entity)
 		, total()
 	{
 		curves.reserve(entity.Segments.size());
@@ -331,7 +328,6 @@ public:
 	}
 
 private:
-	const IfcCompositeCurve& entity;
 	std::vector< CurveEntry > curves;
 
 	IfcFloat total;
@@ -349,8 +345,6 @@ public:
 	// --------------------------------------------------
 	TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv) 
 		: BoundedCurve(entity,conv)
-		, entity(entity)
-		, ok()
 	{
 		base = boost::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv));
 
@@ -448,11 +442,9 @@ private:
 
 
 private:
-	const IfcTrimmedCurve& entity;
 	ParamRange range;
 	IfcFloat maxval;
 	bool agree_sense;
-	bool ok;
 
 	boost::shared_ptr<const Curve> base;
 };
@@ -469,7 +461,6 @@ public:
 	// --------------------------------------------------
 	PolyLine(const IfcPolyline& entity, ConversionData& conv) 
 		: BoundedCurve(entity,conv)
-		, entity(entity)
 	{
 		points.reserve(entity.Points.size());
 
@@ -507,7 +498,6 @@ public:
 	}
 
 private:
-	const IfcPolyline& entity;
 	std::vector<IfcVector3> points;
 };
 

+ 6 - 18
code/IFCLoader.cpp

@@ -60,9 +60,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "StreamReader.h"
 #include "MemoryIOWrapper.h"
-#include "../include/assimp/scene.h"
-#include "../include/assimp/Importer.hpp"
-
+#include "../include/assimp/scene.h"
+#include "../include/assimp/Importer.hpp"
+
 
 namespace Assimp {
 	template<> const std::string LogFunctions<IFCImporter>::log_prefix = "IFC: ";
@@ -93,8 +93,6 @@ namespace {
 void SetUnits(ConversionData& conv);
 void SetCoordinateSpace(ConversionData& conv);
 void ProcessSpatialStructures(ConversionData& conv);
-aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el ,ConversionData& conv);
-void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, ConversionData& conv);
 void MakeTreeRelative(ConversionData& conv);
 void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv);
 
@@ -421,16 +419,6 @@ void ResolveObjectPlacement(aiMatrix4x4& m, const IfcObjectPlacement& place, Con
 	}
 }
 
-// ------------------------------------------------------------------------------------------------
-void GetAbsTransform(aiMatrix4x4& out, const aiNode* nd, ConversionData& conv)
-{
-	aiMatrix4x4 t;
-	if (nd->mParent) {
-		GetAbsTransform(t,nd->mParent,conv);
-	}
-	out = t*nd->mTransformation;
-}
-
 // ------------------------------------------------------------------------------------------------
 bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv)
 {
@@ -682,14 +670,14 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
 	// skip over space and annotation nodes - usually, these have no meaning in Assimp's context
 	bool skipGeometry = false;
 	if(conv.settings.skipSpaceRepresentations) {
-		if(const IfcSpace* const space = el.ToPtr<IfcSpace>()) {
+		if(el.ToPtr<IfcSpace>()) {
 			IFCImporter::LogDebug("skipping IfcSpace entity due to importer settings");
 			skipGeometry = true;
 		}
 	}
 
 	if(conv.settings.skipAnnotations) {
-		if(const IfcAnnotation* const ann = el.ToPtr<IfcAnnotation>()) {
+		if(el.ToPtr<IfcAnnotation>()) {
 			IFCImporter::LogDebug("skipping IfcAnnotation entity due to importer settings");
 			return NULL;
 		}
@@ -764,7 +752,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
 					continue;
 				}
 				BOOST_FOREACH(const IfcProduct& pro, cont->RelatedElements) {		
-					if(const IfcOpeningElement* const open = pro.ToPtr<IfcOpeningElement>()) {
+					if(pro.ToPtr<IfcOpeningElement>()) {
 						// IfcOpeningElement is handled below. Sadly we can't use it here as is:
 						// The docs say that opening elements are USUALLY attached to building storey,
 						// but we want them for the building elements to which they belong.

+ 1 - 1
code/IFCProfile.cpp

@@ -114,7 +114,7 @@ void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh&
 		meshout.vertcnt.push_back(4);
 	}
 	else if( const IfcCircleProfileDef* const circle = def.ToPtr<IfcCircleProfileDef>()) {
-		if( const IfcCircleHollowProfileDef* const hollow = def.ToPtr<IfcCircleHollowProfileDef>()) {
+		if(def.ToPtr<IfcCircleHollowProfileDef>()) {
 			// TODO
 		}
 		const size_t segments = 32;

+ 8 - 9
code/OpenGEXImporter.cpp

@@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/scene.h>
 #include <assimp/ai_assert.h>
 
+#include <algorithm>
 #include <vector>
 
 static const aiImporterDesc desc = {
@@ -183,12 +184,11 @@ USE_ODDLPARSER_NS
 //------------------------------------------------------------------------------------------------
 OpenGEXImporter::VertexContainer::VertexContainer()
 : m_numVerts( 0 )
-, m_vertices()
+, m_vertices(NULL)
 , m_numNormals( 0 )
-, m_normals()
-, m_textureCoords()
-, m_numUVComps() {
-    // empty
+, m_normals(NULL) {
+    std::fill(&m_numUVComps[0], &m_numUVComps[AI_MAX_NUMBER_OF_TEXTURECOORDS], 0U);
+    std::fill(&m_textureCoords[0], &m_textureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS], static_cast<aiVector3D *>(NULL));
 }
 
 //------------------------------------------------------------------------------------------------
@@ -215,9 +215,9 @@ OpenGEXImporter::RefInfo::~RefInfo() {
 
 //------------------------------------------------------------------------------------------------
 OpenGEXImporter::OpenGEXImporter() 
-: m_meshCache()
-, m_root( NULL )
+: m_root( NULL )
 , m_nodeChildMap()
+, m_meshCache()
 , m_mesh2refMap()
 , m_ctx( NULL )
 , m_currentNode( NULL )
@@ -226,7 +226,7 @@ OpenGEXImporter::OpenGEXImporter()
 , m_tokenType( Grammar::NoneType )
 , m_nodeStack()
 , m_unresolvedRefStack() {
-    // empty
+    std::fill(&m_metrics[0], &m_metrics[MetricInfo::Max], MetricInfo());
 }
 
 //------------------------------------------------------------------------------------------------
@@ -665,7 +665,6 @@ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene
         }
 
         const size_t numItems( countDataArrayListItems( vaList ) );
-        Value *next( vaList->m_dataList );
         if( Position == attribType ) {
             m_currentVertices.m_numVerts = numItems;
             m_currentVertices.m_vertices = new aiVector3D[ numItems ];

+ 0 - 3
code/OptimizeMeshes.h

@@ -164,9 +164,6 @@ private:
 	//! Per mesh info
 	std::vector<MeshInfo> meshes;
 
-	//! Next output mesh
-	aiMesh* mesh;
-
 	//! Output meshes
 	std::vector<aiMesh*> output;
 

+ 7 - 8
code/PlyExporter.cpp

@@ -43,14 +43,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #if !defined(ASSIMP_BUILD_NO_EXPORT) && !defined(ASSIMP_BUILD_NO_PLY_EXPORTER)
 
 #include "PlyExporter.h"
-#include <boost/scoped_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
 #include <cmath>
-#include "Exceptional.h"
-#include "../include/assimp/scene.h"
-#include "../include/assimp/version.h"
-#include "../include/assimp/IOSystem.hpp"
+#include "Exceptional.h"
+#include "../include/assimp/scene.h"
+#include "../include/assimp/version.h"
+#include "../include/assimp/IOSystem.hpp"
 #include "../include/assimp/Exporter.hpp"
-#include "qnan.h"
+#include "qnan.h"
 
 
 using namespace Assimp;
@@ -96,8 +96,7 @@ void ExportScenePlyBinary(const char* pFile, IOSystem* pIOSystem, const aiScene*
 // ------------------------------------------------------------------------------------------------
 PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool binary)
 : filename(_filename)
-, pScene(pScene)
-, endl("\n") 
+, endl("\n")
 {
 	// make sure that all formatting happens using the standard, C locale and not the user's current locale
 	const std::locale& l = std::locale("C");

+ 0 - 1
code/PlyExporter.h

@@ -78,7 +78,6 @@ private:
 private:
 
 	const std::string filename;
-	const aiScene* const pScene;
 
 	// obviously, this endl() doesn't flush() the stream 
 	const std::string endl;

+ 1 - 23
code/STEPFileReader.cpp

@@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "STEPFileReader.h"
 #include "STEPFileEncoding.h"
 #include "TinyFormatter.h"
-#include "fast_atof.h"
+#include "fast_atof.h"
 #include <boost/make_shared.hpp>
 
 
@@ -55,28 +55,6 @@ namespace EXPRESS = STEP::EXPRESS;
 
 #include <functional>
 
-// ------------------------------------------------------------------------------------------------
-// From http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
-
-// trim from start
-static inline std::string &ltrim(std::string &s) {
-	s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1( std::ptr_fun(Assimp::IsSpace<char>))));
-	return s;
-}
-
-// trim from end
-static inline std::string &rtrim(std::string &s) {
-	s.erase(std::find_if(s.rbegin(), s.rend(), std::not1( std::ptr_fun(Assimp::IsSpace<char>))).base(),s.end());
-	return s;
-}
-// trim from both ends
-static inline std::string &trim(std::string &s) {
-	return ltrim(rtrim(s));
-}
-
-
-
-
 // ------------------------------------------------------------------------------------------------
 std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = "") 
 {

+ 8 - 9
code/STLExporter.cpp

@@ -43,13 +43,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #if !defined(ASSIMP_BUILD_NO_EXPORT) && !defined(ASSIMP_BUILD_NO_STL_EXPORTER)
 
 #include "STLExporter.h"
-#include "../include/assimp/version.h"
-#include "../include/assimp/IOSystem.hpp"
-#include "../include/assimp/scene.h"
-#include "../include/assimp/Exporter.hpp"
-#include <boost/scoped_ptr.hpp>
-#include "Exceptional.h"
-#include "ByteSwapper.h"
+#include "../include/assimp/version.h"
+#include "../include/assimp/IOSystem.hpp"
+#include "../include/assimp/scene.h"
+#include "../include/assimp/Exporter.hpp"
+#include <boost/scoped_ptr.hpp>
+#include "Exceptional.h"
+#include "ByteSwapper.h"
 
 using namespace Assimp;
 namespace Assimp	{
@@ -89,8 +89,7 @@ void ExportSceneSTLBinary(const char* pFile,IOSystem* pIOSystem, const aiScene*
 // ------------------------------------------------------------------------------------------------
 STLExporter :: STLExporter(const char* _filename, const aiScene* pScene, bool binary)
 : filename(_filename)
-, pScene(pScene)
-, endl("\n") 
+, endl("\n")
 {
 	// make sure that all formatting happens using the standard, C locale and not the user's current locale
 	const std::locale& l = std::locale("C");

+ 0 - 1
code/STLExporter.h

@@ -75,7 +75,6 @@ private:
 private:
 
 	const std::string filename;
-	const aiScene* const pScene;
 
 	// this endl() doesn't flush() the stream
 	const std::string endl;

+ 1 - 21
code/StepExporter.cpp

@@ -115,21 +115,6 @@ void ExportSceneStep(const char* pFile,IOSystem* pIOSystem, const aiScene* pScen
 
 
 namespace {
-	inline uint64_t toIndexHash(int32_t id1, int32_t id2)
-	{
-		// dont wonder that -1/-1 -> hash=-1
-		uint64_t hash = (uint32_t) id1;
-		hash = (hash << 32);
-		hash += (uint32_t) id2;
-		return hash;
-	}
-
-	inline void fromIndexHash(uint64_t hash, int32_t &id1, int32_t &id2)
-	{
-		id1 = (hash & 0xFFFFFFFF00000000) >> 32;
-		id2 = (hash & 0xFFFFFFFF);
-	}
-
 	// Collect world transformations for each node
 	void CollectTrafos(const aiNode* node, std::map<const aiNode*, aiMatrix4x4>& trafos) {
 		const aiMatrix4x4& parent = node->mParent ? trafos[node->mParent] : aiMatrix4x4();
@@ -152,7 +137,7 @@ namespace {
 
 // ------------------------------------------------------------------------------------------------
 // Constructor for a specific scene to export
-StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mIOSystem(pIOSystem), mPath(path), mFile(file), mProperties(pProperties)
+StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mProperties(pProperties), mIOSystem(pIOSystem), mFile(file), mPath(path), mScene(pScene), endstr(";\n")
 {
 	CollectTrafos(pScene->mRootNode, trafos);
 	CollectMeshes(pScene->mRootNode, meshes);
@@ -160,11 +145,6 @@ StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std
 	// make sure that all formatting happens using the standard, C locale and not the user's current locale
 	mOutput.imbue( std::locale("C") );
 
-	mScene = pScene;
-
-	// set up strings
-	endstr = ";\n";
-
 	// start writing
 	WriteFile();
 }

+ 8 - 7
code/XFileExporter.cpp

@@ -95,17 +95,18 @@ void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pSce
 
 // ------------------------------------------------------------------------------------------------
 // Constructor for a specific scene to export
-XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mIOSystem(pIOSystem), mPath(path), mFile(file), mProperties(pProperties)
+XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties)
+		: mProperties(pProperties),
+		mIOSystem(pIOSystem),
+		mPath(path),
+		mFile(file),
+		mScene(pScene),
+		mSceneOwned(false),
+		endstr("\n")
 {
 	// make sure that all formatting happens using the standard, C locale and not the user's current locale
 	mOutput.imbue( std::locale("C") );
 
-	mScene = pScene;
-	mSceneOwned = false;
-
-	// set up strings
-	endstr = "\n";
-
 	// start writing
 	WriteFile();
 }