changeset 1313:eb3f883f4acb

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 20 Aug 2017 01:38:36 +0300
parents 4eb394c9e682
children 4670907412e7
files tools/xm2jss.c
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/tools/xm2jss.c	Sun Aug 20 01:20:56 2017 +0300
+++ b/tools/xm2jss.c	Sun Aug 20 01:38:36 2017 +0300
@@ -63,15 +63,13 @@
 
 void argShowHelp()
 {
-    int i;
-
     dmPrintBanner(stdout, dmProgName, "[options] <input.xm> <output.jmod>");
     dmArgsPrintHelp(stdout, optList, optListN, 0);
 
     printf("\n"
     "Pattern storage modes:\n");
 
-    for (i = 1; i < PATMODE_LAST; i++)
+    for (int i = 1; i < PATMODE_LAST; i++)
         printf("  %d = %s\n", i, patModeTable[i-1]);
 
     printf(
@@ -425,7 +423,6 @@
 
 static BOOL jssMODWriteEnvelope(FILE *outFile, JSSEnvelope *env, const char *name, const int ninst)
 {
-    int i;
     BOOL ok =
         dm_fwrite_byte(outFile, env->flags) &&
         dm_fwrite_byte(outFile, env->npoints) &&
@@ -433,7 +430,7 @@
         dm_fwrite_byte(outFile, env->loopS) &&
         dm_fwrite_byte(outFile, env->loopE);
 
-    for (i = 0; ok && i < env->npoints; i++)
+    for (int i = 0; ok && i < env->npoints; i++)
     {
         ok =
             dm_fwrite_le16(outFile, env->points[i].frame) &&
@@ -622,7 +619,6 @@
     if (module->extInstruments[index] != NULL)
     {
         JSSExtInstrument *einst = module->extInstruments[index];
-        int i;
 
         BOOL ok =
             dm_fwrite_byte(outFile, einst->nsamples) &&
@@ -632,7 +628,7 @@
             dm_fwrite_le16(outFile, einst->vibratoRate) &&
             dm_fwrite_le16(outFile, einst->fadeOut);
 
-        for (i = 0; ok && i < jsetNNotes; i++)
+        for (int i = 0; ok && i < jsetNNotes; i++)
         {
             int snum = einst->sNumForNotes[i];
             Uint32 tmp = (snum != jsetNotSet) ? snum + 1 : 0;
@@ -734,17 +730,16 @@
 
 
 /* Scan given pattern for used instruments and channels.
- * Also checks if the pattern is emty.
+ * Also checks if the pattern is empty.
  */
 void scanPattern(JSSModule *module, JSSPattern *pattern, int npattern, BOOL *usedExtInstruments, BOOL *usedChannels, BOOL *empty)
 {
-    int row, channel;
     JSSNote *n = pattern->data;
     *empty = FALSE;
 
     // Check all notes in this pattern to see what instruments are used
-    for (row = 0; row < pattern->nrows; row++)
-    for (channel = 0; channel < pattern->nchannels; channel++, n++)
+    for (int row = 0; row < pattern->nrows; row++)
+    for (int channel = 0; channel < pattern->nchannels; channel++, n++)
     {
         if (n->instrument != jsetNotSet)
         {
@@ -1064,6 +1059,7 @@
 
             JMPGETEFFECT(effect, n->effect);
 
+            // Convert certain effects
             switch (effect)
             {
                 case 'C': // Cxx = Set volume