diff tools/xm2jss.c @ 856:415cc781e127

Fix some brain farts in instrument remapping.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 21 Nov 2014 16:57:08 +0200
parents d83dc7e47076
children daebbf28953d
line wrap: on
line diff
--- 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)