Fix pointer truncation on 64-bit

Use size_t instead of int for arithmetic on pointers, to avoid

truncation on ILP64 architectures (like amd64).
This commit is contained in:
Steven Chamberlain 2016-04-05 03:09:51 +01:00 committed by Ryan C. Gordon
parent 26f1a33749
commit 3adda272b7

View File

@ -147,7 +147,7 @@ void CSoundObject::Set3DParameters( FLOAT fFalloff, FLOAT fHotSpot,
//CPrintF("SET3D: ");
CEntity *pen = so_penEntity->GetPredictionTail();
if (pen!=so_penEntity) {
pso = (CSoundObject *)( ((UBYTE*)pen) + (int(this)-int(so_penEntity)) );
pso = (CSoundObject *)( ((UBYTE*)pen) + (size_t(this)-size_t(so_penEntity)) );
}
}
}
@ -175,7 +175,7 @@ CSoundObject *CSoundObject::GetPredictionTail(ULONG ulTypeID, ULONG ulEventID)
// it must not play the sound
return NULL;
}
SLONG slOffset = int(this)-int(so_penEntity);
SLONG slOffset = size_t(this)-size_t(so_penEntity);
ULONG ulCRC;
CRC_Start(ulCRC);