浏览代码

Get rid of warnings on GCC4.4 with -wall

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@541 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
aramis_acg 15 年之前
父节点
当前提交
17326515d4

+ 2 - 2
code/ASEParser.cpp

@@ -1285,8 +1285,8 @@ void Parser::ParseLV2NodeTransformBlock(ASE::BaseNode& mesh)
 					mesh.mName == temp.substr(0,s))
 				{
 					// This should be either a target light or a target camera
-					if ( mesh.mType == BaseNode::Light &&  ((ASE::Light&)mesh) .mLightType  == ASE::Light::TARGET ||
-						 mesh.mType == BaseNode::Camera && ((ASE::Camera&)mesh).mCameraType == ASE::Camera::TARGET)
+					if ( (mesh.mType == BaseNode::Light &&  ((ASE::Light&)mesh) .mLightType  == ASE::Light::TARGET) ||
+						 (mesh.mType == BaseNode::Camera && ((ASE::Camera&)mesh).mCameraType == ASE::Camera::TARGET))
 					{
 						mode = 2;
 					}

+ 1 - 0
code/Assimp.cpp

@@ -422,6 +422,7 @@ ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream,const
 	LogStream* stream = LogStream::createDefaultStream(pStream,file);
 	if (!stream) {
 		sout.callback = NULL;
+		sout.user = NULL;
 	}
 	else {
 		sout.callback = &CallbackToLogRedirector;

+ 26 - 19
code/B3DImporter.cpp

@@ -64,7 +64,7 @@ using namespace std;
 // ------------------------------------------------------------------------------------------------
 bool B3DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const{
 
-	int pos=pFile.find_last_of( '.' );
+	size_t pos=pFile.find_last_of( '.' );
 	if( pos==string::npos ) return false;
 
 	string ext=pFile.substr( pos+1 );
@@ -219,7 +219,7 @@ template<class T>
 T *B3DImporter::to_array( const vector<T> &v ){
 	if( !v.size() ) return 0;
 	T *p=new T[v.size()];
-	for( int i=0;i<v.size();++i ){
+	for( size_t i=0;i<v.size();++i ){
 		p[i]=v[i];
 	}
 	return p;
@@ -229,11 +229,11 @@ T *B3DImporter::to_array( const vector<T> &v ){
 void B3DImporter::ReadTEXS(){
 	while( ChunkSize() ){
 		string name=ReadString();
-		int flags=ReadInt();
-		int blend=ReadInt();
-		aiVector2D pos=ReadVec2();
-		aiVector2D scale=ReadVec2();
-		float rot=ReadFloat();
+		/*int flags=*/ReadInt();
+		/*int blend=*/ReadInt();
+		/*aiVector2D pos=*/ReadVec2();
+		/*aiVector2D scale=*/ReadVec2();
+		/*float rot=*/ReadFloat();
 
 		_textures.push_back( name );
 	}
@@ -250,7 +250,7 @@ void B3DImporter::ReadBRUS(){
 		aiVector3D color=ReadVec3();
 		float alpha=ReadFloat();
 		float shiny=ReadFloat();
-		int blend=ReadInt();
+		/*int blend=**/ReadInt();
 		int fx=ReadInt();
 
 		MaterialHelper *mat=new MaterialHelper;
@@ -283,7 +283,7 @@ void B3DImporter::ReadBRUS(){
 		//Textures
 		for( int i=0;i<n_texs;++i ){
 			int texid=ReadInt();
-			if( texid<-1 || (texid>=0 && texid>=_textures.size()) ){
+			if( texid<-1 || (texid>=0 && texid>=static_cast<int>(_textures.size())) ){
 				Fail( "Bad texture id" );
 			}
 			if( i==0 && texid>=0 ){
@@ -337,7 +337,7 @@ void B3DImporter::ReadTRIS( int v0 ){
 	int matid=ReadInt();
 	if( matid==-1 ){
 		matid=0;
-	}else if( matid<0 || matid>=_materials.size() ){
+	}else if( matid<0 || matid>=(int)_materials.size() ){
 #ifdef DEBUG_B3D
 		cout<<"material id="<<matid<<endl;
 #endif
@@ -358,7 +358,7 @@ void B3DImporter::ReadTRIS( int v0 ){
 		int i0=ReadInt()+v0;
 		int i1=ReadInt()+v0;
 		int i2=ReadInt()+v0;
-		if( i0<0 || i0>=_vertices.size() || i1<0 || i1>=_vertices.size() || i2<0 || i2>=_vertices.size() ){
+		if( i0<0 || i0>=(int)_vertices.size() || i1<0 || i1>=(int)_vertices.size() || i2<0 || i2>=(int)_vertices.size() ){
 #ifdef DEBUG_B3D
 			cout<<"Bad triangle index: i0="<<i0<<", i1="<<i1<<", i2="<<i2<<endl;
 #endif
@@ -377,7 +377,7 @@ void B3DImporter::ReadTRIS( int v0 ){
 
 // ------------------------------------------------------------------------------------------------
 void B3DImporter::ReadMESH(){
-	int matid=ReadInt();
+	/*int matid=*/ReadInt();
 
 	int v0=_vertices.size();
 
@@ -397,7 +397,7 @@ void B3DImporter::ReadBONE( int id ){
 	while( ChunkSize() ){
 		int vertex=ReadInt();
 		float weight=ReadFloat();
-		if( vertex<0 || vertex>=_vertices.size() ){
+		if( vertex<0 || vertex>=(int)_vertices.size() ){
 			Fail( "Bad vertex index" );
 		}
 
@@ -454,7 +454,7 @@ void B3DImporter::ReadKEYS( aiNodeAnim *nodeAnim ){
 
 // ------------------------------------------------------------------------------------------------
 void B3DImporter::ReadANIM(){
-	int flags=ReadInt();
+	/*int flags=*/ReadInt();
 	int frames=ReadInt();
 	float fps=ReadFloat();
 
@@ -498,7 +498,7 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){
 		if( t=="MESH" ){
 			int n=_meshes.size();
 			ReadMESH();
-			for( int i=n;i<_meshes.size();++i ){
+			for( int i=n;i<(int)_meshes.size();++i ){
 				meshes.push_back( i );
 			}
 		}else if( t=="BONE" ){
@@ -544,6 +544,13 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
 	string t=ReadChunk();
 	if( t=="BB3D" ){
 		int version=ReadInt();
+		
+		if (!DefaultLogger::isNullLogger()) {
+			char dmp[128];
+			sprintf(dmp,"B3D file format version: %i",version);
+			DefaultLogger::get()->info(dmp);
+		}
+
 		while( ChunkSize() ){
 			string t=ReadChunk();
 			if( t=="TEXS" ){
@@ -563,10 +570,10 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
 	if( !_meshes.size() ) Fail( "No meshes" );
 
 	//Fix nodes/meshes/bones
-	for( int i=0;i<_nodes.size();++i ){
+	for(size_t i=0;i<_nodes.size();++i ){
 		aiNode *node=_nodes[i];
 
-		for( int j=0;j<node->mNumMeshes;++j ){
+		for( size_t j=0;j<node->mNumMeshes;++j ){
 			aiMesh *mesh=_meshes[node->mMeshes[j]];
 
 			int n_tris=mesh->mNumFaces;
@@ -603,7 +610,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
 			}
 
 			vector<aiBone*> bones;
-			for( int i=0;i<vweights.size();++i ){
+			for(size_t i=0;i<vweights.size();++i ){
 				vector<aiVertexWeight> &weights=vweights[i];
 				if( !weights.size() ) continue;
 
@@ -631,7 +638,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
 	//nodes
 	scene->mRootNode=_nodes[0];
 
-	//materials
+	//material
 	if( !_materials.size() ){
 		_materials.push_back( new MaterialHelper );
 	}

+ 17 - 9
code/BaseImporter.cpp

@@ -198,8 +198,12 @@ void BaseImporter::SetupProperties(const Importer* pImp)
 	if (!pIOHandler) {
 		return false;
 	}
-
-	const char* magic = (const char*)_magic;
+	union {
+		const char* magic;
+		const uint16_t* magic_u16;
+		const uint32_t* magic_u32;
+	};
+	magic = reinterpret_cast<const char*>(_magic);
 	boost::scoped_ptr<IOStream> pStream (pIOHandler->Open(pFile));
 	if (pStream.get() )	{
 
@@ -207,7 +211,11 @@ void BaseImporter::SetupProperties(const Importer* pImp)
 		pStream->Seek(offset,aiOrigin_SET);
 
 		// read 'size' characters from the file
-		char data[16];
+		union {
+			char data[16];
+			uint16_t data_u16[8];
+			uint32_t data_u32[4];
+		};
 		if(size != pStream->Read(data,1,size)) {
 			return false;
 		}
@@ -217,16 +225,16 @@ void BaseImporter::SetupProperties(const Importer* pImp)
 			// that's just for convinience, the chance that we cause conflicts
 			// is quite low and it can save some lines and prevent nasty bugs
 			if (2 == size) {
-				int16_t rev = *((int16_t*)magic);
+				uint16_t rev = *magic_u16; 
 				ByteSwap::Swap(&rev);
-				if (*((int16_t*)data) == ((int16_t*)magic)[i] || *((int16_t*)data) == rev) {
+				if (data_u16[0] == *magic_u16 || data_u16[0] == rev) {
 					return true;
 				}
 			}
 			else if (4 == size) {
-				int32_t rev = *((int32_t*)magic);
+				uint32_t rev = *magic_u32;
 				ByteSwap::Swap(&rev);
-				if (*((int32_t*)data) == ((int32_t*)magic)[i] || *((int32_t*)data) == rev) {
+				if (data_u32[0] == *magic_u32 || data_u32[0] == rev) {
 					return true;
 				}
 			}
@@ -248,10 +256,10 @@ void BaseImporter::SetupProperties(const Importer* pImp)
 void ReportResult(ConversionResult res)
 {
 	if(res == sourceExhausted) {
-		DefaultLogger::get()->error("Source ends with incomplete character sequence, Unicode transformation to UTF-8 fails");
+		DefaultLogger::get()->error("Source ends with incomplete character sequence, transformation to UTF-8 fails");
 	}
 	else if(res == sourceIllegal) {
-		DefaultLogger::get()->error("Source contains illegal character sequence, Unicode transformation to UTF-8 fails");
+		DefaultLogger::get()->error("Source contains illegal character sequence, transformation to UTF-8 fails");
 	}
 }
 

+ 4 - 8
code/BaseProcess.h

@@ -140,8 +140,7 @@ public:
 	template <typename T>
 	bool GetProperty( const char* name, T*& out ) const
 	{
-		THeapData<T>* t;
-		GetProperty(name,(Base*&)t);
+		THeapData<T>* t = (THeapData<T>*)GetPropertyInternal(name);
 		if(!t)
 		{
 			out = NULL;
@@ -155,8 +154,7 @@ public:
 	template <typename T>
 	bool GetProperty( const char* name, T& out ) const
 	{
-		TStaticData<T>* t;
-		GetProperty(name,(Base*&)t);
+		TStaticData<T>* t = (TStaticData<T>*)GetPropertyInternal(name);
 		if(!t)return false;
 		out = t->data;
 		return true;
@@ -169,14 +167,12 @@ public:
 
 private:
 
-	//! Internal
 	void AddProperty( const char* name, Base* data)	{
 		SetGenericPropertyPtr<Base>(pmap,name,data);
 	}
 
-	//! Internal
-	void GetProperty( const char* name, Base*& data) const	{
-		data = GetGenericProperty<Base*>(pmap,name,NULL);
+	Base* GetPropertyInternal( const char* name) const	{
+		return GetGenericProperty<Base*>(pmap,name,NULL);
 	}
 
 private:

+ 1 - 1
code/ColladaHelper.h

@@ -515,11 +515,11 @@ struct Effect
 		, mTransparent	( 0, 0, 0, 1)
 		, mShininess    (10.0f)
 		, mRefractIndex (1.f)
+		, mReflectivity (1.f)
 		, mTransparency (0.f)
 		, mDoubleSided	(false)
 		, mWireframe    (false)
 		, mFaceted      (false)
-		, mReflectivity (1.f)
 	{ 
 	}
 };

+ 1 - 1
code/ColladaLoader.cpp

@@ -912,7 +912,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
 
 				// find the keyframe behind the current point in time
 				size_t pos = 0;
-				float postTime;
+				float postTime = 0.f;
 				while( 1)
 				{
 					if( pos >= e.mTimeAccessor->mCount)

+ 3 - 0
code/ColladaParser.cpp

@@ -2148,6 +2148,9 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
       }
 
 			break;
+	default:
+		// IT_Invalid and IT_Vertex 
+		ai_assert(false && "shouldn't ever get here");
 	}
 }
 

+ 1 - 1
code/ComputeUVMappingProcess.cpp

@@ -83,7 +83,7 @@ inline bool PlaneIntersect(const aiRay& ray, const aiVector3D& planePos,
 {
 	const float b = planeNormal * (planePos - ray.pos);
 	float h = ray.dir * planeNormal;
-    if (h < 10e-5f && h > -10e-5f || (h = b/h) < 0)
+    if ((h < 10e-5f && h > -10e-5f) || (h = b/h) < 0)
 		return false;
 
     pos = ray.pos + (ray.dir * h);

+ 18 - 7
code/DXFLoader.cpp

@@ -326,14 +326,25 @@ bool DXFImporter::ParseEntities()
 {
 	while (GetNextToken())	{
 		if (!groupCode)	{			
-			if (!::strcmp(cursor,"3DFACE") || !::strcmp(cursor,"LINE") || !::strcmp(cursor,"3DLINE"))
-				if (!Parse3DFace()) return false; else bRepeat = true;
-
-			if (!::strcmp(cursor,"POLYLINE") || !::strcmp(cursor,"LWPOLYLINE"))
-				if (!ParsePolyLine()) return false; else bRepeat = true;
-
-			if (!::strcmp(cursor,"ENDSEC"))
+			if (!::strcmp(cursor,"3DFACE") || !::strcmp(cursor,"LINE") || !::strcmp(cursor,"3DLINE")){
+				if (!Parse3DFace()) {
+					 return false;
+				}
+				else {
+					 bRepeat = true;
+				}
+			}
+			if (!::strcmp(cursor,"POLYLINE") || !::strcmp(cursor,"LWPOLYLINE")){
+				if (!ParsePolyLine()) {
+					 return false; 
+				}
+				else {
+					 bRepeat = true;
+				}
+			}
+			if (!::strcmp(cursor,"ENDSEC")) {
 				return true;
+			}
 		}
 	}
 	return false;

+ 19 - 6
code/DefaultIOSystem.cpp

@@ -118,19 +118,32 @@ bool IOSystem::ComparePaths (const char* one, const char* second) const
 	return !ASSIMP_stricmp(one,second);
 }
 
-// this should be sufficient for all platforms :D -- not really :->
-#define PATHLIMIT 4096 
+// maximum path length
+// XXX http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html 
+#ifdef PATH_MAX
+#	define PATHLIMIT PATH_MAX
+#else
+#	define PATHLIMIT 4096
+#endif
 
 // ------------------------------------------------------------------------------------------------
 // Convert a relative path into an absolute path
 inline void MakeAbsolutePath (const char* in, char* _out)
 {
+	ai_assert(in & _out);
+	char* ret;
 #ifdef _WIN32
-	::_fullpath(_out, in,PATHLIMIT);
+	ret = ::_fullpath(_out, in,PATHLIMIT);
 #else
-    // use realpath
-    realpath(in, _out);
-#endif    
+    	// use realpath
+    	ret = realpath(in, _out);
+#endif  
+	if(!ret) {
+		// preserve the input path, maybe someone else is able to fix
+		// the path before it is accessed (e.g. our file system filter)
+		DefaultLogger::get()->warn("Invalid path: "+std::string(in));
+		strcpy(_out,in);
+	}  
 }
 
 // ------------------------------------------------------------------------------------------------

+ 3 - 3
code/FixNormalsStep.cpp

@@ -137,9 +137,9 @@ bool FixInfacingNormalsProcess::ProcessMesh( aiMesh* pcMesh, unsigned int index)
 	const float fDelta1_z = (vMax1.z - vMin1.z);
 
 	// Check whether the boxes are overlapping
-	if (fDelta0_x > 0.0f != fDelta1_x > 0.0f)return false;
-	if (fDelta0_y > 0.0f != fDelta1_y > 0.0f)return false;
-	if (fDelta0_z > 0.0f != fDelta1_z > 0.0f)return false;
+	if ((fDelta0_x > 0.0f) != (fDelta1_x > 0.0f))return false;
+	if ((fDelta0_y > 0.0f) != (fDelta1_y > 0.0f))return false;
+	if ((fDelta0_z > 0.0f) != (fDelta1_z > 0.0f))return false;
 
 	// Check whether this is a planar surface
 	const float fDelta1_yz = fDelta1_y * fDelta1_z;

+ 14 - 4
code/IRRLoader.cpp

@@ -298,6 +298,10 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
 {
 	ai_assert(NULL != root && NULL != real);
 
+	// XXX totally WIP - doesn't produce proper results, need to evaluate
+	// whether there's any use for Irrlicht's proprietary scene format
+	// outside Irrlicht ...
+
 	if (root->animators.empty()) {
 		return;
 	}
@@ -404,7 +408,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
 				// find out how many time units we'll need for the finest
 				// track (in seconds) - this defines the number of output
 				// keys (fps * seconds)
-				float max ;
+				float max  = 0.f;
 				if (angles[0])
 					max = (float)lcm / angles[0];
 				if (angles[1])
@@ -555,6 +559,9 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
 				}
 			}
 			break;
+		default:
+			// UNKNOWN , OTHER
+			break;
 		};
 		if (anim)	{
 			anims.push_back(anim);
@@ -813,6 +820,9 @@ void IRRImporter::GenerateGraph(Node* root,aiNode* rootOut ,aiScene* scene,
 			DefaultLogger::get()->error("IRR: Unsupported node - TERRAIN");
 		}
 		break;
+	default:
+		// DUMMY
+		break;
 	};
 
 	// Check whether we added a mesh (or more than one ...). In this case 
@@ -1182,8 +1192,8 @@ void IRRImporter::InternReadFile( const std::string& pFile,
 								}
 								// radius of the sphere to be generated -
 								// or alternatively, size of the cube
-								else if (Node::SPHERE == curNode->type && prop.name == "Radius" 
-									|| Node::CUBE == curNode->type   && prop.name == "Size" )	{
+								else if ((Node::SPHERE == curNode->type && prop.name == "Radius") 
+									|| (Node::CUBE == curNode->type   && prop.name == "Size" ))	{
 									
 										curNode->sphereRadius = prop.value;
 								}
@@ -1248,7 +1258,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
 										DefaultLogger::get()->error("Ignoring light of unknown type: " + prop.value);
 									}
 								}
-								else if (prop.name == "Mesh" && Node::MESH == curNode->type ||
+								else if ((prop.name == "Mesh" && Node::MESH == curNode->type) ||
 									Node::ANIMMESH == curNode->type)
 								{
 									/*  This is the file name of the mesh - either

+ 1 - 1
code/Importer.cpp

@@ -687,7 +687,7 @@ bool Importer::ValidateFlags(unsigned int pFlags)
 
 	// Now iterate through all bits which are set in the flags and check whether we find at least
 	// one pp plugin which handles it.
-	for (unsigned int mask = 1; mask < (1 << (sizeof(unsigned int)*8-1));mask <<= 1) {
+	for (unsigned int mask = 1; mask < (1u << (sizeof(unsigned int)*8-1));mask <<= 1) {
 		
 		if (pFlags & mask) {
 		

+ 17 - 4
code/LWOAnimation.cpp

@@ -132,6 +132,8 @@ void AnimResolver::ClearAnimRangeSetup()
 // Insert additional keys to match LWO's pre& post behaviours.
 void AnimResolver::UpdateAnimRangeSetup()
 {
+	// XXX doesn't work yet (hangs if more than one envelope channels needs to be interpolated)
+
 	for (std::list<LWO::Envelope>::iterator it = envelopes.begin(); it != envelopes.end(); ++it) {
 		if ((*it).keys.empty()) continue;
 	
@@ -151,7 +153,7 @@ void AnimResolver::UpdateAnimRangeSetup()
 			case LWO::PrePostBehaviour_OffsetRepeat:
 			case LWO::PrePostBehaviour_Repeat:
 			case LWO::PrePostBehaviour_Oscillate:
-
+				{
 				const double start_time = delta - fmod(my_first-first,delta);
 				std::vector<LWO::Key>::iterator n = std::find_if((*it).keys.begin(),(*it).keys.end(), 
 					std::bind1st(std::greater<double>(),start_time)),m;
@@ -195,6 +197,10 @@ void AnimResolver::UpdateAnimRangeSetup()
 					}
 				}
 				break;
+				}
+			default:
+				// silence compiler warning
+				break;
 		}
 
 		// process post behaviour
@@ -205,6 +211,10 @@ void AnimResolver::UpdateAnimRangeSetup()
 			case LWO::PrePostBehaviour_Oscillate:
 
 				break;
+
+			default:
+				// silence compiler warning
+				break;
 		}
 	}
 }
@@ -307,7 +317,10 @@ void AnimResolver::DoInterpolation2(std::vector<LWO::Key>::const_iterator beg,
 			// no interpolation at all - take the value of the last key
 			fill = (*beg).value;
 			return;
+		default:
 
+			// silence compiler warning
+			break;
 	}
 	// linear interpolation - default
 	fill = (*beg).value + ((*end).value - (*beg).value)*(float)(((time - (*beg).time) / ((*end).time - (*beg).time)));
@@ -383,9 +396,9 @@ void AnimResolver::GetKeys(std::vector<aiVectorKey>& out,
 	LWO::Envelope def_x, def_y, def_z;
 	LWO::Key key_dummy;
 	key_dummy.time = 0.f;
-	if (envl_x && envl_x->type == LWO::EnvelopeType_Scaling_X ||
-		envl_y && envl_y->type == LWO::EnvelopeType_Scaling_Y || 
-		envl_z && envl_z->type == LWO::EnvelopeType_Scaling_Z) {
+	if ((envl_x && envl_x->type == LWO::EnvelopeType_Scaling_X) ||
+		(envl_y && envl_y->type == LWO::EnvelopeType_Scaling_Y) || 
+		(envl_z && envl_z->type == LWO::EnvelopeType_Scaling_Z)) {
 		key_dummy.value = 1.f;
 	}
 	else key_dummy.value = 0.f;

+ 3 - 3
code/LWSLoader.h

@@ -81,12 +81,12 @@ struct NodeDesc
 		:	number	(0)
 		,	parent	(0)
 		,	name	("")
-		,	parent_resolved (NULL)
-		,	lightIntensity (1.f)
 		,	lightColor (1.f,1.f,1.f)
+		,	lightIntensity (1.f)
 		,	lightType (0)
 		,	lightFalloffType (0)
 		,	lightConeAngle (45.f)
+		,	parent_resolved (NULL)
 	{}
 
 	enum {
@@ -151,7 +151,7 @@ struct NodeDesc
 			return false;
 		unsigned int _type = num >> 28u;
 		
-		return _type == type && (num & AI_LWS_MASK) == number;
+		return _type == static_cast<unsigned int>(type) && (num & AI_LWS_MASK) == number;
 	}
 };
 

+ 4 - 4
code/MD3Loader.cpp

@@ -539,9 +539,9 @@ bool MD3Importer::ReadMultipartFile()
 
 		// now read these three files
 		BatchLoader batch(mIOHandler);
-		unsigned int _lower = batch.AddLoadRequest(lower,0,&props);
-		unsigned int _upper = batch.AddLoadRequest(upper,0,&props);
-		unsigned int _head  = batch.AddLoadRequest(head,0,&props);
+		const unsigned int _lower = batch.AddLoadRequest(lower,0,&props);
+		const unsigned int _upper = batch.AddLoadRequest(upper,0,&props);
+		const unsigned int _head  = batch.AddLoadRequest(head,0,&props);
 		batch.LoadAll();
 
 		// now construct a dummy scene to place these three parts in
@@ -948,7 +948,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
 			pcMesh->mFaces[i].mIndices = new unsigned int[3];
 			pcMesh->mFaces[i].mNumIndices = 3;
 
-			unsigned int iTemp = iCurrent;
+			//unsigned int iTemp = iCurrent;
 			for (unsigned int c = 0; c < 3;++c,++iCurrent)	{
 				pcMesh->mFaces[i].mIndices[c] = iCurrent;
 

+ 4 - 3
code/MD5Loader.cpp

@@ -584,15 +584,16 @@ void MD5Importer::LoadMD5AnimFile ()
 				for (AnimBoneList::const_iterator iter2	= animParser.mAnimatedBones.begin(); iter2 != animParser.mAnimatedBones.end();++iter2,
 					++pcAnimNode,++pcBaseFrame)
 				{
-					const float* fpCur;
 					if((*iter2).iFirstKeyIndex >= (*iter).mValues.size()) {
 
 						// Allow for empty frames
 						if ((*iter2).iFlags != 0) {
 							throw new ImportErrorException("MD5: Keyframe index is out of range");
+						
 						}
+						continue;
 					}
-					else fpCur = &(*iter).mValues[(*iter2).iFirstKeyIndex];
+					const float* fpCur = &(*iter).mValues[(*iter2).iFirstKeyIndex];
 					aiNodeAnim* pcCurAnimBone = *pcAnimNode;
 
 					aiVectorKey* vKey = &pcCurAnimBone->mPositionKeys[pcCurAnimBone->mNumPositionKeys++];
@@ -701,7 +702,7 @@ void MD5Importer::LoadMD5CameraFile ()
 	for (std::vector<unsigned int>::const_iterator it = cuts.begin(); it != cuts.end()-1; ++it) {
 	
 		aiAnimation* anim = *tmp++ = new aiAnimation();
-		anim->mName.length = ::sprintf(anim->mName.data,"anim%i_from_%i_to_%i",it-cuts.begin(),(*it),*(it+1));
+		anim->mName.length = ::sprintf(anim->mName.data,"anim%u_from_%u_to_%u",(unsigned int)(it-cuts.begin()),(*it),*(it+1));
 		
 		anim->mTicksPerSecond = cameraParser.fFrameRate;
 		anim->mChannels = new aiNodeAnim*[anim->mNumChannels = 1];

+ 3 - 5
code/MDLMaterialLoader.cpp

@@ -540,13 +540,11 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
 			{
 				for (unsigned int y = 0; y < 8;++y)
 				{
-					bool bSet = false;
-					if (0 == x % 2 && 0 != y % 2 ||
-						0 != x % 2 && 0 == y % 2)bSet = true;
+					const bool bSet = ((0 == x % 2 && 0 != y % 2) ||
+						(0 != x % 2 && 0 == y % 2));
 				
 					aiTexel* pc = &pcNew->pcData[y * 8 + x];
-					if (bSet)pc->r = pc->b = pc->g = 0xFF;
-					else pc->r = pc->b = pc->g = 0;
+					pc->r = pc->b = pc->g = (bSet?0xFF:0);
 					pc->a = 0xFF;
 				}
 			}

+ 1 - 1
code/NFFLoader.h

@@ -173,9 +173,9 @@ private:
 		MeshInfo(PatchType _pType, bool bL = false)
 			: pType     (_pType)
 			, bLocked   (bL)
-			, matIndex  (0)
 			, radius	(1.f,1.f,1.f)
 			, dir		(0.f,1.f,0.f)
+			, matIndex  (0)
 		{
 			name[0] = '\0'; // by default meshes are unnamed
 		}

+ 1 - 1
code/ObjFileData.h

@@ -169,10 +169,10 @@ struct Material
 	//!	Constructor
 	Material()
 		:	diffuse (0.6f,0.6f,0.6f)
-		,	ior		(1.f)
 		,	alpha	(1.f)
 		,	shineness (0.0f)
 		,	illumination_model (1)
+		,	ior		(1.f)
 	{
 		// empty
 	}

+ 2 - 2
code/OgreImporter.cpp

@@ -452,7 +452,7 @@ aiMaterial* OgreImporter::LoadMaterial(const std::string MaterialName)
 
 	string Line;
 	ss >> Line;
-	unsigned int Level=0;//Hierarchielevels in the material file, like { } blocks into another
+//	unsigned int Level=0;//Hierarchielevels in the material file, like { } blocks into another
 	while(!ss.eof())
 	{
 		if(Line=="material")
@@ -900,4 +900,4 @@ void Bone::CalculateWorldToBoneSpaceMatrix(vector<Bone> &Bones)
 }//namespace Ogre
 }//namespace Assimp
 
-#endif  // !! ASSIMP_BUILD_NO_OGRE_IMPORTER
+#endif  // !! ASSIMP_BUILD_NO_OGRE_IMPORTER

+ 2 - 2
code/OptimizeMeshes.cpp

@@ -202,8 +202,8 @@ bool OptimizeMeshesProcess::CanJoin ( unsigned int a, unsigned int b, unsigned i
 
 	aiMesh* ma = mScene->mMeshes[a], *mb = mScene->mMeshes[b];
 
-	if (0xffffffff != max_verts && verts+mb->mNumVertices > max_verts ||
-		0xffffffff != max_faces && faces+mb->mNumFaces    > max_faces) {
+	if ((0xffffffff != max_verts && verts+mb->mNumVertices > max_verts) ||
+		(0xffffffff != max_faces && faces+mb->mNumFaces    > max_faces)) {
 		return false;
 	}
 

+ 15 - 12
code/PlyLoader.cpp

@@ -103,9 +103,9 @@ void PLYImporter::InternReadFile( const std::string& pFile,
 	mBuffer = (unsigned char*)&mBuffer2[0];
 
 	// the beginning of the file must be PLY - magic, magic
-	if (mBuffer[0] != 'P' && mBuffer[0] != 'p' ||
-		mBuffer[1] != 'L' && mBuffer[1] != 'l' ||
-		mBuffer[2] != 'Y' && mBuffer[2] != 'y')	{
+	if ((mBuffer[0] != 'P' && mBuffer[0] != 'p') ||
+		(mBuffer[1] != 'L' && mBuffer[1] != 'l') ||
+		(mBuffer[2] != 'Y' && mBuffer[2] != 'y'))	{
 		throw new ImportErrorException( "Invalid .ply file: Magic number \'ply\' is no there");
 	}
 
@@ -373,7 +373,7 @@ void PLYImporter::LoadTextureCoordinates(std::vector<aiVector2D>* pvOut)
 	ai_assert(NULL != pvOut);
 
 	unsigned int aiPositions[2] = {0xFFFFFFFF,0xFFFFFFFF};
-	PLY::EDataType aiTypes[2];
+	PLY::EDataType aiTypes[2] = {EDT_Char,EDT_Char};
 	PLY::ElementInstanceList* pcList = NULL;
 	unsigned int cnt = 0;
 
@@ -441,7 +441,7 @@ void PLYImporter::LoadVertices(std::vector<aiVector3D>* pvOut, bool p_bNormals)
 	ai_assert(NULL != pvOut);
 
 	unsigned int aiPositions[3] = {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF};
-	PLY::EDataType aiTypes[3];
+	PLY::EDataType aiTypes[3] = {EDT_Char,EDT_Char,EDT_Char};
 	PLY::ElementInstanceList* pcList = NULL;
 	unsigned int cnt = 0;
 
@@ -587,7 +587,7 @@ void PLYImporter::LoadVertexColor(std::vector<aiColor4D>* pvOut)
 	ai_assert(NULL != pvOut);
 
 	unsigned int aiPositions[4] = {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF};
-	PLY::EDataType aiTypes[4];
+	PLY::EDataType aiTypes[4] = {EDT_Char, EDT_Char, EDT_Char, EDT_Char}; // silencing gcc
 	unsigned int cnt = 0;
 	PLY::ElementInstanceList* pcList = NULL;
 
@@ -689,12 +689,12 @@ void PLYImporter::LoadFaces(std::vector<PLY::Face>* pvOut)
 
 	// index of the vertex index list
 	unsigned int iProperty = 0xFFFFFFFF;
-	PLY::EDataType eType;
+	PLY::EDataType eType = EDT_Char;
 	bool bIsTristrip = false;
 
 	// index of the material index property
 	unsigned int iMaterialIndex = 0xFFFFFFFF;
-	PLY::EDataType eType2;
+	PLY::EDataType eType2 = EDT_Char;
 
 	// serach in the DOM for a face entry
 	unsigned int _i = 0;
@@ -882,15 +882,18 @@ void PLYImporter::LoadMaterial(std::vector<MaterialHelper*>* pvOut)
 		{0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF},
 	};
 
-	// dto.
-	PLY::EDataType aaiTypes[3][4];
+	PLY::EDataType aaiTypes[3][4] = {
+		{EDT_Char,EDT_Char,EDT_Char,EDT_Char},
+		{EDT_Char,EDT_Char,EDT_Char,EDT_Char},
+		{EDT_Char,EDT_Char,EDT_Char,EDT_Char}
+	};
 	PLY::ElementInstanceList* pcList = NULL;
 
 	unsigned int iPhong = 0xFFFFFFFF;
-	PLY::EDataType ePhong;
+	PLY::EDataType ePhong = EDT_Char;
 
 	unsigned int iOpacity = 0xFFFFFFFF;
-	PLY::EDataType eOpacity;
+	PLY::EDataType eOpacity = EDT_Char;
 
 	// serach in the DOM for a vertex entry
 	unsigned int _i = 0;

+ 1 - 1
code/RemoveVCProcess.cpp

@@ -140,7 +140,7 @@ bool UpdateNodeGraph(aiNode* node,std::list<aiNode*>& childsOfParent,bool root)
 void RemoveVCProcess::Execute( aiScene* pScene)
 {
 	DefaultLogger::get()->debug("RemoveVCProcess begin");
-	bool bHas = false,bMasked = false;
+	bool bHas = false; //,bMasked = false;
 
 	mScene = pScene;
 

+ 4 - 4
code/SceneCombiner.cpp

@@ -496,7 +496,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
 		aiNode* node;
 
 		// To offset or not to offset, this is the question
-		if (n != duplicates[n])
+		if (n != (int)duplicates[n])
 		{
 			// Get full scenegraph copy
 			Copy( &node, (*cur)->mRootNode );
@@ -543,7 +543,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
 		// Copy light sources
 		for (unsigned int i = 0; i < (*cur)->mNumLights;++i,++ppLights)
 		{
-			if (n != duplicates[n]) // duplicate scene? 
+			if (n != (int)duplicates[n]) // duplicate scene? 
 			{
 				Copy(ppLights, (*cur)->mLights[i]);
 			}
@@ -564,7 +564,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
 		// --------------------------------------------------------------------
 		// Copy cameras
 		for (unsigned int i = 0; i < (*cur)->mNumCameras;++i,++ppCameras)	{
-			if (n != duplicates[n]) // duplicate scene? 
+			if (n != (int)duplicates[n]) // duplicate scene? 
 			{
 				Copy(ppCameras, (*cur)->mCameras[i]);
 			}
@@ -584,7 +584,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
 		// --------------------------------------------------------------------
 		// Copy animations
 		for (unsigned int i = 0; i < (*cur)->mNumAnimations;++i,++ppAnims)	{
-			if (n != duplicates[n]) // duplicate scene? 
+			if (n != (int)duplicates[n]) // duplicate scene? 
 			{
 				Copy(ppAnims, (*cur)->mAnimations[i]);
 			}

+ 11 - 3
code/UnrealLoader.h

@@ -114,17 +114,25 @@ struct Vertex
 	// UNREAL vertex compression
 inline void CompressVertex(const aiVector3D& v, uint32_t& out)
 {
-	Vertex n;
+	union {
+		Vertex n;
+		int32_t t;
+	};
 	n.X = (int32_t)v.x;
 	n.Y = (int32_t)v.y;
 	n.Z = (int32_t)v.z;
-	out = *((uint32_t*)&n);
+	out = t;
 }
 
 	// UNREAL vertex decompression
 inline void DecompressVertex(aiVector3D& v, int32_t in)
 {
-	Vertex n = *((Vertex*)&in);
+	union {
+		Vertex n;
+		int32_t i;
+	}; 
+	i = in;
+	
 	v.x = (float)n.X;
 	v.y = (float)n.Y;
 	v.z = (float)n.Z;

+ 6 - 6
code/ValidateDataStructure.cpp

@@ -355,7 +355,7 @@ void ValidateDSProcess::Validate( const aiMesh* pMesh)
 	}
 
 	// positions must always be there ...
-	if (!pMesh->mNumVertices || !pMesh->mVertices && !mScene->mFlags)	{
+	if (!pMesh->mNumVertices || (!pMesh->mVertices && !mScene->mFlags))	{
 		ReportError("The mesh contains no vertices");
 	}
 
@@ -365,7 +365,7 @@ void ValidateDSProcess::Validate( const aiMesh* pMesh)
 	}
 
 	// faces, too
-	if (!pMesh->mNumFaces || !pMesh->mFaces && !mScene->mFlags)	{
+	if (!pMesh->mNumFaces || (!pMesh->mFaces && !mScene->mFlags))	{
 		ReportError("The mesh contains no faces");
 	}
 
@@ -758,10 +758,10 @@ void ValidateDSProcess::Validate( const aiTexture* pTexture)
 	}
 
 	const char* sz = pTexture->achFormatHint;
- 	if (sz[0] >= 'A' && sz[0] <= 'Z' ||
-		sz[1] >= 'A' && sz[1] <= 'Z' ||
-		sz[2] >= 'A' && sz[2] <= 'Z' ||
-		sz[3] >= 'A' && sz[3] <= 'Z')	{
+ 	if ((sz[0] >= 'A' && sz[0] <= 'Z') ||
+		(sz[1] >= 'A' && sz[1] <= 'Z') ||
+		(sz[2] >= 'A' && sz[2] <= 'Z') ||
+		(sz[3] >= 'A' && sz[3] <= 'Z'))	{
 		ReportError("aiTexture::achFormatHint contains non-lowercase characters");
 	}
 }

+ 1 - 1
code/XFileImporter.cpp

@@ -610,7 +610,7 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, const std::vector<XFile::
 
 
 				// find the file name
-				const size_t iLen = sz.length();
+				//const size_t iLen = sz.length();
 				std::string::size_type s = sz.find_last_of("\\/");
 				if (std::string::npos == s)
 					s = 0;

+ 5 - 2
code/XFileImporter.h

@@ -54,8 +54,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 struct aiNode;
 
 namespace Assimp	{
-struct XFile::Scene;
-struct XFile::Node;
+
+namespace XFile {
+struct Scene;
+struct Node;
+}
 
 // ---------------------------------------------------------------------------
 /** The XFileImporter is a worker class capable of importing a scene from a

+ 8 - 2
contrib/irrXML/CXMLReaderImpl.h

@@ -32,7 +32,7 @@ public:
 
 	//! Constructor
 	CXMLReaderImpl(IFileReadCallBack* callback, bool deleteCallBack = true)
-		: TextData(0), P(0), TextSize(0), TextBegin(0), CurrentNodeType(EXN_NONE),
+		: TextData(0), P(0), TextBegin(0), TextSize(0), CurrentNodeType(EXN_NONE),
 		SourceFormat(ETF_ASCII), TargetFormat(ETF_ASCII)
 	{
 		if (!callback)
@@ -664,8 +664,14 @@ private:
 			TextData = new char_type[sizeWithoutHeader];
 
 			// MSVC debugger complains here about loss of data ...
+
+
+			// FIXME - gcc complains about 'shift width larger than width of type'
+			// for T == unsigned long. Avoid it by messing around volatile ..
+			volatile unsigned int c = 3;
+			const src_char_type cc = (src_char_type)((((uint64_t)1u << (sizeof( char_type)<<c)) - 1));
 			for (int i=0; i<sizeWithoutHeader; ++i)
-				TextData[i] = char_type( source[i] & (src_char_type)((((uint64_t)1u << (sizeof( char_type)*8)) - 1)));
+				TextData[i] = char_type( source[i] & cc); 
 
 			TextBegin = TextData;
 			TextSize = sizeWithoutHeader;

+ 2 - 2
contrib/irrXML/irrArray.h

@@ -23,7 +23,7 @@ class array
 public:
 
 	array()
-		: data(0), used(0), allocated(0),
+		: data(0), allocated(0), used(0),
 			free_when_destroyed(true), is_sorted(true)
 	{
 	}
@@ -31,7 +31,7 @@ public:
 	//! Constructs a array and allocates an initial chunk of memory.
 	//! \param start_count: Amount of elements to allocate.
 	array(u32 start_count)
-		: data(0), used(0), allocated(0),
+		: data(0), allocated(0), used(0),
 			free_when_destroyed(true),	is_sorted(true)
 	{
 		reallocate(start_count);

+ 5 - 5
contrib/irrXML/irrString.h

@@ -29,7 +29,7 @@ public:
 
 	//! Default constructor
 	string()
-	: allocated(1), used(1), array(0)
+	: array(0), allocated(1), used(1)
 	{
 		array = new T[1];
 		array[0] = 0x0;
@@ -39,7 +39,7 @@ public:
 
 	//! Constructor
 	string(const string<T>& other)
-	: allocated(0), used(0), array(0)
+	: array(0), allocated(0), used(0)
 	{
 		*this = other;
 	}
@@ -47,7 +47,7 @@ public:
 
 	//! Constructs a string from an int
 	string(int number)
-	: allocated(0), used(0), array(0)
+	: array(0), allocated(0), used(0)
 	{
 		// store if negative and make positive
 
@@ -98,7 +98,7 @@ public:
 	//! Constructor for copying a string from a pointer with a given lenght
 	template <class B>
 	string(const B* c, s32 lenght)
-	: allocated(0), used(0), array(0)
+	: array(0), allocated(0), used(0)
 	{
 		if (!c)
 			return;
@@ -117,7 +117,7 @@ public:
 	//! Constructor for unicode and ascii strings
 	template <class B>
 	string(const B* c)
-	: allocated(0), used(0), array(0)
+	: array(0),allocated(0), used(0)
 	{
 		*this = c;
 	}