Make syntax used to call ReportError & ReportWarning a bit more consistent

pull/2366/head
Charlie Gettys 2019-03-09 12:36:21 -05:00
parent 80dffb63e8
commit 2e262dbbc6
1 changed files with 19 additions and 11 deletions

View File

@ -170,7 +170,7 @@ inline void ValidateDSProcess::DoValidationEx(T** parray, unsigned int size,
{ {
if (parray[i]->mName == parray[a]->mName) if (parray[i]->mName == parray[a]->mName)
{ {
this->ReportError("aiScene::%s[%i] has the same name as " ReportError("aiScene::%s[%i] has the same name as "
"aiScene::%s[%i]",firstName, i,secondName, a); "aiScene::%s[%i]",firstName, i,secondName, a);
} }
} }
@ -422,7 +422,9 @@ void ValidateDSProcess::Validate( const aiMesh* pMesh)
if (!abRefList[i])b = true; if (!abRefList[i])b = true;
} }
abRefList.clear(); abRefList.clear();
if (b)ReportWarning("There are unreferenced vertices"); if (b) {
ReportWarning("There are unreferenced vertices");
}
// texture channel 2 may not be set if channel 1 is zero ... // texture channel 2 may not be set if channel 1 is zero ...
{ {
@ -557,7 +559,9 @@ void ValidateDSProcess::Validate( const aiAnimation* pAnimation)
Validate(pAnimation, pAnimation->mChannels[i]); Validate(pAnimation, pAnimation->mChannels[i]);
} }
} }
else ReportError("aiAnimation::mNumChannels is 0. At least one node animation channel must be there."); else {
ReportError("aiAnimation::mNumChannels is 0. At least one node animation channel must be there.");
}
// Animation duration is allowed to be zero in cases where the anim contains only a single key frame. // Animation duration is allowed to be zero in cases where the anim contains only a single key frame.
// if (!pAnimation->mDuration)this->ReportError("aiAnimation::mDuration is zero"); // if (!pAnimation->mDuration)this->ReportError("aiAnimation::mDuration is zero");
@ -773,8 +777,10 @@ void ValidateDSProcess::Validate( const aiTexture* pTexture)
} }
if (pTexture->mHeight) if (pTexture->mHeight)
{ {
if (!pTexture->mWidth)ReportError("aiTexture::mWidth is zero " if (!pTexture->mWidth){
"(aiTexture::mHeight is %i, uncompressed texture)",pTexture->mHeight); ReportError("aiTexture::mWidth is zero (aiTexture::mHeight is %i, uncompressed texture)",
pTexture->mHeight);
}
} }
else else
{ {
@ -813,7 +819,7 @@ void ValidateDSProcess::Validate( const aiAnimation* pAnimation,
{ {
if (!pNodeAnim->mPositionKeys) if (!pNodeAnim->mPositionKeys)
{ {
this->ReportError("aiNodeAnim::mPositionKeys is NULL (aiNodeAnim::mNumPositionKeys is %i)", ReportError("aiNodeAnim::mPositionKeys is NULL (aiNodeAnim::mNumPositionKeys is %i)",
pNodeAnim->mNumPositionKeys); pNodeAnim->mNumPositionKeys);
} }
double dLast = -10e10; double dLast = -10e10;
@ -844,7 +850,7 @@ void ValidateDSProcess::Validate( const aiAnimation* pAnimation,
{ {
if (!pNodeAnim->mRotationKeys) if (!pNodeAnim->mRotationKeys)
{ {
this->ReportError("aiNodeAnim::mRotationKeys is NULL (aiNodeAnim::mNumRotationKeys is %i)", ReportError("aiNodeAnim::mRotationKeys is NULL (aiNodeAnim::mNumRotationKeys is %i)",
pNodeAnim->mNumRotationKeys); pNodeAnim->mNumRotationKeys);
} }
double dLast = -10e10; double dLast = -10e10;
@ -911,7 +917,7 @@ void ValidateDSProcess::Validate( const aiNode* pNode)
// Validate node name string first so that it's safe to use in below expressions // Validate node name string first so that it's safe to use in below expressions
this->Validate(&pNode->mName); this->Validate(&pNode->mName);
if (pNode != mScene->mRootNode && !pNode->mParent){ if (pNode != mScene->mRootNode && !pNode->mParent){
this->ReportError("Non-root node %s lacks a valid parent (aiNode::mParent is NULL) ",pNode->mName); ReportError("Non-root node %s lacks a valid parent (aiNode::mParent is NULL) ",pNode->mName);
} }
// validate all meshes // validate all meshes
@ -956,7 +962,7 @@ void ValidateDSProcess::Validate( const aiString* pString)
{ {
if (pString->length > MAXLEN) if (pString->length > MAXLEN)
{ {
this->ReportError("aiString::length is too large (%i, maximum is %lu)", ReportError("aiString::length is too large (%i, maximum is %lu)",
pString->length,MAXLEN); pString->length,MAXLEN);
} }
const char* sz = pString->data; const char* sz = pString->data;
@ -964,12 +970,14 @@ void ValidateDSProcess::Validate( const aiString* pString)
{ {
if ('\0' == *sz) if ('\0' == *sz)
{ {
if (pString->length != (unsigned int)(sz-pString->data)) if (pString->length != (unsigned int)(sz-pString->data)) {
ReportError("aiString::data is invalid: the terminal zero is at a wrong offset"); ReportError("aiString::data is invalid: the terminal zero is at a wrong offset");
}
break; break;
} }
else if (sz >= &pString->data[MAXLEN]) else if (sz >= &pString->data[MAXLEN]) {
ReportError("aiString::data is invalid. There is no terminal character"); ReportError("aiString::data is invalid. There is no terminal character");
}
++sz; ++sz;
} }
} }