mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 14:16:50 +00:00
fix some AddressSanitizer issues
This commit is contained in:
parent
a0e05d885a
commit
29db778997
@ -624,7 +624,7 @@ void Cmd_Exec_f( const CCommand &args )
|
||||
}
|
||||
}
|
||||
|
||||
char buf[16384] = { 0 };
|
||||
static char buf[16384] = { 0 };
|
||||
int len = 0;
|
||||
char *f = (char *)COM_LoadStackFile( fileName, buf, sizeof( buf ), len );
|
||||
if ( !f )
|
||||
|
@ -543,7 +543,7 @@ struct AsyncCaptionData_t
|
||||
data->m_nBlockNum = params.blocktoload;
|
||||
data->m_nFileIndex = params.fileindex;
|
||||
data->m_nBlockSize = params.blocksize;
|
||||
data->m_pBlockData = new byte[ data->m_nBlockSize ];
|
||||
data->m_pBlockData = new byte[ data->m_nBlockSize * sizeof(ucs2) ];
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -2027,6 +2027,7 @@ public:
|
||||
if ( entry.blockNum != nBlockNum )
|
||||
continue;
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
const wchar_t *pIn = ( const wchar_t *)&pData->m_pBlockData[ entry.offset ];
|
||||
caption->stream = new wchar_t[ entry.length >> 1 ];
|
||||
@ -2034,7 +2035,7 @@ public:
|
||||
#else
|
||||
// we persist to disk as ucs2 so convert back to real unicode here
|
||||
caption->stream = new wchar_t[ entry.length ];
|
||||
V_UCS2ToUnicode( (ucs2 *)&pData->m_pBlockData[ entry.offset ], caption->stream, entry.length*sizeof(wchar_t) );
|
||||
V_UCS2ToUnicode( (ucs2 *)&pData->m_pBlockData[ entry.offset ], caption->stream, entry.length << 1 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1014,7 +1014,7 @@ bool CParticleEffectBinding::RecalculateBoundingBox()
|
||||
CEffectMaterial* CParticleEffectBinding::GetEffectMaterial( CParticleSubTexture *pSubTexture )
|
||||
{
|
||||
// Hash the IMaterial pointer.
|
||||
unsigned long index = (((unsigned long)pSubTexture->m_pGroup) >> 6) % EFFECT_MATERIAL_HASH_SIZE;
|
||||
unsigned int index = (((unsigned int)pSubTexture->m_pGroup) >> 6) % EFFECT_MATERIAL_HASH_SIZE;
|
||||
for ( CEffectMaterial *pCur=m_EffectMaterialHash[index]; pCur; pCur = pCur->m_pHashedNext )
|
||||
{
|
||||
if ( pCur->m_pGroup == pSubTexture->m_pGroup )
|
||||
|
@ -53,7 +53,7 @@ struct AI_Follower_t
|
||||
}
|
||||
|
||||
AIHANDLE hFollower;
|
||||
int slot;
|
||||
intp slot;
|
||||
AI_FollowNavInfo_t navInfo;
|
||||
AI_FollowGroup_t * pGroup; // backpointer for efficiency
|
||||
};
|
||||
@ -2561,7 +2561,7 @@ bool CAI_FollowManager::AddFollower( CBaseEntity *pTarget, CAI_BaseNPC *pFollowe
|
||||
|
||||
AI_FollowSlot_t *pSlot = &pGroup->pFormation->pSlots[slot];
|
||||
|
||||
int i = pGroup->followers.AddToTail( );
|
||||
intp i = pGroup->followers.AddToTail( );
|
||||
|
||||
AI_Follower_t *iterNode = &pGroup->followers[i];
|
||||
iterNode->hFollower = pFollower;
|
||||
@ -2569,9 +2569,8 @@ bool CAI_FollowManager::AddFollower( CBaseEntity *pTarget, CAI_BaseNPC *pFollowe
|
||||
iterNode->pGroup = pGroup;
|
||||
|
||||
pGroup->slotUsage.Set( slot );
|
||||
|
||||
CalculateFieldsFromSlot( pSlot, &iterNode->navInfo );
|
||||
|
||||
|
||||
pHandle->m_hFollower = i;
|
||||
pHandle->m_pGroup = pGroup;
|
||||
return true;
|
||||
@ -2641,10 +2640,10 @@ bool CAI_FollowManager::RedistributeSlots( AI_FollowGroup_t *pGroup )
|
||||
{
|
||||
AI_FollowSlot_t * pSlot = &pGroup->pFormation->pSlots[bestSlot];
|
||||
Vector slotPos = originFollowed + pSlot->position;
|
||||
int h = pGroup->followers.Head();
|
||||
int hBest = pGroup->followers.InvalidIndex();
|
||||
intp h = pGroup->followers.Head();
|
||||
intp hBest = pGroup->followers.InvalidIndex();
|
||||
float distSqBest = FLT_MAX;
|
||||
|
||||
|
||||
while ( h != pGroup->followers.InvalidIndex() )
|
||||
{
|
||||
AI_Follower_t *p = &pGroup->followers[h];
|
||||
@ -2691,7 +2690,7 @@ void CAI_FollowManager::ChangeFormation( AI_FollowManagerInfoHandle_t& hInfo, AI
|
||||
if ( pNewFormation == pGroup->pFormation )
|
||||
return;
|
||||
|
||||
int h = pGroup->followers.Head();
|
||||
intp h = pGroup->followers.Head();
|
||||
|
||||
while ( h != pGroup->followers.InvalidIndex() )
|
||||
{
|
||||
@ -2738,7 +2737,7 @@ void CAI_FollowManager::RemoveFollower( AI_FollowManagerInfoHandle_t& hInfo )
|
||||
AI_FollowGroup_t *pGroup = hInfo.m_pGroup;
|
||||
AI_Follower_t* iterNode = &pGroup->followers[hInfo.m_hFollower];
|
||||
|
||||
int slot = iterNode->slot;
|
||||
intp slot = iterNode->slot;
|
||||
pGroup->slotUsage.Clear( slot );
|
||||
pGroup->followers.Remove( hInfo.m_hFollower );
|
||||
if ( pGroup->followers.Count() == 0 )
|
||||
|
@ -100,7 +100,7 @@ struct AI_FollowGroup_t;
|
||||
struct AI_FollowManagerInfoHandle_t
|
||||
{
|
||||
AI_FollowGroup_t *m_pGroup;
|
||||
int m_hFollower;
|
||||
intp m_hFollower;
|
||||
};
|
||||
|
||||
//-------------------------------------
|
||||
|
@ -4015,8 +4015,8 @@ bool CNPC_Antlion::CorpseGib( const CTakeDamageInfo &info )
|
||||
}
|
||||
|
||||
Vector velocity = vec3_origin;
|
||||
AngularImpulse angVelocity = RandomAngularImpulse( -150, 150 );
|
||||
breakablepropparams_t params( EyePosition(), GetAbsAngles(), velocity, angVelocity );
|
||||
AngularImpulse angVelocity = RandomAngularImpulse( -150, 150 );
|
||||
static breakablepropparams_t params( EyePosition(), GetAbsAngles(), velocity, angVelocity );
|
||||
params.impactEnergyScale = 1.0f;
|
||||
params.defBurstScale = 150.0f;
|
||||
params.defCollisionGroup = COLLISION_GROUP_DEBRIS;
|
||||
|
@ -951,7 +951,7 @@ void PropBreakableCreateAll( int modelindex, IPhysicsObject *pPhysics, const bre
|
||||
nSkin = pOwnerAnim->m_nSkin;
|
||||
}
|
||||
}
|
||||
matrix3x4_t localToWorld;
|
||||
static matrix3x4_t localToWorld;
|
||||
|
||||
CStudioHdr studioHdr;
|
||||
const model_t *model = modelinfo->GetModel( modelindex );
|
||||
@ -1009,7 +1009,7 @@ void PropBreakableCreateAll( int modelindex, IPhysicsObject *pPhysics, const bre
|
||||
if ( ( iPrecomputedBreakableCount != -1 ) && ( i >= iPrecomputedBreakableCount ) )
|
||||
break;
|
||||
|
||||
matrix3x4_t matrix;
|
||||
static matrix3x4_t matrix;
|
||||
AngleMatrix( params.angles, params.origin, matrix );
|
||||
|
||||
CStudioHdr studioHdr;
|
||||
@ -1188,7 +1188,7 @@ void PropBreakableCreateAll( int modelindex, IPhysicsObject *pPhysics, const bre
|
||||
Vector vecBreakableObbSize = pBreakable->CollisionProp()->OBBSize();
|
||||
|
||||
// Try to align the gibs along the original axis
|
||||
matrix3x4_t matrix;
|
||||
static matrix3x4_t matrix;
|
||||
AngleMatrix( vecAngles, matrix );
|
||||
AlignBoxes( &matrix, vecObbSize, vecBreakableObbSize );
|
||||
MatrixAngles( matrix, vecAngles );
|
||||
@ -1397,7 +1397,7 @@ CBaseEntity *CreateGibsFromList( CUtlVector<breakmodel_t> &list, int modelindex,
|
||||
if ( ( iPrecomputedBreakableCount != -1 ) && ( i >= iPrecomputedBreakableCount ) )
|
||||
break;
|
||||
|
||||
matrix3x4_t matrix;
|
||||
static matrix3x4_t matrix;
|
||||
AngleMatrix( params.angles, params.origin, matrix );
|
||||
|
||||
CStudioHdr studioHdr;
|
||||
@ -1596,7 +1596,7 @@ CBaseEntity *CreateGibsFromList( CUtlVector<breakmodel_t> &list, int modelindex,
|
||||
Vector vecBreakableObbSize = pBreakable->CollisionProp()->OBBSize();
|
||||
|
||||
// Try to align the gibs along the original axis
|
||||
matrix3x4_t matrix;
|
||||
static matrix3x4_t matrix;
|
||||
AngleMatrix( vecAngles, matrix );
|
||||
AlignBoxes( &matrix, vecObbSize, vecBreakableObbSize );
|
||||
MatrixAngles( matrix, vecAngles );
|
||||
|
@ -221,7 +221,7 @@ struct breakmodel_t
|
||||
|
||||
struct breakablepropparams_t
|
||||
{
|
||||
breakablepropparams_t( const Vector &_origin, const QAngle &_angles, const Vector &_velocity, const AngularImpulse &_angularVelocity )
|
||||
breakablepropparams_t( const Vector _origin, const QAngle _angles, const Vector _velocity, const AngularImpulse _angularVelocity )
|
||||
: origin(_origin), angles(_angles), velocity(_velocity), angularVelocity(_angularVelocity)
|
||||
{
|
||||
impactEnergyScale = 0;
|
||||
@ -230,10 +230,10 @@ struct breakablepropparams_t
|
||||
nDefaultSkin = 0;
|
||||
}
|
||||
|
||||
const Vector &origin;
|
||||
const QAngle &angles;
|
||||
const Vector &velocity;
|
||||
const AngularImpulse &angularVelocity;
|
||||
const Vector origin;
|
||||
const QAngle angles;
|
||||
const Vector velocity;
|
||||
const AngularImpulse angularVelocity;
|
||||
float impactEnergyScale;
|
||||
float defBurstScale;
|
||||
int defCollisionGroup;
|
||||
|
Loading…
Reference in New Issue
Block a user