sprintf replacement: introduce au_snprintf to support snprintf for v2013

and earier ( closes https://github.com/assimp/assimp/issues/743 )
This commit is contained in:
Kim Kulling
2016-01-06 15:35:25 +01:00
parent 67c258e75d
commit 6bfdeb6a12
44 changed files with 208 additions and 97 deletions

View File

@@ -181,7 +181,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
const unsigned int idx = aiMappingTable[p];
if (ppcMaterials[idx]) {
aiString sz;
sz.length = ::sprintf(sz.data,"JoinedMaterial_#%u",p);
sz.length = ::ai_snprintf(sz.data,MAXLEN,"JoinedMaterial_#%u",p);
((aiMaterial*)ppcMaterials[idx])->AddProperty(&sz,AI_MATKEY_NAME);
} else {
ppcMaterials[idx] = pScene->mMaterials[p];
@@ -209,7 +209,7 @@ void RemoveRedundantMatsProcess::Execute( aiScene* pScene)
else
{
char szBuffer[128]; // should be sufficiently large
::sprintf(szBuffer,"RemoveRedundantMatsProcess finished. Removed %u redundant and %u unused materials.",
::ai_snprintf(szBuffer,128,"RemoveRedundantMatsProcess finished. Removed %u redundant and %u unused materials.",
redundantRemoved,unreferencedRemoved);
DefaultLogger::get()->info(szBuffer);
}