assert: remove assert with more than one statement and use only ai_assert.
authorKim Kulling <kim.kulling@googlemail.com>
Mon, 14 Aug 2017 20:20:26 +0000 (22:20 +0200)
committerKim Kulling <kim.kulling@googlemail.com>
Mon, 14 Aug 2017 20:20:26 +0000 (22:20 +0200)
13 files changed:
code/ColladaExporter.h
code/D3MFOpcPackage.cpp
code/FBXMeshGeometry.cpp
code/FBXProperties.h
code/FBXTokenizer.h
code/HMPLoader.cpp
code/IFCBoolean.cpp
code/IFCCurve.cpp
code/IFCOpenings.cpp
code/MDLLoader.cpp
code/SMDLoader.cpp
code/XFileExporter.h
tools/assimp_qt_viewer/glview.cpp

index 36c012f..c782727 100644 (file)
@@ -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 {
index ff6fddc..b6b1ba1 100644 (file)
@@ -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);
 
index 3a57cfd..8d43a24 100644 (file)
@@ -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 ] ];
index a89a858..91b7c81 100644 (file)
@@ -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<typename T>
 class TypedProperty : public Property
 {
@@ -138,38 +135,35 @@ private:
 
 // ------------------------------------------------------------------------------------------------
 template <typename T>
-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<T>* const tprop = prop->As< TypedProperty<T> >();
-    if(!tprop) {
+    if( nullptr == tprop) {
         return defaultValue;
     }
 
     return tprop->Value();
 }
 
-
 // ------------------------------------------------------------------------------------------------
 template <typename T>
-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<T>* const tprop = prop->As< TypedProperty<T> >();
-    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
 
index f8af0ca..e00ff5b 100644 (file)
@@ -101,7 +101,6 @@ public:
         return std::string(begin(),end());
     }
 
-public:
     bool IsBinary() const {
         return column == BINARY_MARKER;
     }
index a6a0262..2a66920 100644 (file)
@@ -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 ...
index 98b2303..8571a3c 100644 (file)
@@ -381,7 +381,6 @@ bool PointInPoly(const IfcVector3& p, const std::vector<IfcVector3>& 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;
 }
 
index ede1c87..176fe3c 100644 (file)
@@ -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<IfcFloat>::infinity() && range.second != std::numeric_limits<IfcFloat>::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;
index f40b49f..45e0d1b 100644 (file)
@@ -1492,7 +1492,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& 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<TempOpening>& openings,const std:
         std::vector<IfcVector3> 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<TempOpening>& openings,const std:
                     static_cast<IfcFloat>( 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);
index ad63dd4..2025d79 100644 (file)
@@ -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,
index 1e9f86b..4502e8d 100644 (file)
@@ -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)
index 8d34782..e45fd79 100644 (file)
@@ -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
index 1de8199..caf4ef3 100644 (file)
@@ -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<aiMatrix4x4> mat_list;
+    const aiNode* node_cur;
+    std::list<aiMatrix4x4> mat_list;
 
        pOutMatrix = aiMatrix4x4();
        // starting walk from current element to root