diff --git a/code/ASEParser.cpp b/code/ASEParser.cpp index e4f5ae31f..b29a729a1 100644 --- a/code/ASEParser.cpp +++ b/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; } diff --git a/code/Assimp.cpp b/code/Assimp.cpp index 10c9d9d08..68ca7eac8 100644 --- a/code/Assimp.cpp +++ b/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; diff --git a/code/B3DImporter.cpp b/code/B3DImporter.cpp index aa0f2314a..7aa65182f 100644 --- a/code/B3DImporter.cpp +++ b/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 T *B3DImporter::to_array( const vector &v ){ if( !v.size() ) return 0; T *p=new T[v.size()]; - for( int i=0;i &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=0 && texid>=_textures.size()) ){ + if( texid<-1 || (texid>=0 && texid>=static_cast(_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="<=_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="<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;jmNumMeshes;++j ){ + for( size_t j=0;jmNumMeshes;++j ){ aiMesh *mesh=_meshes[node->mMeshes[j]]; int n_tris=mesh->mNumFaces; @@ -603,7 +610,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){ } vector bones; - for( int i=0;i &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 ); } diff --git a/code/BaseImporter.cpp b/code/BaseImporter.cpp index 69bba33bd..bcf544c69 100644 --- a/code/BaseImporter.cpp +++ b/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(_magic); boost::scoped_ptr 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"); } } diff --git a/code/BaseProcess.h b/code/BaseProcess.h index 590540e86..130f9a35a 100644 --- a/code/BaseProcess.h +++ b/code/BaseProcess.h @@ -140,8 +140,7 @@ public: template bool GetProperty( const char* name, T*& out ) const { - THeapData* t; - GetProperty(name,(Base*&)t); + THeapData* t = (THeapData*)GetPropertyInternal(name); if(!t) { out = NULL; @@ -155,8 +154,7 @@ public: template bool GetProperty( const char* name, T& out ) const { - TStaticData* t; - GetProperty(name,(Base*&)t); + TStaticData* t = (TStaticData*)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(pmap,name,data); } - //! Internal - void GetProperty( const char* name, Base*& data) const { - data = GetGenericProperty(pmap,name,NULL); + Base* GetPropertyInternal( const char* name) const { + return GetGenericProperty(pmap,name,NULL); } private: diff --git a/code/ColladaHelper.h b/code/ColladaHelper.h index a43a7b0e0..bfcd126fd 100644 --- a/code/ColladaHelper.h +++ b/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) { } }; diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 669b37ffd..49eda4060 100644 --- a/code/ColladaLoader.cpp +++ b/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) diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index 9080fa233..73c105172 100644 --- a/code/ColladaParser.cpp +++ b/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"); } } diff --git a/code/ComputeUVMappingProcess.cpp b/code/ComputeUVMappingProcess.cpp index 8f6d3e593..be8b898b4 100644 --- a/code/ComputeUVMappingProcess.cpp +++ b/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); diff --git a/code/DXFLoader.cpp b/code/DXFLoader.cpp index 0bd5773b9..59d635541 100644 --- a/code/DXFLoader.cpp +++ b/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; diff --git a/code/DefaultIOSystem.cpp b/code/DefaultIOSystem.cpp index 785ad0abc..acf33a24e 100644 --- a/code/DefaultIOSystem.cpp +++ b/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); + } } // ------------------------------------------------------------------------------------------------ diff --git a/code/FixNormalsStep.cpp b/code/FixNormalsStep.cpp index 649cef4f1..70f19af65 100644 --- a/code/FixNormalsStep.cpp +++ b/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; diff --git a/code/IRRLoader.cpp b/code/IRRLoader.cpp index 7d5c85a23..b3eb98a86 100644 --- a/code/IRRLoader.cpp +++ b/code/IRRLoader.cpp @@ -298,6 +298,10 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vectoranimators.empty()) { return; } @@ -404,7 +408,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vectorerror("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 diff --git a/code/Importer.cpp b/code/Importer.cpp index 3ba27d45d..d2ad5d84b 100644 --- a/code/Importer.cpp +++ b/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) { diff --git a/code/LWOAnimation.cpp b/code/LWOAnimation.cpp index b48751b0b..a20b5dde7 100644 --- a/code/LWOAnimation.cpp +++ b/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::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::iterator n = std::find_if((*it).keys.begin(),(*it).keys.end(), std::bind1st(std::greater(),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::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& 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; diff --git a/code/LWSLoader.h b/code/LWSLoader.h index adc17b627..981cb1ddc 100644 --- a/code/LWSLoader.h +++ b/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(type) && (num & AI_LWS_MASK) == number; } }; diff --git a/code/MD3Loader.cpp b/code/MD3Loader.cpp index a2a37616d..f33f248f5 100644 --- a/code/MD3Loader.cpp +++ b/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; diff --git a/code/MD5Loader.cpp b/code/MD5Loader.cpp index 0b6e46663..f7def9a21 100644 --- a/code/MD5Loader.cpp +++ b/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::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]; diff --git a/code/MDLMaterialLoader.cpp b/code/MDLMaterialLoader.cpp index e7b3fa975..0db2cabb0 100644 --- a/code/MDLMaterialLoader.cpp +++ b/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; } } diff --git a/code/NFFLoader.h b/code/NFFLoader.h index 65d612a4a..9a46eef87 100644 --- a/code/NFFLoader.h +++ b/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 } diff --git a/code/ObjFileData.h b/code/ObjFileData.h index 9fa3e2473..995fa2e51 100644 --- a/code/ObjFileData.h +++ b/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 } diff --git a/code/OgreImporter.cpp b/code/OgreImporter.cpp index a1dddb822..748e8612e 100644 --- a/code/OgreImporter.cpp +++ b/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 &Bones) }//namespace Ogre }//namespace Assimp -#endif // !! ASSIMP_BUILD_NO_OGRE_IMPORTER \ No newline at end of file +#endif // !! ASSIMP_BUILD_NO_OGRE_IMPORTER diff --git a/code/OptimizeMeshes.cpp b/code/OptimizeMeshes.cpp index f39ae0cd1..8c1cc6202 100644 --- a/code/OptimizeMeshes.cpp +++ b/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; } diff --git a/code/PlyLoader.cpp b/code/PlyLoader.cpp index b7b022461..b8e2f3e3a 100644 --- a/code/PlyLoader.cpp +++ b/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* 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* 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* 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* 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* 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; diff --git a/code/RemoveVCProcess.cpp b/code/RemoveVCProcess.cpp index 23a2eb28e..1b16a132f 100644 --- a/code/RemoveVCProcess.cpp +++ b/code/RemoveVCProcess.cpp @@ -140,7 +140,7 @@ bool UpdateNodeGraph(aiNode* node,std::list& 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; diff --git a/code/SceneCombiner.cpp b/code/SceneCombiner.cpp index 24120c803..fd35f432a 100644 --- a/code/SceneCombiner.cpp +++ b/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]); } diff --git a/code/UnrealLoader.h b/code/UnrealLoader.h index efd20ceab..b2d492720 100644 --- a/code/UnrealLoader.h +++ b/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; diff --git a/code/ValidateDataStructure.cpp b/code/ValidateDataStructure.cpp index 9f1a41b8b..6149e53f2 100644 --- a/code/ValidateDataStructure.cpp +++ b/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"); } } diff --git a/code/XFileImporter.cpp b/code/XFileImporter.cpp index 7e429f8ae..354b3e651 100644 --- a/code/XFileImporter.cpp +++ b/code/XFileImporter.cpp @@ -610,7 +610,7 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, const std::vector& 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 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 string(const B* c) - : allocated(0), used(0), array(0) + : array(0),allocated(0), used(0) { *this = c; }