From: Kim Kulling Date: Mon, 14 Aug 2017 20:20:26 +0000 (+0200) Subject: assert: remove assert with more than one statement and use only ai_assert. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dab09859944ef18f09e8ade9b16a65e3bf3f06f6;p=platform%2Fupstream%2Fassimp.git assert: remove assert with more than one statement and use only ai_assert. --- diff --git a/code/ColladaExporter.h b/code/ColladaExporter.h index 36c012f..c782727 100644 --- a/code/ColladaExporter.h +++ b/code/ColladaExporter.h @@ -128,7 +128,10 @@ protected: /// Enters a new xml element, which increases the indentation void PushTag() { startstr.append( " "); } /// Leaves an element, decreasing the indentation - void PopTag() { ai_assert( startstr.length() > 1); startstr.erase( startstr.length() - 2); } + void PopTag() { + ai_assert( startstr.length() > 1); + startstr.erase( startstr.length() - 2); + } /// Creates a mesh ID for the given mesh std::string GetMeshId( size_t pIndex) const { diff --git a/code/D3MFOpcPackage.cpp b/code/D3MFOpcPackage.cpp index ff6fddc..b6b1ba1 100644 --- a/code/D3MFOpcPackage.cpp +++ b/code/D3MFOpcPackage.cpp @@ -229,7 +229,7 @@ ZipFile::~ZipFile() { size_t ZipFile::Read(void* pvBuffer, size_t pSize, size_t pCount) { const size_t size = pSize * pCount; - assert(size <= m_Size); + ai_assert(size <= m_Size); std::memcpy(pvBuffer, m_Buffer, size); diff --git a/code/FBXMeshGeometry.cpp b/code/FBXMeshGeometry.cpp index 3a57cfd..8d43a24 100644 --- a/code/FBXMeshGeometry.cpp +++ b/code/FBXMeshGeometry.cpp @@ -243,7 +243,6 @@ const unsigned int* MeshGeometry::ToOutputVertexIndex( unsigned int in_index, un ai_assert( m_mapping_counts.size() == m_mapping_offsets.size() ); count = m_mapping_counts[ in_index ]; -// ai_assert( count != 0 ); ai_assert( m_mapping_offsets[ in_index ] + count <= m_mappings.size() ); return &m_mappings[ m_mapping_offsets[ in_index ] ]; diff --git a/code/FBXProperties.h b/code/FBXProperties.h index a89a858..91b7c81 100644 --- a/code/FBXProperties.h +++ b/code/FBXProperties.h @@ -55,14 +55,12 @@ namespace FBX { // Forward declarations class Element; - /** Represents a dynamic property. Type info added by deriving classes, * see #TypedProperty. Example: @verbatim P: "ShininessExponent", "double", "Number", "",0.5 @endvebatim - */ class Property { @@ -79,7 +77,6 @@ public: } }; - template class TypedProperty : public Property { @@ -138,38 +135,35 @@ private: // ------------------------------------------------------------------------------------------------ template -inline T PropertyGet(const PropertyTable& in, const std::string& name, - const T& defaultValue) -{ +inline +T PropertyGet(const PropertyTable& in, const std::string& name, const T& defaultValue) { const Property* const prop = in.Get(name); - if(!prop) { + if( nullptr == prop) { return defaultValue; } // strong typing, no need to be lenient const TypedProperty* const tprop = prop->As< TypedProperty >(); - if(!tprop) { + if( nullptr == tprop) { return defaultValue; } return tprop->Value(); } - // ------------------------------------------------------------------------------------------------ template -inline T PropertyGet(const PropertyTable& in, const std::string& name, - bool& result) -{ +inline +T PropertyGet(const PropertyTable& in, const std::string& name, bool& result) { const Property* const prop = in.Get(name); - if(!prop) { + if( nullptr == prop) { result = false; return T(); } // strong typing, no need to be lenient const TypedProperty* const tprop = prop->As< TypedProperty >(); - if(!tprop) { + if( nullptr == tprop) { result = false; return T(); } @@ -178,7 +172,6 @@ inline T PropertyGet(const PropertyTable& in, const std::string& name, return tprop->Value(); } - } //! FBX } //! Assimp diff --git a/code/FBXTokenizer.h b/code/FBXTokenizer.h index f8af0ca..e00ff5b 100644 --- a/code/FBXTokenizer.h +++ b/code/FBXTokenizer.h @@ -101,7 +101,6 @@ public: return std::string(begin(),end()); } -public: bool IsBinary() const { return column == BINARY_MARKER; } diff --git a/code/HMPLoader.cpp b/code/HMPLoader.cpp index a6a0262..2a66920 100644 --- a/code/HMPLoader.cpp +++ b/code/HMPLoader.cpp @@ -448,7 +448,8 @@ void HMPImporter::CreateOutputFaceList(unsigned int width,unsigned int height) void HMPImporter::ReadFirstSkin(unsigned int iNumSkins, const unsigned char* szCursor, const unsigned char** szCursorOut) { - ai_assert(0 != iNumSkins && NULL != szCursor); + ai_assert( 0 != iNumSkins ); + ai_assert( nullptr != szCursor); // read the type of the skin ... // sometimes we need to skip 12 bytes here, I don't know why ... diff --git a/code/IFCBoolean.cpp b/code/IFCBoolean.cpp index 98b2303..8571a3c 100644 --- a/code/IFCBoolean.cpp +++ b/code/IFCBoolean.cpp @@ -381,7 +381,6 @@ bool PointInPoly(const IfcVector3& p, const std::vector& boundary) IntersectsBoundaryProfile(p, p + IfcVector3(0.6, -0.6, 0.0), boundary, true, intersected_boundary, true); votes += intersected_boundary.size() % 2; -// ai_assert(votes == 3 || votes == 0); return votes > 1; } diff --git a/code/IFCCurve.cpp b/code/IFCCurve.cpp index ede1c87..176fe3c 100644 --- a/code/IFCCurve.cpp +++ b/code/IFCCurve.cpp @@ -548,8 +548,6 @@ bool Curve :: InRange(IfcFloat u) const const ParamRange range = GetParametricRange(); if (IsClosed()) { return true; - //ai_assert(range.first != std::numeric_limits::infinity() && range.second != std::numeric_limits::infinity()); - //u = range.first + std::fmod(u-range.first,range.second-range.first); } const IfcFloat epsilon = 1e-5; return u - range.first > -epsilon && range.second - u > -epsilon; diff --git a/code/IFCOpenings.cpp b/code/IFCOpenings.cpp index f40b49f..45e0d1b 100644 --- a/code/IFCOpenings.cpp +++ b/code/IFCOpenings.cpp @@ -1492,7 +1492,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector& openings,const std: vmax -= vmin; // If this happens then the projection must have been wrong. - assert(vmax.Length()); + ai_assert(vmax.Length()); ClipperLib::ExPolygons clipped; ClipperLib::Polygons holes_union; @@ -1616,7 +1616,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector& openings,const std: std::vector tmpvec; for(ClipperLib::Polygon& opening : holes_union) { - assert(ClipperLib::Orientation(opening)); + ai_assert(ClipperLib::Orientation(opening)); tmpvec.clear(); @@ -1705,7 +1705,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector& openings,const std: static_cast( tri->GetPoint(i)->y ) ); - assert(v.x <= 1.0 && v.x >= 0.0 && v.y <= 1.0 && v.y >= 0.0); + ai_assert(v.x <= 1.0 && v.x >= 0.0 && v.y <= 1.0 && v.y >= 0.0); const IfcVector3 v3 = minv * IfcVector3(vmin.x + v.x * vmax.x, vmin.y + v.y * vmax.y,coord) ; curmesh.verts.push_back(v3); diff --git a/code/MDLLoader.cpp b/code/MDLLoader.cpp index ad63dd4..2025d79 100644 --- a/code/MDLLoader.cpp +++ b/code/MDLLoader.cpp @@ -1132,7 +1132,9 @@ bool MDLImporter::ProcessFrames_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInf const unsigned char* szCurrent, const unsigned char** szCurrentOut) { - ai_assert(NULL != szCurrent && NULL != szCurrentOut); + ai_assert( nullptr != szCurrent ); + ai_assert( nullptr != szCurrentOut); + const MDL::Header_MDL7 *pcHeader = (const MDL::Header_MDL7*)mBuffer; // if we have no bones we can simply skip all frames, diff --git a/code/SMDLoader.cpp b/code/SMDLoader.cpp index 1e9f86b..4502e8d 100644 --- a/code/SMDLoader.cpp +++ b/code/SMDLoader.cpp @@ -450,7 +450,9 @@ void SMDImporter::CreateOutputMeshes() // add bone child nodes void SMDImporter::AddBoneChildren(aiNode* pcNode, uint32_t iParent) { - ai_assert(NULL != pcNode && 0 == pcNode->mNumChildren && NULL == pcNode->mChildren); + ai_assert( NULL != pcNode ); + ai_assert( 0 == pcNode->mNumChildren ); + ai_assert( NULL == pcNode->mChildren); // first count ... for (unsigned int i = 0; i < asBones.size();++i) diff --git a/code/XFileExporter.h b/code/XFileExporter.h index 8d34782..e45fd79 100644 --- a/code/XFileExporter.h +++ b/code/XFileExporter.h @@ -93,7 +93,10 @@ protected: void PushTag() { startstr.append( " "); } /// Leaves an element, decreasing the indentation - void PopTag() { ai_assert( startstr.length() > 1); startstr.erase( startstr.length() - 2); } + void PopTag() { + ai_assert( startstr.length() > 1); + startstr.erase( startstr.length() - 2); + } public: /// Stringstream to write all output into diff --git a/tools/assimp_qt_viewer/glview.cpp b/tools/assimp_qt_viewer/glview.cpp index 1de8199..caf4ef3 100644 --- a/tools/assimp_qt_viewer/glview.cpp +++ b/tools/assimp_qt_viewer/glview.cpp @@ -142,8 +142,8 @@ void CGLView::Material_Apply(const aiMaterial* pMaterial) void CGLView::Matrix_NodeToRoot(const aiNode* pNode, aiMatrix4x4& pOutMatrix) { -const aiNode* node_cur; -std::list mat_list; + const aiNode* node_cur; + std::list mat_list; pOutMatrix = aiMatrix4x4(); // starting walk from current element to root