use High() to avoid future out of bounds in uSound
authorkoda
Sat, 01 Dec 2012 04:36:13 +0100
changeset 8168 645ee0e201a2
parent 8165 9527839ad58b
child 8169 c76a00ad070c
use High() to avoid future out of bounds in uSound
hedgewars/uSound.pas
--- a/hedgewars/uSound.pas	Fri Nov 30 22:23:26 2012 -0500
+++ b/hedgewars/uSound.pas	Sat Dec 01 04:36:13 2012 +0100
@@ -419,7 +419,7 @@
     if (snd = sndVictory) or (snd = sndFlawless) then
         begin
         Mix_FadeOutChannel(-1, 800);
-        for i:= 0 to 7 do
+        for i:= 0 to High(VoiceList) do
             VoiceList[i].snd:= sndNone;
         LastVoice.snd:= sndNone;
         end;
@@ -441,7 +441,7 @@
     if (not isSoundEnabled) or fastUntilLag or ((LastVoice.snd <> sndNone) and (lastChan[LastVoice.snd] <> -1) and (Mix_Playing(lastChan[LastVoice.snd]) <> 0)) then
         exit;
     i:= 0;
-    while (i<7) and (VoiceList[i].snd = sndNone) do
+    while (i<High(VoiceList)) and (VoiceList[i].snd = sndNone) do
         inc(i);
     
     if (VoiceList[i].snd <> sndNone) then
@@ -719,7 +719,7 @@
                 voicepacks[t].chunks[i]:= nil;
 
     (* on MOBILE SDL_mixer has to be compiled against Tremor (USE_OGG_TREMOR)
-       or sound files bigger than 32k will lockup the game *)
+       or sound files bigger than 32k will lockup the game on slow cpu *)
     for i:= Low(TSound) to High(TSound) do
         defVoicepack^.chunks[i]:= nil;