assert: remove assert with more than one statement and use only ai_assert.

pull/1385/head
Kim Kulling 2017-08-14 22:20:26 +02:00
parent 974eb669c8
commit dab0985994
13 changed files with 30 additions and 31 deletions

View 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 {

View 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);

View 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 ] ];

View 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

View File

@ -101,7 +101,6 @@ public:
return std::string(begin(),end());
}
public:
bool IsBinary() const {
return column == BINARY_MARKER;
}

View 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 ...

View 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;
}

View 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;

View 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);

View 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,

View 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)

View 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