# HG changeset patch # User Matti Hamalainen # Date 1416581828 -7200 # Node ID 415cc781e12727af739f6814c38427f7e21d8496 # Parent f70d6f9532cd333765366998818dd84b08e96f8e Fix some brain farts in instrument remapping. diff -r f70d6f9532cd -r 415cc781e127 tools/xm2jss.c --- a/tools/xm2jss.c Thu Oct 23 02:14:15 2014 +0300 +++ b/tools/xm2jss.c Fri Nov 21 16:57:08 2014 +0200 @@ -734,7 +734,7 @@ } // Find out used instruments - for (i = 0; i <= jsetMaxInstruments; i++) + for (i = 0; i < jsetMaxInstruments; i++) if (usedExtInstruments[i] && m->extInstruments[i] != NULL) { int note; @@ -785,7 +785,7 @@ // Re-map instruments dmMsg(1, "Unused instruments: "); - for (n8 = n16 = i = 0; i <= jsetMaxInstruments; i++) + for (n8 = n16 = i = 0; i < jsetMaxInstruments; i++) if (m->instruments[i] != NULL) { if (!usedInstruments[i] && !optStripInstr) @@ -839,7 +839,7 @@ if (q != jsetNotSet) { int map; - if (q >= 0 && q <= jsetMaxInstruments) + if (q >= 0 && q < jsetMaxInstruments) { map = mapInstruments[q]; } @@ -883,7 +883,7 @@ if (!optStripExtInstr) { - if (n->instrument >= 0 && n->instrument <= jsetMaxInstruments) + if (n->instrument >= 0 && n->instrument < jsetMaxInstruments) n->instrument = mapExtInstruments[n->instrument]; if (n->instrument != jsetNotSet && r->extInstruments[n->instrument] == NULL)