Browse Source

again boring misalignment fixes

pull/110/merge
nillerusr 2 years ago
parent
commit
08073ae622
  1. 14
      engine/audio/private/snd_wave_mixer_adpcm.cpp
  2. 2
      engine/dt_localtransfer.cpp
  3. 4
      public/bone_setup.cpp
  4. 4
      public/tier1/utlbuffer.h
  5. 4
      tier1/checksum_md5.cpp

14
engine/audio/private/snd_wave_mixer_adpcm.cpp

@ -123,15 +123,13 @@ void CAudioMixerWaveADPCM::DecompressBlockMono( short *pOut, const char *pIn, in @@ -123,15 +123,13 @@ void CAudioMixerWaveADPCM::DecompressBlockMono( short *pOut, const char *pIn, in
int co2 = m_pCoefficients[pred].iCoef2;
// read initial delta
int delta = *((short *)pIn);
pIn += 2;
short data[3];
memcpy( data, pIn, sizeof(data) );
pIn += sizeof(data);
// read initial samples for prediction
int samp1 = *((short *)pIn);
pIn += 2;
int samp2 = *((short *)pIn);
pIn += 2;
int delta = data[0];
int samp1 = data[1];
int samp2 = data[2];
// write out the initial samples (stored in reverse order)
*pOut++ = (short)samp2;

2
engine/dt_localtransfer.cpp

@ -63,7 +63,7 @@ inline void LocalTransfer_FastType( @@ -63,7 +63,7 @@ inline void LocalTransfer_FastType(
const T *pSource = (const T*)( pServerBase + pCur->m_iSendOffset );
T *pDest = (T*)( pClientBase + pCur->m_iRecvOffset );
*pDest = *pSource;
memcpy( pDest, pSource, sizeof(T) );
}
}
}

4
public/bone_setup.cpp

@ -381,7 +381,7 @@ void CalcBoneQuaternion( int frame, float s, @@ -381,7 +381,7 @@ void CalcBoneQuaternion( int frame, float s,
if ( panim->flags & STUDIO_ANIM_RAWROT )
{
Quaternion48 tmp;
memcpy( &tmp, panim->pQuat48(), sizeof(Quaternion48) );
V_memcpy( &tmp, panim->pQuat48(), sizeof(Quaternion48) );
q = tmp;
Assert( q.IsValid() );
return;
@ -390,7 +390,7 @@ void CalcBoneQuaternion( int frame, float s, @@ -390,7 +390,7 @@ void CalcBoneQuaternion( int frame, float s,
if ( panim->flags & STUDIO_ANIM_RAWROT2 )
{
Quaternion64 tmp;
memcpy( &tmp, panim->pQuat64(), sizeof(Quaternion64) );
V_memcpy( &tmp, panim->pQuat64(), sizeof(Quaternion64) );
q = tmp;
Assert( q.IsValid() );
return;

4
public/tier1/utlbuffer.h

@ -705,7 +705,6 @@ inline void CUtlBuffer::GetTypeBin( T &dest ) @@ -705,7 +705,6 @@ inline void CUtlBuffer::GetTypeBin( T &dest )
if ( !m_Byteswap.IsSwappingBytes() || ( sizeof( T ) == 1 ) )
{
memcpy(&dest, PeekGet(), sizeof(T) );
dest = *(T *)PeekGet();
}
else
{
@ -735,8 +734,7 @@ inline void CUtlBuffer::GetTypeBin< float >( float &dest ) @@ -735,8 +734,7 @@ inline void CUtlBuffer::GetTypeBin< float >( float &dest )
}
else
{
// aligned read
dest = *(float *)pData;
memcpy( &dest, (void*)pData, sizeof(float) );
}
if ( m_Byteswap.IsSwappingBytes() )
{

4
tier1/checksum_md5.cpp

@ -267,7 +267,9 @@ unsigned int MD5_PseudoRandom(unsigned int nSeed) @@ -267,7 +267,9 @@ unsigned int MD5_PseudoRandom(unsigned int nSeed)
MD5Update(&ctx, (unsigned char*)&nSeed, sizeof(nSeed) );
MD5Final(digest, &ctx);
return *(unsigned int*)(digest+6); // use 4 middle bytes for random value
unsigned int rand;
memcpy(&rand, digest+6, sizeof(rand)); // use 4 middle bytes for random value
return rand;
}
//-----------------------------------------------------------------------------

Loading…
Cancel
Save