From 623223354a2b103443e4554cddc218d8dce2c3d2 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 2 Dec 2014 12:10:21 +0100 Subject: [PATCH] More unsigned ints because of undefined integer overflow behaviour --- src/engine/client/sound.cpp | 4 ++-- src/engine/shared/snapshot.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp index f803c066c..45201ff21 100644 --- a/src/engine/client/sound.cpp +++ b/src/engine/client/sound.cpp @@ -260,8 +260,8 @@ static void Mix(short *pFinalOut, unsigned Frames) for(unsigned i = 0; i < Frames; i++) { int j = i<<1; - int vl = ((m_pMixBuffer[j]*MasterVol)/101)>>8; - int vr = ((m_pMixBuffer[j+1]*MasterVol)/101)>>8; + unsigned int vl = (((unsigned int) m_pMixBuffer[j]*MasterVol)/101)>>8; + unsigned int vr = (((unsigned int) m_pMixBuffer[j+1]*MasterVol)/101)>>8; pFinalOut[j] = Int2Short(vl); pFinalOut[j+1] = Int2Short(vr); diff --git a/src/engine/shared/snapshot.cpp b/src/engine/shared/snapshot.cpp index d66e089fd..69a483820 100644 --- a/src/engine/shared/snapshot.cpp +++ b/src/engine/shared/snapshot.cpp @@ -30,7 +30,7 @@ int CSnapshot::GetItemIndex(int Key) int CSnapshot::Crc() { - int Crc = 0; + unsigned int Crc = 0; for(int i = 0; i < m_NumItems; i++) {