Skip to content

Commit

Permalink
Closes #940: use standard offsetof
Browse files Browse the repository at this point in the history
instead of an own version.
  • Loading branch information
kimkulling committed Jul 8, 2016
1 parent 7c63208 commit 070fb33
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
8 changes: 5 additions & 3 deletions code/BlenderTessellator.cpp
Expand Up @@ -50,6 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderBMesh.h"
#include "BlenderTessellator.h"

#include <stddef.h>

static const unsigned int BLEND_TESS_MAGIC = 0x83ed9ac3;

#if ASSIMP_BLEND_WITH_GLU_TESSELLATE
Expand Down Expand Up @@ -373,13 +375,13 @@ void BlenderTessellatorP2T::ReferencePoints( std::vector< Blender::PointP2T >& p

// ------------------------------------------------------------------------------------------------
// Yes this is filthy... but we have no choice
#define OffsetOf( Class, Member ) ( static_cast< unsigned int >( \
/*#define OffsetOf( Class, Member ) ( static_cast< unsigned int >( \
reinterpret_cast<uint8_t*>(&( reinterpret_cast< Class* >( NULL )->*( &Class::Member ) )) - \
static_cast<uint8_t*>(NULL) ) )

*/
inline PointP2T& BlenderTessellatorP2T::GetActualPointStructure( p2t::Point& point ) const
{
unsigned int pointOffset = OffsetOf( PointP2T, point2D );
unsigned int pointOffset = offsetof( PointP2T, point2D );
PointP2T& pointStruct = *reinterpret_cast< PointP2T* >( reinterpret_cast< char* >( &point ) - pointOffset );
if ( pointStruct.magic != static_cast<int>( BLEND_TESS_MAGIC ) )
{
Expand Down
Binary file modified test/regression/db.zip
Binary file not shown.
3 changes: 0 additions & 3 deletions test/unit/utLimitBoneWeights.cpp
Expand Up @@ -43,18 +43,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h>
#include <LimitBoneWeightsProcess.h>


using namespace std;
using namespace Assimp;

class LimitBoneWeightsTest : public ::testing::Test {
public:

virtual void SetUp();
virtual void TearDown();

protected:

LimitBoneWeightsProcess* piProcess;
aiMesh* pcMesh;
};
Expand Down
7 changes: 2 additions & 5 deletions test/unit/utMaterialSystem.cpp
Expand Up @@ -43,19 +43,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h>
#include <MaterialSystem.h>


using namespace std;
using namespace Assimp;
using namespace ::std;
using namespace ::Assimp;

class MaterialSystemTest : public ::testing::Test
{
public:

virtual void SetUp() { this->pcMat = new aiMaterial(); }
virtual void TearDown() { delete this->pcMat; }

protected:

aiMaterial* pcMat;
};

Expand Down
2 changes: 1 addition & 1 deletion test/unit/utMatrix3x3.cpp
Expand Up @@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "UnitTestPCH.h"
#include <iostream>

using namespace Assimp;
using namespace ::Assimp;

class utMatrix3x3Test : public ::testing::Test {

Expand Down

0 comments on commit 070fb33

Please sign in to comment.