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

@@ -862,7 +862,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh
::snprintf(currentMesh.name,128,"sphere_%i",sphere++);
::ai_snprintf(currentMesh.name,128,"sphere_%i",sphere++);
}
// 'dod' - dodecahedron
else if (TokenMatch(sz,"dod",3))
@@ -879,7 +879,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh
::snprintf(currentMesh.name,128,"dodecahedron_%i",dodecahedron++);
::ai_snprintf(currentMesh.name,128,"dodecahedron_%i",dodecahedron++);
}
// 'oct' - octahedron
@@ -897,7 +897,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh
::snprintf(currentMesh.name,128,"octahedron_%i",octahedron++);
::ai_snprintf(currentMesh.name,128,"octahedron_%i",octahedron++);
}
// 'tet' - tetrahedron
@@ -915,7 +915,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh
::sprintf(currentMesh.name,"tetrahedron_%i",tetrahedron++);
::ai_snprintf(currentMesh.name,128,"tetrahedron_%i",tetrahedron++);
}
// 'hex' - hexahedron
@@ -933,7 +933,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh
::sprintf(currentMesh.name,"hexahedron_%i",hexahedron++);
::ai_snprintf(currentMesh.name,128,"hexahedron_%i",hexahedron++);
}
// 'c' - cone
else if (TokenMatch(sz,"c",1))
@@ -988,8 +988,8 @@ void NFFImporter::InternReadFile( const std::string& pFile,
// generate a name for the mesh. 'cone' if it a cone,
// 'cylinder' if it is a cylinder. Funny, isn't it?
if (radius1 != radius2)
::sprintf(currentMesh.name,"cone_%i",cone++);
else ::sprintf(currentMesh.name,"cylinder_%i",cylinder++);
::ai_snprintf(currentMesh.name,128,"cone_%i",cone++);
else ::ai_snprintf(currentMesh.name,128,"cylinder_%i",cylinder++);
}
// 'tess' - tesselation
else if (TokenMatch(sz,"tess",4))
@@ -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,"<NFF_Light%u>",i);
nd->mName.length = ::ai_snprintf(nd->mName.data,1024,"<NFF_Light%u>",i);
// allocate the light in the scene data structure
aiLight* out = pScene->mLights[i] = new aiLight();