Index: dep/include/g3dlite/G3D/g3dmath.h =================================================================== --- dep/include/g3dlite/G3D/g3dmath.h (revision 4772) +++ dep/include/g3dlite/G3D/g3dmath.h (working copy) @@ -153,20 +153,26 @@ @deprecated Use G3D::twoPi() instead. */ #define G3D_TWO_PI (6.283185) +#ifdef G3D_WIN32 typedef signed char int8; typedef unsigned char uint8; typedef short int16; typedef unsigned short uint16; typedef int int32; typedef unsigned int uint32; - -#ifdef _MSC_EXTENSIONS - typedef __int64 int64; - typedef unsigned __int64 uint64; +typedef __int64 int64; +typedef unsigned __int64 uint64; #else - typedef long long int64; - typedef unsigned long long uint64; +typedef __int64_t int64; +typedef __int32_t int32; +typedef __int16_t int16; +typedef __int8_t int8; +typedef __uint64_t uint64; +typedef __uint32_t uint32; +typedef __uint16_t uint16; +typedef __uint8_t uint8; #endif + typedef unsigned int uint; typedef float float32; Index: dep/include/g3dlite/G3D/Vector3.h =================================================================== --- dep/include/g3dlite/G3D/Vector3.h (revision 4772) +++ dep/include/g3dlite/G3D/Vector3.h (working copy) @@ -47,6 +47,13 @@ Do not subclass-- this implementation makes assumptions about the memory layout. */ +// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some paltform +#if defined( __GNUC__ ) +#pragma pack(1) +#else +#pragma pack(push,1) +#endif + class Vector3 { private: /** @@ -481,6 +488,13 @@ static Vector3 dummy; }; +// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some paltform +#if defined( __GNUC__ ) +#pragma pack() +#else +#pragma pack(pop) +#endif + inline G3D::Vector3 operator*(float s, const G3D::Vector3& v) { return v * s; } Index: src/shared/vmap/ShortBox.h =================================================================== --- src/shared/vmap/ShortBox.h (revision 4772) +++ src/shared/vmap/ShortBox.h (working copy) @@ -31,6 +31,13 @@ namespace VMAP { +// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some paltform +#if defined( __GNUC__ ) +#pragma pack(1) +#else +#pragma pack(push,1) +#endif + class ShortBox { private: @@ -110,5 +117,12 @@ } }; +// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some paltform +#if defined( __GNUC__ ) +#pragma pack() +#else +#pragma pack(pop) +#endif + } #endif Index: src/shared/vmap/ShortVector.h =================================================================== --- src/shared/vmap/ShortVector.h (revision 4772) +++ src/shared/vmap/ShortVector.h (working copy) @@ -28,12 +28,19 @@ Vector with 16 bit fix point values 12.4 bit. */ +// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some paltform +#if defined( __GNUC__ ) +#pragma pack(1) +#else +#pragma pack(push,1) +#endif + class ShortVector { private: - short iX; - short iY; - short iZ; + uint16 iX; + uint16 iY; + uint16 iZ; const static short maxvalue = 0x7fff; const static short minvalue = -0x7fff; @@ -131,5 +138,14 @@ } }; + +// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some paltform +#if defined( __GNUC__ ) +#pragma pack() +#else +#pragma pack(pop) +#endif + } + #endif Index: src/shared/vmap/SubModel.cpp =================================================================== --- src/shared/vmap/SubModel.cpp (revision 4772) +++ src/shared/vmap/SubModel.cpp (working copy) @@ -96,16 +96,18 @@ BP_iBox=38, }; /** - This is ugly, but due to compatibility and 64 bit support we have to do that ... sorry + This is ugly, but due to compatibility and 64 bit support we have to do that ... */ void SubModel::initFromBinBlock(void *pBinBlock) { - iNTriangles = *((unsigned int *)(((char *) pBinBlock) + BP_iNTriangles)); - iNNodes = *((unsigned int *) (((char *) pBinBlock) + BP_iNNodes)); + iNTriangles = *((uint32*)(((char *) pBinBlock) + BP_iNTriangles)); + iNNodes = *((uint32*) (((char *) pBinBlock) + BP_iNNodes)); iBasePosition = *((Vector3 *) (((char *) pBinBlock) + BP_iBasePosition)); - iNodesPos = *((unsigned int *) (((char *) pBinBlock) + BP_iNodesPos)); - iTrianglesPos = *((unsigned int *) (((char *) pBinBlock) + BP_iTrianglesPos)); - iHasInternalMemAlloc = *((bool *) (((char *) pBinBlock) + BP_iHasInternalMemAlloc)); + iNodesPos = *((uint32*) (((char *) pBinBlock) + BP_iNodesPos)); + iTrianglesPos = *((uint32*) (((char *) pBinBlock) + BP_iTrianglesPos)); + + // bool is platform dependent and at 64-bit platform sizeof(bool)==8, for ready must be used fixed size type + iHasInternalMemAlloc = (*((uint32 *) (((char *) pBinBlock) + BP_iHasInternalMemAlloc)))!=0; iBox = *((ShortBox *) (((char *) pBinBlock) + BP_iBox)); }