Merge pull request #572 from asmaloney/fix/code_cleanup

Code Cleanups
pull/573/head
Kim Kulling 2015-05-24 12:17:27 -07:00
commit 4d05dd913c
11 changed files with 28 additions and 22 deletions

View File

@ -167,8 +167,6 @@ void ColladaExporter::WriteHeader()
std::time_t date = std::time(NULL);
std::strftime(date_str, date_nb_chars, "%Y-%m-%dT%H:%M:%S", std::localtime(&date));
std::string scene_name = mScene->mRootNode->mName.C_Str();
aiVector3D scaling;
aiQuaternion rotation;
aiVector3D position;
@ -622,8 +620,6 @@ void ColladaExporter::WriteMaterials()
{
materials.resize( mScene->mNumMaterials);
std::set<std::string> material_names;
/// collect all materials from the scene
size_t numTextures = 0;
for( size_t a = 0; a < mScene->mNumMaterials; ++a )

View File

@ -919,7 +919,7 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars
// ------------------------------------------------------------------------------------------------
// Constructs the animations for the given source anim
void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string pPrefix)
void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string &pPrefix)
{
std::string animName = pPrefix.empty() ? pSrcAnim->mName : pPrefix + "_" + pSrcAnim->mName;

View File

@ -155,7 +155,7 @@ protected:
* @param pSrcAnim the source animation to process
* @param pPrefix Prefix to the name in case of nested animations
*/
void StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string pPrefix);
void StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pPrefix);
/** Constructs the animation for the given source anim */
void CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName);

View File

@ -412,7 +412,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
{
if (!DefaultLogger::isNullLogger())
{
sprintf(buffer, "Found non-UV mapped texture (%s,%i). Mapping type: %s",
sprintf(buffer, "Found non-UV mapped texture (%s,%u). Mapping type: %s",
TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex,
MappingTypeToString(mapping));

View File

@ -158,7 +158,7 @@ bool FixInfacingNormalsProcess::ProcessMesh( aiMesh* pcMesh, unsigned int index)
if (!DefaultLogger::isNullLogger())
{
char buffer[128]; // should be sufficiently large
::sprintf(buffer,"Mesh %i: Normals are facing inwards (or the mesh is planar)",index);
::sprintf(buffer,"Mesh %u: Normals are facing inwards (or the mesh is planar)",index);
DefaultLogger::get()->info(buffer);
}

View File

@ -110,7 +110,7 @@ void ImproveCacheLocalityProcess::Execute( aiScene* pScene)
}
if (!DefaultLogger::isNullLogger()) {
char szBuff[128]; // should be sufficiently large in every case
::sprintf(szBuff,"Cache relevant are %i meshes (%i faces). Average output ACMR is %f",
::sprintf(szBuff,"Cache relevant are %u meshes (%u faces). Average output ACMR is %f",
numm,numf,out/numf);
DefaultLogger::get()->info(szBuff);
@ -182,7 +182,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh
// the JoinIdenticalVertices process has not been executed on this
// mesh, otherwise this value would normally be at least minimally
// smaller than 3.0 ...
sprintf(szBuff,"Mesh %i: Not suitable for vcache optimization",meshNum);
sprintf(szBuff,"Mesh %u: Not suitable for vcache optimization",meshNum);
DefaultLogger::get()->warn(szBuff);
return 0.f;
}
@ -361,7 +361,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh
if ( DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
char szBuff[128]; // should be sufficiently large in every case
::sprintf(szBuff,"Mesh %i | ACMR in: %f out: %f | ~%.1f%%",meshNum,fACMR,fACMR2,
::sprintf(szBuff,"Mesh %u | ACMR in: %f out: %f | ~%.1f%%",meshNum,fACMR,fACMR2,
((fACMR - fACMR2) / fACMR) * 100.f);
DefaultLogger::get()->debug(szBuff);
}

View File

@ -54,7 +54,9 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
RemoveVCProcess::RemoveVCProcess()
RemoveVCProcess::RemoveVCProcess() :
configDeleteFlags()
, mScene()
{}
// ------------------------------------------------------------------------------------------------

View File

@ -397,11 +397,11 @@ void SortByPTypeProcess::Execute( aiScene* pScene)
if (!DefaultLogger::isNullLogger())
{
char buffer[1024];
::sprintf(buffer,"Points: %i%s, Lines: %i%s, Triangles: %i%s, Polygons: %i%s (Meshes, X = removed)",
aiNumMeshesPerPType[0], (configRemoveMeshes & aiPrimitiveType_POINT ? "X" : ""),
aiNumMeshesPerPType[1], (configRemoveMeshes & aiPrimitiveType_LINE ? "X" : ""),
aiNumMeshesPerPType[2], (configRemoveMeshes & aiPrimitiveType_TRIANGLE ? "X" : ""),
aiNumMeshesPerPType[3], (configRemoveMeshes & aiPrimitiveType_POLYGON ? "X" : ""));
::sprintf(buffer,"Points: %u%s, Lines: %u%s, Triangles: %u%s, Polygons: %u%s (Meshes, X = removed)",
aiNumMeshesPerPType[0], ((configRemoveMeshes & aiPrimitiveType_POINT) ? "X" : ""),
aiNumMeshesPerPType[1], ((configRemoveMeshes & aiPrimitiveType_LINE) ? "X" : ""),
aiNumMeshesPerPType[2], ((configRemoveMeshes & aiPrimitiveType_TRIANGLE) ? "X" : ""),
aiNumMeshesPerPType[3], ((configRemoveMeshes & aiPrimitiveType_POLYGON) ? "X" : ""));
DefaultLogger::get()->info(buffer);
DefaultLogger::get()->debug("SortByPTypeProcess finished");
}

View File

@ -54,7 +54,8 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
TextureTransformStep::TextureTransformStep()
TextureTransformStep::TextureTransformStep() :
configFlags()
{
// nothing to do here
}

View File

@ -60,7 +60,8 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
ValidateDSProcess::ValidateDSProcess()
ValidateDSProcess::ValidateDSProcess() :
mScene()
{}
// ------------------------------------------------------------------------------------------------
@ -690,8 +691,7 @@ void ValidateDSProcess::Validate( const aiMaterial* pMaterial)
if (aiPTI_String == prop->mType) {
// FIX: strings are now stored in a less expensive way, but we can't use the
// validation routine for 'normal' aiStrings
uint32_t len;
if (prop->mDataLength < 5 || prop->mDataLength < 4 + (len=*reinterpret_cast<uint32_t*>(prop->mData)) + 1) {
if (prop->mDataLength < 5 || prop->mDataLength < 4 + (*reinterpret_cast<uint32_t*>(prop->mData)) + 1) {
ReportError("aiMaterial::mProperties[%i].mDataLength is "
"too small to contain a string (%i, needed: %i)",
i,prop->mDataLength,sizeof(aiString));

View File

@ -109,7 +109,14 @@ public:
mEnforcePP = pEnforcePP;
}
ExportFormatEntry() : mExportFunction(), mEnforcePP() {}
ExportFormatEntry() :
mExportFunction()
, mEnforcePP()
{
mDescription.id = NULL;
mDescription.description = NULL;
mDescription.fileExtension = NULL;
}
};