diff --git a/code/3DSConverter.cpp b/code/3DSConverter.cpp index d5a83461c..00ea6deda 100644 --- a/code/3DSConverter.cpp +++ b/code/3DSConverter.cpp @@ -757,7 +757,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut) pcNode->mNumMeshes = 1; // Build a name for the node - pcNode->mName.length = sprintf(pcNode->mName.data,"3DSMesh_%i",i); + pcNode->mName.length = sprintf(pcNode->mName.data,"3DSMesh_%u",i); } // Build dummy nodes for all cameras diff --git a/code/ASEParser.cpp b/code/ASEParser.cpp index 7e16c43ed..7c254f8ba 100644 --- a/code/ASEParser.cpp +++ b/code/ASEParser.cpp @@ -143,9 +143,9 @@ void Parser::LogWarning(const char* szWarn) char szTemp[1024]; #if _MSC_VER >= 1400 - sprintf_s(szTemp,"Line %i: %s",iLineNumber,szWarn); + sprintf_s(szTemp,"Line %u: %s",iLineNumber,szWarn); #else - snprintf(szTemp,1024,"Line %i: %s",iLineNumber,szWarn); + snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn); #endif // output the warning to the logger ... @@ -159,9 +159,9 @@ void Parser::LogInfo(const char* szWarn) char szTemp[1024]; #if _MSC_VER >= 1400 - sprintf_s(szTemp,"Line %i: %s",iLineNumber,szWarn); + sprintf_s(szTemp,"Line %u: %s",iLineNumber,szWarn); #else - snprintf(szTemp,1024,"Line %i: %s",iLineNumber,szWarn); + snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn); #endif // output the information to the logger ... @@ -175,9 +175,9 @@ AI_WONT_RETURN void Parser::LogError(const char* szWarn) char szTemp[1024]; #if _MSC_VER >= 1400 - sprintf_s(szTemp,"Line %i: %s",iLineNumber,szWarn); + sprintf_s(szTemp,"Line %u: %s",iLineNumber,szWarn); #else - snprintf(szTemp,1024,"Line %i: %s",iLineNumber,szWarn); + snprintf(szTemp,1024,"Line %u: %s",iLineNumber,szWarn); #endif // throw an exception diff --git a/code/DeboneProcess.cpp b/code/DeboneProcess.cpp index 025a2ca76..05d33a464 100644 --- a/code/DeboneProcess.cpp +++ b/code/DeboneProcess.cpp @@ -147,7 +147,7 @@ void DeboneProcess::Execute( aiScene* pScene) if(!DefaultLogger::isNullLogger()) { char buffer[1024]; - ::sprintf(buffer,"Removed %i bones. Input bones: %i. Output bones: %i",in-out,in,out); + ::sprintf(buffer,"Removed %u bones. Input bones: %u. Output bones: %u",in-out,in,out); DefaultLogger::get()->info(buffer); } diff --git a/code/DefaultLogger.cpp b/code/DefaultLogger.cpp index b78b2abd6..f1bbd0c9f 100644 --- a/code/DefaultLogger.cpp +++ b/code/DefaultLogger.cpp @@ -258,7 +258,7 @@ void DefaultLogger::OnDebug( const char* message ) return; char msg[MAX_LOG_MESSAGE_LENGTH + 16]; - ::sprintf(msg,"Debug, T%i: %s", GetThreadID(), message ); + ::sprintf(msg,"Debug, T%u: %s", GetThreadID(), message ); WriteToStreams( msg, Logger::Debugging ); } @@ -268,7 +268,7 @@ void DefaultLogger::OnDebug( const char* message ) void DefaultLogger::OnInfo( const char* message ) { char msg[MAX_LOG_MESSAGE_LENGTH + 16]; - ::sprintf(msg,"Info, T%i: %s", GetThreadID(), message ); + ::sprintf(msg,"Info, T%u: %s", GetThreadID(), message ); WriteToStreams( msg , Logger::Info ); } @@ -278,7 +278,7 @@ void DefaultLogger::OnInfo( const char* message ) void DefaultLogger::OnWarn( const char* message ) { char msg[MAX_LOG_MESSAGE_LENGTH + 16]; - ::sprintf(msg,"Warn, T%i: %s", GetThreadID(), message ); + ::sprintf(msg,"Warn, T%u: %s", GetThreadID(), message ); WriteToStreams( msg, Logger::Warn ); } @@ -288,7 +288,7 @@ void DefaultLogger::OnWarn( const char* message ) void DefaultLogger::OnError( const char* message ) { char msg[MAX_LOG_MESSAGE_LENGTH + 16]; - ::sprintf(msg,"Error, T%i: %s", GetThreadID(), message ); + ::sprintf(msg,"Error, T%u: %s", GetThreadID(), message ); WriteToStreams( msg, Logger::Err ); } diff --git a/code/IRRLoader.cpp b/code/IRRLoader.cpp index b082168c1..d3890b601 100644 --- a/code/IRRLoader.cpp +++ b/code/IRRLoader.cpp @@ -194,7 +194,7 @@ void IRRImporter::BuildSkybox(std::vector& meshes, std::vectorAddProperty(&s,AI_MATKEY_NAME); int shading = aiShadingMode_NoShading; diff --git a/code/LWOLoader.cpp b/code/LWOLoader.cpp index fd29f23f1..188afc5f4 100644 --- a/code/LWOLoader.cpp +++ b/code/LWOLoader.cpp @@ -209,7 +209,7 @@ void LWOImporter::InternReadFile( const std::string& pFile, // we need to check now whether the requested layer has been found. if (UINT_MAX != configLayerIndex) { unsigned int layerCount = 0; - for(std::list::iterator itLayers=mLayers->begin(); itLayers!=mLayers->end(); itLayers++) + for(std::list::iterator itLayers=mLayers->begin(); itLayers!=mLayers->end(); ++itLayers) if (!itLayers->skip) layerCount++; if (layerCount!=2) diff --git a/code/LWSLoader.cpp b/code/LWSLoader.cpp index cb0daf2e9..161d90fa6 100644 --- a/code/LWSLoader.cpp +++ b/code/LWSLoader.cpp @@ -450,7 +450,7 @@ void LWSImporter::BuildGraph(aiNode* nd, LWS::NodeDesc& src, std::vectormChildren = new aiNode*[src.children.size()]; for (std::list::iterator it = src.children.begin(); it != src.children.end(); ++it) { aiNode* ndd = nd->mChildren[nd->mNumChildren++] = new aiNode(); diff --git a/code/LimitBoneWeightsProcess.cpp b/code/LimitBoneWeightsProcess.cpp index 3f46dd100..53e5ce360 100644 --- a/code/LimitBoneWeightsProcess.cpp +++ b/code/LimitBoneWeightsProcess.cpp @@ -193,7 +193,7 @@ void LimitBoneWeightsProcess::ProcessMesh( aiMesh* pMesh) if (!DefaultLogger::isNullLogger()) { char buffer[1024]; - ::sprintf(buffer,"Removed %i weights. Input bones: %i. Output bones: %i",removed,old_bones,pMesh->mNumBones); + ::sprintf(buffer,"Removed %u weights. Input bones: %u. Output bones: %u",removed,old_bones,pMesh->mNumBones); DefaultLogger::get()->info(buffer); } } diff --git a/code/MD3Loader.cpp b/code/MD3Loader.cpp index a78a5e3f2..cf07f295f 100644 --- a/code/MD3Loader.cpp +++ b/code/MD3Loader.cpp @@ -791,7 +791,7 @@ void MD3Importer::InternReadFile( const std::string& pFile, // Adjust all texture paths in the shader const char* header_name = pcHeader->NAME; - if (shaders.blocks.size()) { + if (!shaders.blocks.empty()) { for (std::list< Q3Shader::ShaderDataBlock >::iterator dit = shaders.blocks.begin(); dit != shaders.blocks.end(); ++dit) { ConvertPath((*dit).name.c_str(),header_name,(*dit).name); @@ -881,7 +881,7 @@ void MD3Importer::InternReadFile( const std::string& pFile, // Now search the current shader for a record with this name ( // excluding texture file extension) - if (shaders.blocks.size()) { + if (!shaders.blocks.empty()) { std::string::size_type s = convertedPath.find_last_of('.'); if (s == std::string::npos) diff --git a/code/MD5Parser.cpp b/code/MD5Parser.cpp index 6be956593..395dedd14 100644 --- a/code/MD5Parser.cpp +++ b/code/MD5Parser.cpp @@ -95,7 +95,7 @@ MD5Parser::MD5Parser(char* _buffer, unsigned int _fileSize ) /*static*/ AI_WONT_RETURN void MD5Parser::ReportError (const char* error, unsigned int line) { char szBuffer[1024]; - ::sprintf(szBuffer,"[MD5] Line %i: %s",line,error); + ::sprintf(szBuffer,"[MD5] Line %u: %s",line,error); throw DeadlyImportError(szBuffer); } @@ -104,7 +104,7 @@ MD5Parser::MD5Parser(char* _buffer, unsigned int _fileSize ) /*static*/ void MD5Parser::ReportWarning (const char* warn, unsigned int line) { char szBuffer[1024]; - ::sprintf(szBuffer,"[MD5] Line %i: %s",line,warn); + ::sprintf(szBuffer,"[MD5] Line %u: %s",line,warn); DefaultLogger::get()->warn(szBuffer); } diff --git a/code/MDLLoader.cpp b/code/MDLLoader.cpp index b2de6bfe5..320956cc1 100644 --- a/code/MDLLoader.cpp +++ b/code/MDLLoader.cpp @@ -264,7 +264,7 @@ void MDLImporter::SizeCheck(const void* szPos, const char* szFile, unsigned int char szBuffer[1024]; ::sprintf(szBuffer,"Invalid MDL file. The file is too small " - "or contains invalid data (File: %s Line: %i)",szFilePtr,iLine); + "or contains invalid data (File: %s Line: %u)",szFilePtr,iLine); throw DeadlyImportError(szBuffer); } @@ -1536,7 +1536,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( ) // setup the name of the node char* const szBuffer = &aszGroupNameBuffer[i*AI_MDL7_MAX_GROUPNAMESIZE]; if ('\0' == *szBuffer) - pcNode->mName.length = ::sprintf(szBuffer,"Group_%i",p); + pcNode->mName.length = ::sprintf(szBuffer,"Group_%u",p); else pcNode->mName.length = ::strlen(szBuffer); ::strcpy(pcNode->mName.data,szBuffer); ++p; diff --git a/code/MS3DLoader.cpp b/code/MS3DLoader.cpp index 341ee6674..e7ad85881 100644 --- a/code/MS3DLoader.cpp +++ b/code/MS3DLoader.cpp @@ -531,7 +531,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile, } // allocate storage for bones - if(mybones.size()) { + if(!mybones.empty()) { std::vector bmap(joints.size()); m->mBones = new aiBone*[mybones.size()](); for(BoneSet::const_iterator it = mybones.begin(); it != mybones.end(); ++it) { diff --git a/code/NFFLoader.cpp b/code/NFFLoader.cpp index f180ba988..2d8c0d5da 100644 --- a/code/NFFLoader.cpp +++ b/code/NFFLoader.cpp @@ -1115,7 +1115,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, aiNode* nd = *ppcChildren = new aiNode(); nd->mParent = root; - nd->mName.length = ::sprintf(nd->mName.data,"",i); + nd->mName.length = ::sprintf(nd->mName.data,"",i); // allocate the light in the scene data structure aiLight* out = pScene->mLights[i] = new aiLight(); diff --git a/code/ObjExporter.cpp b/code/ObjExporter.cpp index 099b337da..90f4241eb 100644 --- a/code/ObjExporter.cpp +++ b/code/ObjExporter.cpp @@ -288,7 +288,7 @@ int ObjExporter::vecIndexMap::getIndex(const aiVector3D& vec) void ObjExporter::vecIndexMap::getVectors( std::vector& vecs ) { vecs.resize(vecMap.size()); - for(vecIndexMap::dataType::iterator it = vecMap.begin(); it != vecMap.end(); it++){ + for(vecIndexMap::dataType::iterator it = vecMap.begin(); it != vecMap.end(); ++it){ vecs[it->second-1] = it->first; } } diff --git a/code/ObjFileParser.h b/code/ObjFileParser.h index 1883b7260..8a8a51306 100644 --- a/code/ObjFileParser.h +++ b/code/ObjFileParser.h @@ -122,6 +122,11 @@ private: void reportErrorTokenInFace(); private: + // Copy and assignment constructor should be private + // because the class contains pointer to allocated memory + ObjFileParser(const ObjFileParser& rhs); + ObjFileParser& operator=(const ObjFileParser& rhs); + /// Default material name static const std::string DEFAULT_MATERIAL; //! Iterator to current position in buffer diff --git a/code/OgreImporter.h b/code/OgreImporter.h index 1b4b608f6..b37ec2d75 100644 --- a/code/OgreImporter.h +++ b/code/OgreImporter.h @@ -81,7 +81,7 @@ private: void AssignMaterials(aiScene *pScene, std::vector &materials); /// Reads material - aiMaterial* ReadMaterial(const std::string &pFile, Assimp::IOSystem *pIOHandler, const std::string MaterialName); + aiMaterial* ReadMaterial(const std::string &pFile, Assimp::IOSystem *pIOHandler, const std::string &MaterialName); // These functions parse blocks from a material file from @c ss. Starting parsing from "{" and ending it to "}". bool ReadTechnique(const std::string &techniqueName, std::stringstream &ss, aiMaterial *material); diff --git a/code/OgreMaterial.cpp b/code/OgreMaterial.cpp index cf8951549..a5eb6fb19 100644 --- a/code/OgreMaterial.cpp +++ b/code/OgreMaterial.cpp @@ -120,7 +120,7 @@ void OgreImporter::AssignMaterials(aiScene *pScene, std::vector &ma } } -aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSystem *pIOHandler, const std::string materialName) +aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSystem *pIOHandler, const std::string &materialName) { if (materialName.empty()) { return 0; diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index 7065bbe81..a5736ce0f 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -300,7 +300,7 @@ void OpenGEXImporter::handleNodes( DDLNode *node, aiScene *pScene ) { } DDLNode::DllNodeList childs = node->getChildNodeList(); - for( DDLNode::DllNodeList::iterator it = childs.begin(); it != childs.end(); it++ ) { + for( DDLNode::DllNodeList::iterator it = childs.begin(); it != childs.end(); ++it ) { Grammar::TokenType tokenType( Grammar::matchTokenType( ( *it )->getType().c_str() ) ); switch( tokenType ) { case Grammar::MetricToken: diff --git a/code/OptimizeGraph.cpp b/code/OptimizeGraph.cpp index 25dca7923..22e27bfac 100644 --- a/code/OptimizeGraph.cpp +++ b/code/OptimizeGraph.cpp @@ -225,7 +225,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list& no delete[] nd->mChildren; - if (child_nodes.size()) + if (!child_nodes.empty()) nd->mChildren = new aiNode*[child_nodes.size()]; else nd->mChildren = NULL; } @@ -335,7 +335,7 @@ void OptimizeGraphProcess::Execute( aiScene* pScene) if ( nodes_in != nodes_out) { char buf[512]; - sprintf(buf,"OptimizeGraphProcess finished; Input nodes: %i, Output nodes: %i",nodes_in,nodes_out); + sprintf(buf,"OptimizeGraphProcess finished; Input nodes: %u, Output nodes: %u",nodes_in,nodes_out); DefaultLogger::get()->info(buf); } else DefaultLogger::get()->debug("OptimizeGraphProcess finished"); diff --git a/code/OptimizeMeshes.cpp b/code/OptimizeMeshes.cpp index 870369315..f17fb5a20 100644 --- a/code/OptimizeMeshes.cpp +++ b/code/OptimizeMeshes.cpp @@ -150,7 +150,7 @@ void OptimizeMeshesProcess::Execute( aiScene* pScene) if (output.size() != num_old) { char tmp[512]; - ::sprintf(tmp,"OptimizeMeshesProcess finished. Input meshes: %i, Output meshes: %i",num_old,pScene->mNumMeshes); + ::sprintf(tmp,"OptimizeMeshesProcess finished. Input meshes: %u, Output meshes: %u",num_old,pScene->mNumMeshes); DefaultLogger::get()->info(tmp); } else { DefaultLogger::get()->debug( "OptimizeMeshesProcess finished" ); diff --git a/code/PretransformVertices.cpp b/code/PretransformVertices.cpp index 1c7a9a4e0..c98647c1a 100644 --- a/code/PretransformVertices.cpp +++ b/code/PretransformVertices.cpp @@ -644,7 +644,7 @@ void PretransformVertices::Execute( aiScene* pScene) { aiNode* pcNode = *nodes = new aiNode(); pcNode->mParent = pScene->mRootNode; - pcNode->mName.length = ::sprintf(pcNode->mName.data,"mesh_%i",i); + pcNode->mName.length = ::sprintf(pcNode->mName.data,"mesh_%u",i); // setup mesh indices pcNode->mNumMeshes = 1; @@ -656,7 +656,7 @@ void PretransformVertices::Execute( aiScene* pScene) { aiNode* pcNode = *nodes = new aiNode(); pcNode->mParent = pScene->mRootNode; - pcNode->mName.length = ::sprintf(pcNode->mName.data,"light_%i",i); + pcNode->mName.length = ::sprintf(pcNode->mName.data,"light_%u",i); pScene->mLights[i]->mName = pcNode->mName; } // generate camera nodes @@ -664,7 +664,7 @@ void PretransformVertices::Execute( aiScene* pScene) { aiNode* pcNode = *nodes = new aiNode(); pcNode->mParent = pScene->mRootNode; - pcNode->mName.length = ::sprintf(pcNode->mName.data,"cam_%i",i); + pcNode->mName.length = ::sprintf(pcNode->mName.data,"cam_%u",i); pScene->mCameras[i]->mName = pcNode->mName; } } @@ -707,15 +707,15 @@ void PretransformVertices::Execute( aiScene* pScene) DefaultLogger::get()->debug("PretransformVerticesProcess finished"); - sprintf(buffer,"Removed %i nodes and %i animation channels (%i output nodes)", + sprintf(buffer,"Removed %u nodes and %u animation channels (%u output nodes)", iOldNodes,iOldAnimationChannels,CountNodes(pScene->mRootNode)); DefaultLogger::get()->info(buffer); - sprintf(buffer,"Kept %i lights and %i cameras", + sprintf(buffer,"Kept %u lights and %u cameras", pScene->mNumLights,pScene->mNumCameras); DefaultLogger::get()->info(buffer); - sprintf(buffer,"Moved %i meshes to WCS (number of output meshes: %i)", + sprintf(buffer,"Moved %u meshes to WCS (number of output meshes: %u)", iOldMeshes,pScene->mNumMeshes); DefaultLogger::get()->info(buffer); } diff --git a/code/RemoveRedundantMaterials.cpp b/code/RemoveRedundantMaterials.cpp index 2c760db0c..d3dfb6cae 100644 --- a/code/RemoveRedundantMaterials.cpp +++ b/code/RemoveRedundantMaterials.cpp @@ -180,7 +180,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene) if (ppcMaterials[idx]) { aiString sz; - sz.length = ::sprintf(sz.data,"JoinedMaterial_#%i",p); + sz.length = ::sprintf(sz.data,"JoinedMaterial_#%u",p); ((aiMaterial*)ppcMaterials[idx])->AddProperty(&sz,AI_MATKEY_NAME); } else @@ -207,7 +207,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene) else { char szBuffer[128]; // should be sufficiently large - ::sprintf(szBuffer,"RemoveRedundantMatsProcess finished. Removed %i redundant and %i unused materials.", + ::sprintf(szBuffer,"RemoveRedundantMatsProcess finished. Removed %u redundant and %u unused materials.", redundantRemoved,unreferencedRemoved); DefaultLogger::get()->info(szBuffer); } diff --git a/code/SMDLoader.cpp b/code/SMDLoader.cpp index 31c8c4fda..78c33e8c2 100644 --- a/code/SMDLoader.cpp +++ b/code/SMDLoader.cpp @@ -208,7 +208,7 @@ void SMDImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS void SMDImporter::LogErrorNoThrow(const char* msg) { char szTemp[1024]; - sprintf(szTemp,"Line %i: %s",iLineNumber,msg); + sprintf(szTemp,"Line %u: %s",iLineNumber,msg); DefaultLogger::get()->error(szTemp); } @@ -218,7 +218,7 @@ void SMDImporter::LogWarning(const char* msg) { char szTemp[1024]; ai_assert(strlen(msg) < 1000); - sprintf(szTemp,"Line %i: %s",iLineNumber,msg); + sprintf(szTemp,"Line %u: %s",iLineNumber,msg); DefaultLogger::get()->warn(szTemp); } @@ -647,7 +647,7 @@ void SMDImporter::CreateOutputMaterials() pScene->mMaterials[iMat] = pcMat; aiString szName; - szName.length = (size_t)::sprintf(szName.data,"Texture_%i",iMat); + szName.length = (size_t)::sprintf(szName.data,"Texture_%u",iMat); pcMat->AddProperty(&szName,AI_MATKEY_NAME); if (aszTextures[iMat].length()) diff --git a/code/StepExporter.cpp b/code/StepExporter.cpp index 845396780..58e0aa69e 100644 --- a/code/StepExporter.cpp +++ b/code/StepExporter.cpp @@ -251,7 +251,7 @@ void StepExporter::WriteFile() mOutput << "))" << endstr; // write all the unique transformed CARTESIAN and VERTEX - for (MeshesByNodeMap::const_iterator it2 = meshes.begin(); it2 != meshes.end(); it2++) + for (MeshesByNodeMap::const_iterator it2 = meshes.begin(); it2 != meshes.end(); ++it2) { const aiNode& node = *(*it2).first; unsigned int mesh_idx = (*it2).second; diff --git a/code/UnrealLoader.cpp b/code/UnrealLoader.cpp index 163af55a4..19b42b196 100644 --- a/code/UnrealLoader.cpp +++ b/code/UnrealLoader.cpp @@ -377,7 +377,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile, aiColor3D color(1.f,1.f,1.f); aiString s; - ::sprintf(s.data,"mat%i_tx%i_",i,materials[i].tex); + ::sprintf(s.data,"mat%u_tx%u_",i,materials[i].tex); // set the two-sided flag if (materials[i].type == Unreal::MF_NORMAL_TS) {