FIX: Cleaning up use of printf() format specifiers. %i mostly replaced by %u when appropriate.
FIX: 'size_t to %i' printf() vulnerability. FIX: Subdivision, change line&point handling, add missing parentheses to clarify order. Add missing headers to vc9 workspace. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@533 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
2e3fee99f0
commit
c55be8ada3
|
@ -176,7 +176,8 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
|
|||
light->mAttenuationConstant = 1.f;
|
||||
|
||||
// Generate a default name for both the light source and the node
|
||||
light->mName.length = ::sprintf(light->mName.data,"ACLight_%i",mLights->size()-1);
|
||||
// FIXME - what's the right way to print a size_t? Is 'zu' universally available? stick with the safe version.
|
||||
light->mName.length = ::sprintf(light->mName.data,"ACLight_%i",static_cast<unsigned int>(mLights->size())-1);
|
||||
obj.name = std::string( light->mName.data );
|
||||
|
||||
DefaultLogger::get()->debug("AC3D: Light source encountered");
|
||||
|
|
|
@ -177,7 +177,8 @@ void CatmullClarkSubdivider::Subdivide (
|
|||
// point meshes are simply passed through.
|
||||
for (size_t s = 0; s < nmesh; ++s) {
|
||||
const aiMesh* i = smesh[s];
|
||||
if ((i->mPrimitiveTypes & aiPrimitiveType_LINE|aiPrimitiveType_POINT)==i->mPrimitiveTypes) {
|
||||
// FIX - mPrimitiveTypes might not yet be initialized
|
||||
if (i->mPrimitiveTypes && (i->mPrimitiveTypes & (aiPrimitiveType_LINE|aiPrimitiveType_POINT))==i->mPrimitiveTypes) {
|
||||
DefaultLogger::get()->debug("Catmull-Clark Subdivider: Skipping pure line/point mesh");
|
||||
|
||||
if (discard_input) {
|
||||
|
@ -296,7 +297,7 @@ void CatmullClarkSubdivider::InternSubdivide (
|
|||
// face points and original points. Every edge exists twice
|
||||
// if there is a neighboring face.
|
||||
// ---------------------------------------------------------------------
|
||||
for (size_t t = 0, n = 0; t < nmesh; ++t) {
|
||||
for (size_t t = 0; t < nmesh; ++t) {
|
||||
const aiMesh* mesh = smesh[t];
|
||||
|
||||
for (unsigned int i = 0; i < mesh->mNumFaces;++i) {
|
||||
|
@ -342,8 +343,8 @@ void CatmullClarkSubdivider::InternSubdivide (
|
|||
// faces in the mesh. They occur at outer model boundaries in non-closed
|
||||
// shapes.
|
||||
char tmp[512];
|
||||
sprintf(tmp,"Catmull-Clark Subdivider: got %i bad edges touching only one face (totally %i edges). ",
|
||||
bad_cnt,edges.size());
|
||||
sprintf(tmp,"Catmull-Clark Subdivider: got %u bad edges touching only one face (totally %u edges). ",
|
||||
bad_cnt,static_cast<unsigned int>(edges.size()));
|
||||
|
||||
DefaultLogger::get()->debug(tmp);
|
||||
}}
|
||||
|
|
|
@ -359,7 +359,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
|
|||
|
||||
inChannels += mesh->GetNumUVChannels();
|
||||
|
||||
if (!mesh->mTextureCoords[0] || trafo.empty() || trafo.size() == 1 && trafo.begin()->IsUntransformed()) {
|
||||
if (!mesh->mTextureCoords[0] || trafo.empty() || (trafo.size() == 1 && trafo.begin()->IsUntransformed())) {
|
||||
outChannels += mesh->GetNumUVChannels();
|
||||
continue;
|
||||
}
|
||||
|
@ -371,10 +371,11 @@ void TextureTransformStep::Execute( aiScene* pScene)
|
|||
unsigned int untransformed = 0;
|
||||
|
||||
MeshTrafoList::iterator it,it2;
|
||||
for (it = trafo.begin(), it2;it != trafo.end(); ++it,++cnt) {
|
||||
for (it = trafo.begin();it != trafo.end(); ++it,++cnt) {
|
||||
|
||||
if (!(*it).IsUntransformed())
|
||||
if (!(*it).IsUntransformed()) {
|
||||
need = true;
|
||||
}
|
||||
|
||||
if ((*it).lockedPos == AI_TT_UV_IDX_LOCK_TBD) {
|
||||
// Lock this index and make sure it won't be changed
|
||||
|
@ -439,8 +440,8 @@ void TextureTransformStep::Execute( aiScene* pScene)
|
|||
if (size > AI_MAX_NUMBER_OF_TEXTURECOORDS) {
|
||||
|
||||
if (!DefaultLogger::isNullLogger()) {
|
||||
::sprintf(buffer,"%i UV channels required but just %i available",
|
||||
trafo.size(),AI_MAX_NUMBER_OF_TEXTURECOORDS);
|
||||
::sprintf(buffer,"%u UV channels required but just %u available",
|
||||
static_cast<unsigned int>(trafo.size()),AI_MAX_NUMBER_OF_TEXTURECOORDS);
|
||||
|
||||
DefaultLogger::get()->error(buffer);
|
||||
}
|
||||
|
@ -467,7 +468,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
|
|||
|
||||
// Write to the log
|
||||
if (!DefaultLogger::isNullLogger()) {
|
||||
sprintf(buffer,"Mesh %i, channel %i: t(%.3f,%.3f), s(%.3f,%.3f), r(%.3f), %s%s",
|
||||
sprintf(buffer,"Mesh %u, channel %u: t(%.3f,%.3f), s(%.3f,%.3f), r(%.3f), %s%s",
|
||||
q,n,
|
||||
(*it).mTranslation.x,
|
||||
(*it).mTranslation.y,
|
||||
|
@ -550,7 +551,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
|
|||
if (!DefaultLogger::isNullLogger()) {
|
||||
|
||||
if (transformedChannels) {
|
||||
::sprintf(buffer,"TransformUVCoordsProcess end: %i output channels (in: %i, modified: %i)",
|
||||
::sprintf(buffer,"TransformUVCoordsProcess end: %u output channels (in: %u, modified: %u)",
|
||||
outChannels,inChannels,transformedChannels);
|
||||
|
||||
DefaultLogger::get()->info(buffer);
|
||||
|
|
|
@ -1235,6 +1235,14 @@
|
|||
RelativePath="..\..\include\aiCamera.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\aiColor4D.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\aiColor4D.inl"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\aiConfig.h"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue