From be0a8cbeab059914baf8156985ff11677d667590 Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Thu, 28 Sep 2017 17:08:52 +0300 Subject: [PATCH] "array subscript is below array bounds" compilation warning --- src/tic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tic.c b/src/tic.c index 1b9fb88..189c18e 100644 --- a/src/tic.c +++ b/src/tic.c @@ -295,10 +295,11 @@ static void channelSfx(tic_mem* memory, s32 index, s32 note, s32 octave, s32 dur c->volume = volume; - { - struct {s8 speed:SFX_SPEED_BITS;} temp = {speed}; - c->speed = speed == temp.speed ? speed : machine->soundSrc->sfx.data[index].speed; - } + if(index >= 0) + { + struct {s8 speed:SFX_SPEED_BITS;} temp = {speed}; + c->speed = speed == temp.speed ? speed : machine->soundSrc->sfx.data[index].speed; + } // start index of idealized piano enum {PianoStart = -8}; @@ -324,7 +325,6 @@ static void resetMusic(tic_mem* memory) musicSfx(memory, -1, 0, 0, 0, c); } - static void setMusic(tic_machine* machine, s32 index, s32 frame, s32 row, bool loop) { tic_mem* memory = (tic_mem*)machine;