From 2e262dbbc601e4fec6798aeced0140c7aeece4fb Mon Sep 17 00:00:00 2001 From: Charlie Gettys Date: Sat, 9 Mar 2019 12:36:21 -0500 Subject: [PATCH] Make syntax used to call ReportError & ReportWarning a bit more consistent --- code/ValidateDataStructure.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/code/ValidateDataStructure.cpp b/code/ValidateDataStructure.cpp index 5a80f73c9..0a6b0b2ac 100644 --- a/code/ValidateDataStructure.cpp +++ b/code/ValidateDataStructure.cpp @@ -170,7 +170,7 @@ inline void ValidateDSProcess::DoValidationEx(T** parray, unsigned int size, { 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); } } @@ -422,7 +422,9 @@ void ValidateDSProcess::Validate( const aiMesh* pMesh) if (!abRefList[i])b = true; } 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 ... { @@ -557,7 +559,9 @@ void ValidateDSProcess::Validate( const aiAnimation* pAnimation) 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. // if (!pAnimation->mDuration)this->ReportError("aiAnimation::mDuration is zero"); @@ -773,8 +777,10 @@ void ValidateDSProcess::Validate( const aiTexture* pTexture) } if (pTexture->mHeight) { - if (!pTexture->mWidth)ReportError("aiTexture::mWidth is zero " - "(aiTexture::mHeight is %i, uncompressed texture)",pTexture->mHeight); + if (!pTexture->mWidth){ + ReportError("aiTexture::mWidth is zero (aiTexture::mHeight is %i, uncompressed texture)", + pTexture->mHeight); + } } else { @@ -813,7 +819,7 @@ void ValidateDSProcess::Validate( const aiAnimation* pAnimation, { if (!pNodeAnim->mPositionKeys) { - this->ReportError("aiNodeAnim::mPositionKeys is NULL (aiNodeAnim::mNumPositionKeys is %i)", + ReportError("aiNodeAnim::mPositionKeys is NULL (aiNodeAnim::mNumPositionKeys is %i)", pNodeAnim->mNumPositionKeys); } double dLast = -10e10; @@ -844,7 +850,7 @@ void ValidateDSProcess::Validate( const aiAnimation* pAnimation, { if (!pNodeAnim->mRotationKeys) { - this->ReportError("aiNodeAnim::mRotationKeys is NULL (aiNodeAnim::mNumRotationKeys is %i)", + ReportError("aiNodeAnim::mRotationKeys is NULL (aiNodeAnim::mNumRotationKeys is %i)", pNodeAnim->mNumRotationKeys); } 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 this->Validate(&pNode->mName); 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 @@ -956,7 +962,7 @@ void ValidateDSProcess::Validate( const aiString* pString) { 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); } const char* sz = pString->data; @@ -964,12 +970,14 @@ void ValidateDSProcess::Validate( const aiString* pString) { 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"); + } break; } - else if (sz >= &pString->data[MAXLEN]) + else if (sz >= &pString->data[MAXLEN]) { ReportError("aiString::data is invalid. There is no terminal character"); + } ++sz; } }