Fixes for some warnings in the gcc4 linux 64 build.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@134 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2008-09-13 09:01:24 +00:00
parent 8991496cf5
commit c9c2810e3c
10 changed files with 48 additions and 50 deletions

View File

@ -294,10 +294,6 @@ void ASEImporter::AddNodes(aiNode* pcParent,const char* szName,
// TODO: experimental quick'n'dirty, clean this up ...
std::string szMyName[2] = {mesh.mName,mesh.mParent} ;
if (!szMyName)
{
continue;
}
if (szName)
{
if( len != szMyName[1].length() ||
@ -375,11 +371,6 @@ void ASEImporter::BuildNodes()
// TODO: experimental quick'n'dirty, clean this up ...
std::string szMyName[2] = {mesh.mName,mesh.mParent} ;
if (!szMyName)
{
continue;
}
// check whether our parent is known
bool bKnowParent = false;
for (unsigned int i2 = 0; i2 < pcScene->mNumMeshes;++i2)
@ -388,10 +379,6 @@ void ASEImporter::BuildNodes()
const ASE::Mesh& mesh2 = *((const ASE::Mesh*)pcScene->mMeshes[i2]->mColors[2]);
// TODO: experimental quick'n'dirty, clean this up ...
std::string szMyName2[2] = {mesh2.mName,mesh2.mParent} ;
if (!szMyName2)
{
continue;
}
if (!ASSIMP_stricmp ( szMyName[1], szMyName2[0]))
{
bKnowParent = true;

View File

@ -248,7 +248,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
sprintf(szBuff,"Mesh %i | Verts in: %i out: %i | ~%.1f%%",
meshIndex,
pMesh->mNumVertices,
uniqueVertices.size(),
(int)uniqueVertices.size(),
((pMesh->mNumVertices - uniqueVertices.size()) / (float)pMesh->mNumVertices) * 100.f);
DefaultLogger::get()->info(szBuff);
}

View File

@ -142,7 +142,7 @@ void LWOImporter::CopyFaceIndicesLWOB(FaceList::iterator& it,
while (cursor < end && max--)
{
LWO::Face& face = *it;++it;
if(face.mNumIndices = *cursor++)
if((face.mNumIndices = *cursor++))
{
if (cursor + face.mNumIndices >= end)break;
face.mIndices = new unsigned int[face.mNumIndices];

View File

@ -174,14 +174,6 @@ void LWOImporter::InternReadFile( const std::string& pFile,
apcNodes.reserve(mLayers->size());
apcMeshes.reserve(mLayers->size()*std::min(((unsigned int)mSurfaces->size()/2u), 1u));
// the RemoveRedundantMaterials step will clean this up later
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = (unsigned int)mSurfaces->size()];
for (unsigned int mat = 0; mat < pScene->mNumMaterials;++mat)
{
MaterialHelper* pcMat = new MaterialHelper();
pScene->mMaterials[mat] = pcMat;
ConvertMaterial((*mSurfaces)[mat],pcMat);
}
unsigned int iDefaultSurface = 0xffffffff; // index of the default surface
for (LayerList::const_iterator lit = mLayers->begin(), lend = mLayers->end();
@ -205,9 +197,9 @@ void LWOImporter::InternReadFile( const std::string& pFile,
if (idx >= mTags->size())
{
DefaultLogger::get()->warn("LWO: Invalid face surface index");
idx = (unsigned int)mTags->size()-1;
idx = 0xffffffff;
}
if(0xffffffff == (idx = _mMapping[idx]))
if(0xffffffff == idx || 0xffffffff == (idx = _mMapping[idx]))
{
if (0xffffffff == iDefaultSurface)
{
@ -339,6 +331,16 @@ void LWOImporter::InternReadFile( const std::string& pFile,
for (unsigned int p = 0; p < pcNode->mNumMeshes;++p)
pcNode->mMeshes[p] = p + meshStart;
}
// the RemoveRedundantMaterials step will clean this up later
pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials = (unsigned int)mSurfaces->size()];
for (unsigned int mat = 0; mat < pScene->mNumMaterials;++mat)
{
MaterialHelper* pcMat = new MaterialHelper();
pScene->mMaterials[mat] = pcMat;
ConvertMaterial((*mSurfaces)[mat],pcMat);
}
// generate the final node graph
GenerateNodeGraph(apcNodes);
@ -360,6 +362,7 @@ void LWOImporter::GenerateNodeGraph(std::vector<aiNode*>& apcNodes)
aiNode* node;
uint16_t iCurParent = curIndex-1;
node = curIndex ? apcNodes[iCurParent] : new aiNode("<dummy_root>");
if (!node){++curIndex;continue;}
unsigned int numChilds = 0;
for (unsigned int i = 0; i < apcNodes.size();++i)
@ -385,6 +388,7 @@ void LWOImporter::GenerateNodeGraph(std::vector<aiNode*>& apcNodes)
apcNodes[i] = NULL;
}
}
if (curIndex)apcNodes[iCurParent] = NULL;
}
else if (!curIndex)delete node;
++curIndex;
@ -416,7 +420,11 @@ void LWOImporter::GenerateNodeGraph(std::vector<aiNode*>& apcNodes)
it != end;++it)
{
aiNode* p = *it;
if (p)*cc++ = p;
if (p)
{
*cc++ = p;
p->mParent = pc;
}
}
if (pScene->mRootNode)
{
@ -544,6 +552,8 @@ void LWOImporter::LoadLWOPolygons(unsigned int length)
if (mIsLWO2)
{
uint32_t type = *((LE_NCONST uint32_t*)mFileBuffer);mFileBuffer += 4;
AI_LSWAP4(type);
if (type != AI_LWO_FACE)
{
DefaultLogger::get()->warn("LWO2: Only POLS.FACE chunsk are supported.");
@ -601,7 +611,7 @@ void LWOImporter::CopyFaceIndicesLWO2(FaceList::iterator& it,
while (cursor < end && max--)
{
LWO::Face& face = *it;++it;
if(face.mNumIndices = (*cursor++) & 0x03FF)
if((face.mNumIndices = (*cursor++) & 0x03FF))
{
face.mIndices = new unsigned int[face.mNumIndices];
@ -630,12 +640,12 @@ void LWOImporter::LoadLWO2PolygonTags(unsigned int length)
return;
LE_NCONST uint8_t* const end = mFileBuffer+length;
while (mFileBuffer < end)
while (mFileBuffer <= end)
{
unsigned int i = ReadVSizedIntLWO2(mFileBuffer) + mCurLayer->mFaceIDXOfs;
unsigned int j = ReadVSizedIntLWO2(mFileBuffer);
if (i > mCurLayer->mFaces.size())
if (i >= mCurLayer->mFaces.size())
{
DefaultLogger::get()->warn("LWO2: face index in ptag list is out of range");
continue;

View File

@ -173,9 +173,10 @@ void LWOImporter::LoadLWO2Surface(unsigned int size)
mFileBuffer+=surf.mName.length()+1;
// skip one byte if the length of the surface name is odd
if (!(surf.mName.length() & 1))++mFileBuffer;
mFileBuffer += 2;
while (true)
{
if (mFileBuffer + 6 > end)break;
if (mFileBuffer + 6 >= end)break;
// no proper IFF header here - the chunk length is specified as int16
uint32_t head_type = *((LE_NCONST uint32_t*)mFileBuffer);mFileBuffer+=4;

View File

@ -91,19 +91,19 @@ MD5Parser::MD5Parser(char* buffer, unsigned int fileSize)
if ( !DefaultLogger::isNullLogger())
{
char szBuffer[128]; // should be sufficiently large
::sprintf(szBuffer,"MD5Parser end. Parsed %i sections",this->mSections.size());
::sprintf(szBuffer,"MD5Parser end. Parsed %i sections",(int)this->mSections.size());
DefaultLogger::get()->debug(szBuffer);
}
}
// ------------------------------------------------------------------------------------------------
/*static*/ void MD5Parser::ReportError (char* error, unsigned int line)
/*static*/ void MD5Parser::ReportError (const char* error, unsigned int line)
{
char szBuffer[1024]; // you, listen to me, you HAVE TO BE sufficiently large
::sprintf(szBuffer,"Line %i: %s",line,error);
throw new ImportErrorException(szBuffer);
}
// ------------------------------------------------------------------------------------------------
/*static*/ void MD5Parser::ReportWarning (char* warn, unsigned int line)
/*static*/ void MD5Parser::ReportWarning (const char* warn, unsigned int line)
{
char szBuffer[1024]; // you, listen to me, you HAVE TO BE sufficiently large
::sprintf(szBuffer,"Line %i: %s",line,warn);
@ -248,7 +248,7 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections)
if ( !::strcmp("numMeshes",(*iter).mName.c_str()))
{
unsigned int iNumMeshes;
if(iNumMeshes = ::strtol10((*iter).mGlobalValue.c_str()))
if((iNumMeshes = ::strtol10((*iter).mGlobalValue.c_str())))
{
mMeshes.reserve(iNumMeshes);
}
@ -256,7 +256,7 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections)
else if ( !::strcmp("numJoints",(*iter).mName.c_str()))
{
unsigned int iNumJoints;
if(iNumJoints = ::strtol10((*iter).mGlobalValue.c_str()))
if((iNumJoints = ::strtol10((*iter).mGlobalValue.c_str())))
{
mJoints.reserve(iNumJoints);
}
@ -316,7 +316,7 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections)
// reserve enough storage
AI_MD5_SKIP_SPACES();
unsigned int iNumVertices;
if(iNumVertices = ::strtol10(sz))
if((iNumVertices = ::strtol10(sz)))
desc.mVertices.resize(iNumVertices);
}
// numtris attribute
@ -326,7 +326,7 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections)
// reserve enough storage
AI_MD5_SKIP_SPACES();
unsigned int iNumTris;
if(iNumTris = ::strtol10(sz))
if((iNumTris = ::strtol10(sz)))
desc.mFaces.resize(iNumTris);
}
// numweights attribute
@ -336,7 +336,7 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections)
// reserve enough storage
AI_MD5_SKIP_SPACES();
unsigned int iNumWeights;
if(iNumWeights = ::strtol10(sz))
if((iNumWeights = ::strtol10(sz)))
desc.mWeights.resize(iNumWeights);
}
// vert attribute
@ -507,7 +507,7 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections)
else if(!::strcmp("numFrames",(*iter).mName.c_str()))
{
unsigned int iNum;
if(iNum = ::strtol10((*iter).mGlobalValue.c_str()))
if((iNum = ::strtol10((*iter).mGlobalValue.c_str())))
{
mFrames.reserve(iNum);
}
@ -515,7 +515,7 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections)
else if(!::strcmp("numJoints",(*iter).mName.c_str()))
{
unsigned int iNum;
if(iNum = ::strtol10((*iter).mGlobalValue.c_str()))
if((iNum = ::strtol10((*iter).mGlobalValue.c_str())))
{
mAnimatedBones.reserve(iNum);
@ -527,7 +527,7 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections)
else if(!::strcmp("numAnimatedComponents",(*iter).mName.c_str()))
{
unsigned int iNum;
if(iNum = ::strtol10((*iter).mGlobalValue.c_str()))
if((iNum = ::strtol10((*iter).mGlobalValue.c_str())))
{
mAnimatedBones.reserve(iNum);
}

View File

@ -325,20 +325,20 @@ public:
* @param error Error message to be reported
* @param line Index of the line where the error occured
*/
static void ReportError (char* error, unsigned int line);
static void ReportError (const char* error, unsigned int line);
// -------------------------------------------------------------------
/** Report a specific warning
* @param warn Warn message to be reported
* @param line Index of the line where the error occured
*/
static void ReportWarning (char* warn, unsigned int line);
static void ReportWarning (const char* warn, unsigned int line);
inline void ReportError (char* error)
inline void ReportError (const char* error)
{return ReportError(error, this->lineNumber);}
inline void ReportWarning (char* warn)
inline void ReportWarning (const char* warn)
{return ReportWarning(warn, this->lineNumber);}

View File

@ -179,7 +179,7 @@ void STLImporter::LoadASCIIFile()
unsigned int temp;
// setup the name of the node
if (temp = (unsigned int)(sz-szMe))
if ((temp = (unsigned int)(sz-szMe)))
{
pScene->mRootNode->mName.length = temp;
::memcpy(pScene->mRootNode->mName.data,szMe,temp);

View File

@ -591,7 +591,7 @@ void SplitLargeMeshesProcess_Vertex::SplitMesh(
{
// check whether the bone is existing
BoneWeightList* pcWeightList;
if (pcWeightList = (BoneWeightList*)pcMesh->mBones[k])
if ((pcWeightList = (BoneWeightList*)pcMesh->mBones[k]))
{
aiBone* pcOldBone = pMesh->mBones[k];
aiBone* pcOut;

View File

@ -60,7 +60,7 @@ void TextureTransform::PreProcessUVTransform(
if (rcIn.mOffsetU)
{
if (iField = (int)rcIn.mOffsetU)
if ((iField = (int)rcIn.mOffsetU))
{
if (aiTextureMapMode_Wrap == rcIn.mMapMode)
{
@ -94,7 +94,7 @@ void TextureTransform::PreProcessUVTransform(
}
if (rcIn.mOffsetV)
{
if (iField = (int)rcIn.mOffsetV)
if ((iField = (int)rcIn.mOffsetV))
{
if (aiTextureMapMode_Wrap == rcIn.mMapMode)
{
@ -128,7 +128,7 @@ void TextureTransform::PreProcessUVTransform(
}
if (rcIn.mRotation)
{
if (iField = (int)(rcIn.mRotation / 3.141592654f))
if ((iField = (int)(rcIn.mRotation / 3.141592654f)))
{
float fNew = rcIn.mRotation-(float)iField*3.141592654f;