changeset 1226:18baa42db260

Rename some function arguments to better reflect their meaning.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 06 Mar 2015 10:04:11 +0200
parents e8f0305f8e6b
children a4a9ce298cdd
files minijss/jloadxm.c
diffstat 1 files changed, 22 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/minijss/jloadxm.c	Fri Mar 06 10:00:54 2015 +0200
+++ b/minijss/jloadxm.c	Fri Mar 06 10:04:11 2015 +0200
@@ -504,7 +504,7 @@
 
 static int jssXMLoadSampleInstrument(
     DMResource *inFile, JSSModule *module,
-    JSSExtInstrument *einst, int ninst, int nsample)
+    JSSExtInstrument *einst, int neinst, int nsample)
 {
     XMSample xmS;
     JSSInstrument *inst;
@@ -523,7 +523,7 @@
     {
         JSSERROR(DMERR_FREAD, DMERR_FREAD,
         "Error reading instrument sample header #%d/%d [%d]",
-        ninst, nsample, module->ninstruments);
+        neinst, nsample, module->ninstruments);
     }
 
     if (xmS.size <= 0)
@@ -531,7 +531,7 @@
 
     // Allocate sample instrument
     JSSDEBUG("Allocating sample #%d/%d [%d]\n",
-    ninst, nsample, module->ninstruments);
+    neinst, nsample, module->ninstruments);
 
     einst->instConvTable[nsample] = module->ninstruments;
     inst = module->instruments[module->ninstruments] = jssAllocateInstrument();
@@ -539,7 +539,7 @@
     {
         JSSERROR(DMERR_MALLOC, DMERR_MALLOC,
         "Could not allocate sample #%d/%d [%d]\n",
-        ninst, nsample, module->ninstruments);
+        neinst, nsample, module->ninstruments);
     }
     module->ninstruments++;
 
@@ -547,7 +547,7 @@
     if (xmS.volume > XM_MaxSampleVolume)
     {
         JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA,
-        "Samp #%d/%d: volume > MAX\n", ninst, nsample);
+        "Samp #%d/%d: volume > MAX\n", neinst, nsample);
         xmS.volume = XM_MaxSampleVolume;
     }
 
@@ -600,7 +600,7 @@
         {
             JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA,
             "Samp #%d/%d: loopS >= size (%d >= %d)\n",
-            ninst, nsample, inst->loopS, inst->size);
+            neinst, nsample, inst->loopS, inst->size);
             JSFUNSET(inst->flags, jsfLooped);
         }
 
@@ -608,7 +608,7 @@
         {
             JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA,
             "Samp #%d/%d: loopE > size (%d > %d)\n",
-            ninst, nsample, inst->loopE, inst->size);
+            neinst, nsample, inst->loopE, inst->size);
             JSFUNSET(inst->flags, jsfLooped);
         }
     }
@@ -676,7 +676,7 @@
 
 static int jssXMLoadInstrumentSamples(
     DMResource *inFile, JSSModule *module,
-    JSSExtInstrument *einst, int ninst)
+    JSSExtInstrument *einst, int neinst)
 {
     int nsample, ret;
 
@@ -684,7 +684,7 @@
     if (einst->instConvTable[nsample] != jsetNotSet)
     {
         JSSInstrument *inst = module->instruments[einst->instConvTable[nsample]];
-        if ((ret = jssXMLoadSampleData(inFile, inst, ninst, nsample)) != DMERR_OK)
+        if ((ret = jssXMLoadSampleData(inFile, inst, neinst, nsample)) != DMERR_OK)
             return ret;
     }
 
@@ -716,7 +716,7 @@
 
 /* Load XM-format extended instrument from file-stream into JSS module's given inst
  */
-static int jssXMLoadExtInstrument(DMResource *inFile, int ninst, JSSModule *module)
+static int jssXMLoadExtInstrument(DMResource *inFile, int neinst, JSSModule *module)
 {
     XMInstrument1 xmI1;
     off_t remainder, pos = dmftell(inFile);
@@ -731,7 +731,7 @@
         !dmf_read_le16(inFile, &xmI1.nsamples))
     {
         JSSERROR(DMERR_FREAD, DMERR_FREAD,
-        "Failed to read primary extended instrument header #%d\n", ninst);
+        "Failed to read primary extended instrument header #%d\n", neinst);
     }
 
     // If there are samples, there is header #2
@@ -751,24 +751,24 @@
     if ((einst = jssAllocateExtInstrument()) == NULL)
     {
         JSSERROR(DMERR_MALLOC, DMERR_MALLOC,
-        "Could not allocate extended instrument structure #%d\n", ninst);
+        "Could not allocate extended instrument structure #%d\n", neinst);
     }
 
-    module->extInstruments[ninst] = einst;
+    module->extInstruments[neinst] = einst;
 
     // Get instrument header #2
     if (!dmf_read_le32(inFile, &xmI2.headSize) ||
         !dmf_read_str(inFile, &xmI2.sNumForNotes, sizeof(xmI2.sNumForNotes)))
     {
         JSSERROR(DMERR_FREAD, DMERR_FREAD,
-        "Could not read secondary instrument header part #1 for #%d.\n", ninst);
+        "Could not read secondary instrument header part #1 for #%d.\n", neinst);
     }
 
     if (!jssXMLoadEnvelopePoints(inFile, &xmI2.volumeEnv) ||
         !jssXMLoadEnvelopePoints(inFile, &xmI2.panningEnv))
     {
         JSSERROR(DMERR_FREAD, DMERR_FREAD,
-        "Could not read envelope point data for instrument #%d.\n", ninst);
+        "Could not read envelope point data for instrument #%d.\n", neinst);
     }
 
     if (!dmf_read_byte(inFile, &xmI2.volumeEnv.npoints) ||
@@ -789,7 +789,7 @@
         !dmf_read_le16(inFile, &xmI2.ARESERVED))
     {
         JSSERROR(DMERR_FREAD, DMERR_FREAD,
-        "Could not read secondary instrument header part #2 for #%d.\n", ninst);
+        "Could not read secondary instrument header part #2 for #%d.\n", neinst);
     }
 
     // Skip the extra data after header #2
@@ -804,8 +804,8 @@
 #ifndef JSS_LIGHT
     einst->desc = jssASCIItoStr(xmI1.instName, 0, sizeof(xmI1.instName));
 #endif
-    jssXMConvertEnvelope(&einst->volumeEnv, &xmI2.volumeEnv, "vol", ninst);
-    jssXMConvertEnvelope(&einst->panningEnv, &xmI2.panningEnv, "pan", ninst);
+    jssXMConvertEnvelope(&einst->volumeEnv, &xmI2.volumeEnv, "vol", neinst);
+    jssXMConvertEnvelope(&einst->panningEnv, &xmI2.panningEnv, "pan", neinst);
 
     switch (xmI2.vibratoType)
     {
@@ -816,7 +816,7 @@
         default:
             einst->vibratoType = jvibSine;
             JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA,
-            "Invalid extinstrument vibrato type %d for inst #%d\n", ninst);
+            "Invalid extinstrument vibrato type %d for inst #%d\n", neinst);
             break;
     }
     einst->vibratoSweep = xmI2.vibratoSweep;
@@ -832,7 +832,7 @@
     // Read sample headers
     for (nsample = 0; nsample < xmI1.nsamples; nsample++)
     {
-        if ((ret = jssXMLoadSampleInstrument(inFile, module, einst, ninst, nsample)) != DMERR_OK)
+        if ((ret = jssXMLoadSampleInstrument(inFile, module, einst, neinst, nsample)) != DMERR_OK)
             return ret;
     }
 
@@ -847,14 +847,14 @@
             einst->sNumForNotes[i] = jsetNotSet;
             JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA,
             "Ext.instrument #%d sNumForNotes[%d] out of range (%d).\n",
-            ninst, i, tmp);
+            neinst, i, tmp);
         }
     }
 
     // Read sample data if needed
     if (module->intVersion == 0x0104)
     {
-        if ((ret = jssXMLoadInstrumentSamples(inFile, module, einst, ninst)) != DMERR_OK)
+        if ((ret = jssXMLoadInstrumentSamples(inFile, module, einst, neinst)) != DMERR_OK)
             return ret;
     }