From ec6c62e0056164e7383b8ab03180f094c416a0b5 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Sun, 22 Apr 2012 23:22:40 +0000 Subject: [PATCH] - consistent use of ai_assert instead of assert. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1241 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/ColladaParser.cpp | 6 +++--- code/XFileImporter.cpp | 2 +- code/XFileParser.cpp | 4 ++-- include/assimp/Importer.hpp | 1 - tools/assimp_cmd/CompareDump.cpp | 12 ++++++------ tools/assimp_cmd/WriteDumb.cpp | 2 +- tools/assimp_view/MessageProc.cpp | 4 ++-- tools/assimp_view/assimp_view.cpp | 2 +- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index b3f31a1e1..06b03f39d 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -2115,7 +2115,7 @@ void ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector& pPer for( size_t b = 0; b < numPoints; b++) { // read all indices for this vertex. Yes, in a hacky local array - assert( numOffsets < 20 && perVertexOffset < 20); + ai_assert( numOffsets < 20 && perVertexOffset < 20); size_t vindex[20]; for( size_t offsets = 0; offsets < numOffsets; ++offsets) vindex[offsets] = *idx++; @@ -2313,7 +2313,7 @@ void ColladaParser::ReadSceneNode( Node* pNode) child->mName = mReader->getAttributeValue( attrName); // TODO: (thom) support SIDs - // assert( TestAttribute( "sid") == -1); + // ai_assert( TestAttribute( "sid") == -1); if (pNode) { @@ -2781,7 +2781,7 @@ aiMatrix4x4 ColladaParser::CalculateResultTransform( const std::vector& bones = sourceMesh->mBones; diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index 861f8bb18..73914c516 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -1240,7 +1240,7 @@ void XFileParser::ReadUntilEndOfLine() // ------------------------------------------------------------------------------------------------ unsigned short XFileParser::ReadBinWord() { - assert(End - P >= 2); + ai_assert(End - P >= 2); const unsigned char* q = (const unsigned char*) P; unsigned short tmp = q[0] | (q[1] << 8); P += 2; @@ -1250,7 +1250,7 @@ unsigned short XFileParser::ReadBinWord() // ------------------------------------------------------------------------------------------------ unsigned int XFileParser::ReadBinDWord() { - assert(End - P >= 4); + ai_assert(End - P >= 4); const unsigned char* q = (const unsigned char*) P; unsigned int tmp = q[0] | (q[1] << 8) | (q[2] << 16) | (q[3] << 24); P += 4; diff --git a/include/assimp/Importer.hpp b/include/assimp/Importer.hpp index 1f780522b..e0a1c8cb6 100644 --- a/include/assimp/Importer.hpp +++ b/include/assimp/Importer.hpp @@ -52,7 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Public ASSIMP data structures #include "types.h" #include "config.h" -#include "assert.h" namespace Assimp { // ======================================================================= diff --git a/tools/assimp_cmd/CompareDump.cpp b/tools/assimp_cmd/CompareDump.cpp index 4c54964d6..b46407fe8 100644 --- a/tools/assimp_cmd/CompareDump.cpp +++ b/tools/assimp_cmd/CompareDump.cpp @@ -113,8 +113,8 @@ public: , expect(expect) , cnt_chunks(0) { - assert(actual); - assert(expect); + ai_assert(actual); + ai_assert(expect); fseek(actual,0,SEEK_END); lengths.push(std::make_pair(static_cast(ftell(actual)),0)); @@ -142,7 +142,7 @@ public: /* leave current scope */ void pop_elem() { - assert(history.size()); + ai_assert(history.size()); history.pop_back(); } @@ -155,19 +155,19 @@ public: /* pop the chunk length stack */ void pop_length() { - assert(lengths.size()); + ai_assert(lengths.size()); lengths.pop(); } /* access the current chunk length */ uint32_t get_latest_chunk_length() { - assert(lengths.size()); + ai_assert(lengths.size()); return lengths.top().first; } /* access the current chunk start offset */ uint32_t get_latest_chunk_start() { - assert(lengths.size()); + ai_assert(lengths.size()); return lengths.top().second; } diff --git a/tools/assimp_cmd/WriteDumb.cpp b/tools/assimp_cmd/WriteDumb.cpp index b81f89338..c12ebdd06 100644 --- a/tools/assimp_cmd/WriteDumb.cpp +++ b/tools/assimp_cmd/WriteDumb.cpp @@ -689,7 +689,7 @@ void WriteBinaryDump(const aiScene* scene, FILE* _out, const char* src, const ch // == 435 bytes // ==== total header size: 512 bytes - assert(ftell(out)==ASSBIN_HEADER_LENGTH); + ai_assert(ftell(out)==ASSBIN_HEADER_LENGTH); // Up to here the data is uncompressed. For compressed files, the rest // is compressed using standard DEFLATE from zlib. diff --git a/tools/assimp_view/MessageProc.cpp b/tools/assimp_view/MessageProc.cpp index 12a9a036e..277242ed1 100644 --- a/tools/assimp_view/MessageProc.cpp +++ b/tools/assimp_view/MessageProc.cpp @@ -91,7 +91,7 @@ void MakeFileAssociations() do { char buf[256]; - assert(sz[0] == '*'); + ai_assert(sz[0] == '*'); sprintf(buf,"Software\\Classes\\%s",sz+1); RegCreateKeyEx(HKEY_CURRENT_USER,buf,NULL,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL); @@ -1035,7 +1035,7 @@ void DoExport(size_t formatId) Exporter exp; const aiExportFormatDesc* const e = exp.GetExportFormatDescription(formatId); - assert(e); + ai_assert(e); char szFileName[MAX_PATH*2]; DWORD dwTemp; diff --git a/tools/assimp_view/assimp_view.cpp b/tools/assimp_view/assimp_view.cpp index a372a9844..5af9cf547 100644 --- a/tools/assimp_view/assimp_view.cpp +++ b/tools/assimp_view/assimp_view.cpp @@ -505,7 +505,7 @@ int CreateAssetData() nidx = 2;break; case aiPrimitiveType_TRIANGLE: nidx = 3;break; - default: assert(false); + default: ai_assert(false); }; // check whether we can use 16 bit indices