Fixed printf format compatabilty
This commit is contained in:
parent
3caa4a38b9
commit
a584b7b3bc
@ -31,14 +31,14 @@ public:
|
|||||||
Gen.PlacePieces(500, 50, 500, 3, OutPieces);
|
Gen.PlacePieces(500, 50, 500, 3, OutPieces);
|
||||||
|
|
||||||
// Print out the pieces:
|
// Print out the pieces:
|
||||||
printf("OutPieces.size() = %zu\n", OutPieces.size());
|
printf("OutPieces.size() = " SIZE_T_FMT "\n", OutPieces.size());
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
for (cPlacedPieces::const_iterator itr = OutPieces.begin(), end = OutPieces.end(); itr != end; ++itr, ++idx)
|
for (cPlacedPieces::const_iterator itr = OutPieces.begin(), end = OutPieces.end(); itr != end; ++itr, ++idx)
|
||||||
{
|
{
|
||||||
const Vector3i & Coords = (*itr)->GetCoords();
|
const Vector3i & Coords = (*itr)->GetCoords();
|
||||||
cCuboid Hitbox = (*itr)->GetHitBox();
|
cCuboid Hitbox = (*itr)->GetHitBox();
|
||||||
Hitbox.Sort();
|
Hitbox.Sort();
|
||||||
printf("%zu: {%d, %d, %d}, rot %d, hitbox {%d, %d, %d} - {%d, %d, %d} (%d * %d * %d)\n", idx,
|
printf(SIZE_T_FMT ": {%d, %d, %d}, rot %d, hitbox {%d, %d, %d} - {%d, %d, %d} (%d * %d * %d)\n", idx,
|
||||||
Coords.x, Coords.y, Coords.z,
|
Coords.x, Coords.y, Coords.z,
|
||||||
(*itr)->GetNumCCWRotations(),
|
(*itr)->GetNumCCWRotations(),
|
||||||
Hitbox.p1.x, Hitbox.p1.y, Hitbox.p1.z,
|
Hitbox.p1.x, Hitbox.p1.y, Hitbox.p1.z,
|
||||||
@ -502,12 +502,11 @@ bool cPieceGenerator::CheckConnection(
|
|||||||
// DEBUG:
|
// DEBUG:
|
||||||
void cPieceGenerator::DebugConnectorPool(const cPieceGenerator::cFreeConnectors & a_ConnectorPool, size_t a_NumProcessed)
|
void cPieceGenerator::DebugConnectorPool(const cPieceGenerator::cFreeConnectors & a_ConnectorPool, size_t a_NumProcessed)
|
||||||
{
|
{
|
||||||
printf(" Connector pool: %zu items\n", a_ConnectorPool.size() - a_NumProcessed);
|
printf(" Connector pool: " SIZE_T_FMT " items\n", a_ConnectorPool.size() - a_NumProcessed);
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
for (cPieceGenerator::cFreeConnectors::const_iterator itr = a_ConnectorPool.begin() + a_NumProcessed, end = a_ConnectorPool.end(); itr != end; ++itr, ++idx)
|
for (cPieceGenerator::cFreeConnectors::const_iterator itr = a_ConnectorPool.begin() + a_NumProcessed, end = a_ConnectorPool.end(); itr != end; ++itr, ++idx)
|
||||||
{
|
{
|
||||||
// Format specifier for size_t is zu
|
printf(" " SIZE_T_FMT ": {%d, %d, %d}, type %d, direction %s, depth %d\n",
|
||||||
printf(" %zu: {%d, %d, %d}, type %d, direction %s, depth %d\n",
|
|
||||||
idx,
|
idx,
|
||||||
itr->m_Connector.m_Pos.x, itr->m_Connector.m_Pos.y, itr->m_Connector.m_Pos.z,
|
itr->m_Connector.m_Pos.x, itr->m_Connector.m_Pos.y, itr->m_Connector.m_Pos.z,
|
||||||
itr->m_Connector.m_Type,
|
itr->m_Connector.m_Type,
|
||||||
|
@ -38,6 +38,9 @@
|
|||||||
// No alignment needed in MSVC
|
// No alignment needed in MSVC
|
||||||
#define ALIGN_8
|
#define ALIGN_8
|
||||||
#define ALIGN_16
|
#define ALIGN_16
|
||||||
|
|
||||||
|
// MSVC has its own custom version of zu format
|
||||||
|
#define SIZE_T_FMT "%Iu"
|
||||||
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
@ -56,6 +59,8 @@
|
|||||||
|
|
||||||
// Some portability macros :)
|
// Some portability macros :)
|
||||||
#define stricmp strcasecmp
|
#define stricmp strcasecmp
|
||||||
|
|
||||||
|
#define SIZE_T_FMT "%zu"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user