Browse Source

arm64 : fix clang compile errors

pull/71/head
hymei 3 years ago committed by nillerusr
parent
commit
f96a163cf8
  1. 2
      datamodel/dmserializerkeyvalues.cpp
  2. 2
      dmxloader/dmxattribute.cpp
  3. 2
      game/client/cstrike/VGUI/buypreset_panel.cpp
  4. 3
      game/server/props.cpp
  5. 4
      game/shared/cstrike/cs_weapon_parse.cpp
  6. 9
      public/dt_common.h
  7. 19
      public/tier0/basetypes.h

2
datamodel/dmserializerkeyvalues.cpp

@ -264,7 +264,7 @@ DmAttributeType_t CDmSerializerKeyValues::DetermineAttributeType( KeyValues *pKe
if ( sscanf( pKeyValues->GetString(), "%f %f", &f1, &f2 ) == 2 ) if ( sscanf( pKeyValues->GetString(), "%f %f", &f1, &f2 ) == 2 )
return AT_VECTOR2; return AT_VECTOR2;
int i = pKeyValues->GetInt( NULL, INT_MAX ); int i = pKeyValues->GetInt( nullptr, INT_MAX );
if ( ( sscanf( pKeyValues->GetString(), "%d", &i ) == 1 ) && if ( ( sscanf( pKeyValues->GetString(), "%d", &i ) == 1 ) &&
( !strchr( pKeyValues->GetString(), '.' ) ) ) ( !strchr( pKeyValues->GetString(), '.' ) ) )
return AT_INT; return AT_INT;

2
dmxloader/dmxattribute.cpp

@ -73,8 +73,10 @@ struct CSizeTest
COMPILE_TIME_ASSERT( sizeof( QAngle ) == 12 ); COMPILE_TIME_ASSERT( sizeof( QAngle ) == 12 );
COMPILE_TIME_ASSERT( sizeof( Quaternion ) == 16 ); COMPILE_TIME_ASSERT( sizeof( Quaternion ) == 16 );
COMPILE_TIME_ASSERT( sizeof( VMatrix ) == 64 ); COMPILE_TIME_ASSERT( sizeof( VMatrix ) == 64 );
#if !defined( PLATFORM_64BITS )
COMPILE_TIME_ASSERT( sizeof( CUtlString ) == 4 ); COMPILE_TIME_ASSERT( sizeof( CUtlString ) == 4 );
COMPILE_TIME_ASSERT( sizeof( CUtlBinaryBlock ) == 16 ); COMPILE_TIME_ASSERT( sizeof( CUtlBinaryBlock ) == 16 );
#endif
COMPILE_TIME_ASSERT( sizeof( DmObjectId_t ) == 16 ); COMPILE_TIME_ASSERT( sizeof( DmObjectId_t ) == 16 );
}; };
}; };

2
game/client/cstrike/VGUI/buypreset_panel.cpp

@ -93,7 +93,7 @@ public:
KeyValues *line = lines->GetFirstValue(); KeyValues *line = lines->GetFirstValue();
while ( line ) while ( line )
{ {
const char *str = line->GetString( NULL, "" ); const char *str = line->GetString( nullptr, "" );
Vector4D p; Vector4D p;
int numPoints = sscanf( str, "%f %f %f %f", &p[0], &p[1], &p[2], &p[3] ); int numPoints = sscanf( str, "%f %f %f %f", &p[0], &p[1], &p[2], &p[3] );
if ( numPoints == 4 ) if ( numPoints == 4 )

3
game/server/props.cpp

@ -5618,7 +5618,8 @@ class CPhysicsPropMultiplayer : public CPhysicsProp, public IMultiplayerPhysics
SetCollisionGroup( COLLISION_GROUP_DEBRIS ); SetCollisionGroup( COLLISION_GROUP_DEBRIS );
} }
m_fMass = VPhysicsGetObject()->GetMass(); if(VPhysicsGetObject())
m_fMass = VPhysicsGetObject()->GetMass();
// VPhysicsGetObject() is NULL on the client, which prevents the client from finding a decent // VPhysicsGetObject() is NULL on the client, which prevents the client from finding a decent
// AABB surrounding the collision bounds. If we've got a VPhysicsGetObject()->GetCollide(), we'll // AABB surrounding the collision bounds. If we've got a VPhysicsGetObject()->GetCollide(), we'll

4
game/shared/cstrike/cs_weapon_parse.cpp

@ -99,7 +99,9 @@ CCSWeaponInfo g_EquipmentInfo[MAX_EQUIPMENT];
void PrepareEquipmentInfo( void ) void PrepareEquipmentInfo( void )
{ {
memset( g_EquipmentInfo, 0, ARRAYSIZE( g_EquipmentInfo ) ); // MoeMod : dont use memset here
for(int i = 0; i < MAX_EQUIPMENT; ++i)
g_EquipmentInfo[i] = {};
g_EquipmentInfo[2].SetWeaponPrice( CSGameRules()->GetBlackMarketPriceForWeapon( WEAPON_KEVLAR ) ); g_EquipmentInfo[2].SetWeaponPrice( CSGameRules()->GetBlackMarketPriceForWeapon( WEAPON_KEVLAR ) );
g_EquipmentInfo[2].SetDefaultPrice( KEVLAR_PRICE ); g_EquipmentInfo[2].SetDefaultPrice( KEVLAR_PRICE );

9
public/dt_common.h

@ -91,11 +91,12 @@
// Use this to extern send and receive datatables, and reference them. // Use this to extern send and receive datatables, and reference them.
#define EXTERN_SEND_TABLE(tableName) namespace tableName {extern SendTable g_SendTable;} #define EXTERN_SEND_TABLE(tableName) namespace tableName {extern SendTable g_SendTable; extern int g_SendTableInit;}
#define EXTERN_RECV_TABLE(tableName) namespace tableName {extern RecvTable g_RecvTable;} #define EXTERN_RECV_TABLE(tableName) namespace tableName {extern RecvTable g_RecvTable; extern int g_RecvTableInit;}
#define REFERENCE_SEND_TABLE(tableName) tableName::g_SendTable // MoeMod: ODR Use it to prevent being dropped by linker
#define REFERENCE_RECV_TABLE(tableName) tableName::g_RecvTable #define REFERENCE_SEND_TABLE(tableName) (tableName::g_SendTableInit + &tableName::g_SendTableInit, tableName::g_SendTable)
#define REFERENCE_RECV_TABLE(tableName) (tableName::g_RecvTableInit + &tableName::g_RecvTableInit, tableName::g_RecvTable)
class SendProp; class SendProp;

19
public/tier0/basetypes.h

@ -171,17 +171,24 @@ typedef float vec_t;
// This assumes the ANSI/IEEE 754-1985 standard // This assumes the ANSI/IEEE 754-1985 standard
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
inline unsigned long& FloatBits( vec_t& f ) // MoeMod : fix reinterpret_cast UB - Maybe fail with strict alias
union FloatCast_u
{ {
return *reinterpret_cast<unsigned long*>(&f); vec_t f;
unsigned int i;
};
inline unsigned int& FloatBits( vec_t& f )
{
return reinterpret_cast<FloatCast_u *>(&f)->i;
} }
inline unsigned long const& FloatBits( vec_t const& f ) inline unsigned int const& FloatBits( vec_t const& f )
{ {
return *reinterpret_cast<unsigned long const*>(&f); return reinterpret_cast<FloatCast_u const*>(&f)->i;
} }
inline vec_t BitsToFloat( unsigned long i ) inline vec_t BitsToFloat( unsigned int i )
{ {
vec_t f; vec_t f;
memcpy( &f, &i, sizeof(f)); memcpy( &f, &i, sizeof(f));
@ -193,7 +200,7 @@ inline bool IsFinite( vec_t f )
return ((FloatBits(f) & 0x7F800000) != 0x7F800000); return ((FloatBits(f) & 0x7F800000) != 0x7F800000);
} }
inline unsigned long FloatAbsBits( vec_t f ) inline unsigned int FloatAbsBits( vec_t f )
{ {
return FloatBits(f) & 0x7FFFFFFF; return FloatBits(f) & 0x7FFFFFFF;
} }

Loading…
Cancel
Save