From d080f922414a80e0f35a313ba62d823a81415e98 Mon Sep 17 00:00:00 2001 From: acgessler Date: Fri, 22 Nov 2013 19:54:47 +0100 Subject: [PATCH] BlenderTesselator: Fix OffsetOf() macro --- code/BlenderTessellator.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/BlenderTessellator.cpp b/code/BlenderTessellator.cpp index e2d51cf25..150183519 100644 --- a/code/BlenderTessellator.cpp +++ b/code/BlenderTessellator.cpp @@ -374,10 +374,13 @@ void BlenderTessellatorP2T::ReferencePoints( std::vector< Blender::PointP2T >& p // ------------------------------------------------------------------------------------------------ // Yes this is filthy... but we have no choice -#define OffsetOf( Class, Member ) ( reinterpret_cast< unsigned int >( &( reinterpret_cast< Class* >( NULL )->*( &Class::Member ) ) ) ) +#define OffsetOf( Class, Member ) ( static_cast< unsigned int >( \ + reinterpret_cast(&( reinterpret_cast< Class* >( NULL )->*( &Class::Member ) )) - \ + static_cast(NULL) ) ) + inline PointP2T& BlenderTessellatorP2T::GetActualPointStructure( p2t::Point& point ) const { - int pointOffset = OffsetOf( PointP2T, point2D ); + unsigned int pointOffset = OffsetOf( PointP2T, point2D ); PointP2T& pointStruct = *reinterpret_cast< PointP2T* >( reinterpret_cast< char* >( &point ) - pointOffset ); if ( pointStruct.magic != BLEND_TESS_MAGIC ) {