Removed usage of Boost static assert.

pull/832/head
Sherief Farouk 2016-03-18 17:02:39 -07:00
parent 76e4e82ecb
commit 397fa374a3
8 changed files with 20 additions and 27 deletions

View File

@ -47,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/assimp/Exporter.hpp" #include "../include/assimp/Exporter.hpp"
#include "ProcessHelper.h" #include "ProcessHelper.h"
#include "Exceptional.h" #include "Exceptional.h"
#include <boost/static_assert.hpp>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB #ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h> # include <zlib.h>
@ -103,7 +102,7 @@ inline size_t Write<unsigned int>(IOStream * stream, const unsigned int& w)
template <> template <>
inline size_t Write<uint16_t>(IOStream * stream, const uint16_t& w) inline size_t Write<uint16_t>(IOStream * stream, const uint16_t& w)
{ {
BOOST_STATIC_ASSERT(sizeof(uint16_t)==2); static_assert(sizeof(uint16_t)==2, "sizeof(uint16_t)==2");
stream->Write(&w,2,1); stream->Write(&w,2,1);
return 2; return 2;
} }
@ -113,7 +112,7 @@ inline size_t Write<uint16_t>(IOStream * stream, const uint16_t& w)
template <> template <>
inline size_t Write<float>(IOStream * stream, const float& f) inline size_t Write<float>(IOStream * stream, const float& f)
{ {
BOOST_STATIC_ASSERT(sizeof(float)==4); static_assert(sizeof(float)==4, "sizeof(float)==4");
stream->Write(&f,4,1); stream->Write(&f,4,1);
return 4; return 4;
} }
@ -123,7 +122,7 @@ inline size_t Write<float>(IOStream * stream, const float& f)
template <> template <>
inline size_t Write<double>(IOStream * stream, const double& f) inline size_t Write<double>(IOStream * stream, const double& f)
{ {
BOOST_STATIC_ASSERT(sizeof(double)==8); static_assert(sizeof(double)==8, "sizeof(double)==8");
stream->Write(&f,8,1); stream->Write(&f,8,1);
return 8; return 8;
} }
@ -472,7 +471,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
uint32_t tmp = f.mNumIndices; uint32_t tmp = f.mNumIndices;
hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash); hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash);
for (unsigned int i = 0; i < f.mNumIndices; ++i) { for (unsigned int i = 0; i < f.mNumIndices; ++i) {
BOOST_STATIC_ASSERT(AI_MAX_VERTICES <= 0xffffffff); static_assert(AI_MAX_VERTICES <= 0xffffffff, "AI_MAX_VERTICES <= 0xffffffff");
tmp = static_cast<uint32_t>( f.mIndices[i] ); tmp = static_cast<uint32_t>( f.mIndices[i] );
hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash); hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash);
} }
@ -486,7 +485,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
for (unsigned int i = 0; i < mesh->mNumFaces;++i) { for (unsigned int i = 0; i < mesh->mNumFaces;++i) {
const aiFace& f = mesh->mFaces[i]; const aiFace& f = mesh->mFaces[i];
BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff); static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff");
Write<uint16_t>(&chunk,f.mNumIndices); Write<uint16_t>(&chunk,f.mNumIndices);
for (unsigned int a = 0; a < f.mNumIndices;++a) { for (unsigned int a = 0; a < f.mNumIndices;++a) {

View File

@ -54,7 +54,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/assimp/mesh.h" #include "../include/assimp/mesh.h"
#include "../include/assimp/anim.h" #include "../include/assimp/anim.h"
#include "../include/assimp/scene.h" #include "../include/assimp/scene.h"
#include <boost/static_assert.hpp>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB #ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h> # include <zlib.h>
@ -351,7 +350,7 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh )
for (unsigned int i = 0; i < mesh->mNumFaces;++i) { for (unsigned int i = 0; i < mesh->mNumFaces;++i) {
aiFace& f = mesh->mFaces[i]; aiFace& f = mesh->mFaces[i];
BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff); static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff");
f.mNumIndices = Read<uint16_t>(stream); f.mNumIndices = Read<uint16_t>(stream);
f.mIndices = new unsigned int[f.mNumIndices]; f.mIndices = new unsigned int[f.mNumIndices];

View File

@ -45,7 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/assimp/ai_assert.h" #include "../include/assimp/ai_assert.h"
#include "DefaultIOStream.h" #include "DefaultIOStream.h"
#include <boost/static_assert.hpp>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -86,8 +85,9 @@ aiReturn DefaultIOStream::Seek(size_t pOffset,
} }
// Just to check whether our enum maps one to one with the CRT constants // Just to check whether our enum maps one to one with the CRT constants
BOOST_STATIC_ASSERT(aiOrigin_CUR == SEEK_CUR && static_assert(aiOrigin_CUR == SEEK_CUR &&
aiOrigin_END == SEEK_END && aiOrigin_SET == SEEK_SET); aiOrigin_END == SEEK_END && aiOrigin_SET == SEEK_SET, "aiOrigin_CUR == SEEK_CUR && \
aiOrigin_END == SEEK_END && aiOrigin_SET == SEEK_SET");
// do the seek // do the seek
return (0 == ::fseek(mFile, (long)pOffset,(int)pOrigin) ? AI_SUCCESS : AI_FAILURE); return (0 == ::fseek(mFile, (long)pOffset,(int)pOrigin) ? AI_SUCCESS : AI_FAILURE);

View File

@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Vertex.h" #include "Vertex.h"
#include "TinyFormatter.h" #include "TinyFormatter.h"
#include <stdio.h> #include <stdio.h>
#include <boost/static_assert.hpp>
using namespace Assimp; using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -117,8 +116,8 @@ void JoinVerticesProcess::Execute( aiScene* pScene)
// Unites identical vertices in the given mesh // Unites identical vertices in the given mesh
int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
{ {
BOOST_STATIC_ASSERT( AI_MAX_NUMBER_OF_COLOR_SETS == 8); static_assert( AI_MAX_NUMBER_OF_COLOR_SETS == 8, "AI_MAX_NUMBER_OF_COLOR_SETS == 8");
BOOST_STATIC_ASSERT( AI_MAX_NUMBER_OF_TEXTURECOORDS == 8); static_assert( AI_MAX_NUMBER_OF_TEXTURECOORDS == 8, "AI_MAX_NUMBER_OF_TEXTURECOORDS == 8");
// Return early if we don't have any positions // Return early if we don't have any positions
if (!pMesh->HasPositions() || !pMesh->HasFaces()) { if (!pMesh->HasPositions() || !pMesh->HasFaces()) {
@ -134,7 +133,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
// whether a new vertex was created for the index (true) or if it was replaced by an existing // whether a new vertex was created for the index (true) or if it was replaced by an existing
// unique vertex (false). This saves an additional std::vector<bool> and greatly enhances // unique vertex (false). This saves an additional std::vector<bool> and greatly enhances
// branching performance. // branching performance.
BOOST_STATIC_ASSERT(AI_MAX_VERTICES == 0x7fffffff); static_assert(AI_MAX_VERTICES == 0x7fffffff, "AI_MAX_VERTICES == 0x7fffffff");
std::vector<unsigned int> replaceIndex( pMesh->mNumVertices, 0xffffffff); std::vector<unsigned int> replaceIndex( pMesh->mNumVertices, 0xffffffff);
// A little helper to find locally close vertices faster. // A little helper to find locally close vertices faster.

View File

@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers // internal headers
#include "LWOLoader.h" #include "LWOLoader.h"
#include "ByteSwapper.h" #include "ByteSwapper.h"
#include <boost/static_assert.hpp>
using namespace Assimp; using namespace Assimp;
@ -160,7 +159,7 @@ bool LWOImporter::HandleTextures(aiMaterial* pcMat, const TextureList& in, aiTex
trafo.mScaling.x = (*it).wrapAmountW; trafo.mScaling.x = (*it).wrapAmountW;
trafo.mScaling.y = (*it).wrapAmountH; trafo.mScaling.y = (*it).wrapAmountH;
BOOST_STATIC_ASSERT(sizeof(aiUVTransform)/sizeof(float) == 5); static_assert(sizeof(aiUVTransform)/sizeof(float) == 5, "sizeof(aiUVTransform)/sizeof(float) == 5");
pcMat->AddProperty(&trafo,1,AI_MATKEY_UVTRANSFORM(type,cur)); pcMat->AddProperty(&trafo,1,AI_MATKEY_UVTRANSFORM(type,cur));
} }
DefaultLogger::get()->debug("LWO2: Setting up non-UV mapping"); DefaultLogger::get()->debug("LWO2: Setting up non-UV mapping");

View File

@ -42,7 +42,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define INCLUDED_AI_STEPFILE_H #define INCLUDED_AI_STEPFILE_H
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/static_assert.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <bitset> #include <bitset>
#include <memory> #include <memory>
@ -722,7 +721,7 @@ namespace STEP {
ListOf() { ListOf() {
BOOST_STATIC_ASSERT(min_cnt <= max_cnt || !max_cnt); static_assert(min_cnt <= max_cnt || !max_cnt, "min_cnt <= max_cnt || !max_cnt");
} }
}; };

View File

@ -42,7 +42,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file Implementation of the helper class to quickly find vertices close to a given position */ /** @file Implementation of the helper class to quickly find vertices close to a given position */
#include "SpatialSort.h" #include "SpatialSort.h"
#include <boost/static_assert.hpp>
#include "../include/assimp/ai_assert.h" #include "../include/assimp/ai_assert.h"
using namespace Assimp; using namespace Assimp;
@ -192,14 +191,14 @@ namespace {
// If this assertion fails, signed int is not big enough to store a float on your platform. // If this assertion fails, signed int is not big enough to store a float on your platform.
// Please correct the declaration of BinFloat a few lines above - but do it in a portable, // Please correct the declaration of BinFloat a few lines above - but do it in a portable,
// #ifdef'd manner! // #ifdef'd manner!
BOOST_STATIC_ASSERT( sizeof(BinFloat) >= sizeof(float)); static_assert( sizeof(BinFloat) >= sizeof(float), "sizeof(BinFloat) >= sizeof(float)");
#if defined( _MSC_VER) #if defined( _MSC_VER)
// If this assertion fails, Visual C++ has finally moved to ILP64. This means that this // If this assertion fails, Visual C++ has finally moved to ILP64. This means that this
// code has just become legacy code! Find out the current value of _MSC_VER and modify // code has just become legacy code! Find out the current value of _MSC_VER and modify
// the #if above so it evaluates false on the current and all upcoming VC versions (or // the #if above so it evaluates false on the current and all upcoming VC versions (or
// on the current platform, if LP64 or LLP64 are still used on other platforms). // on the current platform, if LP64 or LLP64 are still used on other platforms).
BOOST_STATIC_ASSERT( sizeof(BinFloat) == sizeof(float)); static_assert( sizeof(BinFloat) == sizeof(float), "sizeof(BinFloat) == sizeof(float)");
// This works best on Visual C++, but other compilers have their problems with it. // This works best on Visual C++, but other compilers have their problems with it.
const BinFloat binValue = reinterpret_cast<BinFloat const &>(pValue); const BinFloat binValue = reinterpret_cast<BinFloat const &>(pValue);

View File

@ -58,7 +58,6 @@ const char* AICMD_MSG_DUMP_HELP =
; ;
#include "../../code/assbin_chunks.h" #include "../../code/assbin_chunks.h"
#include <boost/static_assert.hpp>
FILE* out = NULL; FILE* out = NULL;
bool shortened = false; bool shortened = false;
@ -151,7 +150,7 @@ inline uint32_t Write<uint16_t>(const uint16_t& w)
template <> template <>
inline uint32_t Write<float>(const float& f) inline uint32_t Write<float>(const float& f)
{ {
BOOST_STATIC_ASSERT(sizeof(float)==4); static_assert(sizeof(float)==4, "sizeof(float)==4");
fwrite(&f,4,1,out); fwrite(&f,4,1,out);
return 4; return 4;
} }
@ -161,7 +160,7 @@ inline uint32_t Write<float>(const float& f)
template <> template <>
inline uint32_t Write<double>(const double& f) inline uint32_t Write<double>(const double& f)
{ {
BOOST_STATIC_ASSERT(sizeof(double)==8); static_assert(sizeof(double)==8, "sizeof(double)==8");
fwrite(&f,8,1,out); fwrite(&f,8,1,out);
return 8; return 8;
} }
@ -424,7 +423,7 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh)
uint32_t tmp = f.mNumIndices; uint32_t tmp = f.mNumIndices;
hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash); hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash);
for (unsigned int i = 0; i < f.mNumIndices; ++i) { for (unsigned int i = 0; i < f.mNumIndices; ++i) {
BOOST_STATIC_ASSERT(AI_MAX_VERTICES <= 0xffffffff); static_assert(AI_MAX_VERTICES <= 0xffffffff, "AI_MAX_VERTICES <= 0xffffffff");
tmp = static_cast<uint32_t>( f.mIndices[i] ); tmp = static_cast<uint32_t>( f.mIndices[i] );
hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash); hash = SuperFastHash(reinterpret_cast<const char*>(&tmp),sizeof tmp,hash);
} }
@ -438,7 +437,7 @@ uint32_t WriteBinaryMesh(const aiMesh* mesh)
for (unsigned int i = 0; i < mesh->mNumFaces;++i) { for (unsigned int i = 0; i < mesh->mNumFaces;++i) {
const aiFace& f = mesh->mFaces[i]; const aiFace& f = mesh->mFaces[i];
BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff); static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff");
len += Write<uint16_t>(f.mNumIndices); len += Write<uint16_t>(f.mNumIndices);
for (unsigned int a = 0; a < f.mNumIndices;++a) { for (unsigned int a = 0; a < f.mNumIndices;++a) {