# HG changeset patch # User Matti Hamalainen # Date 1425524369 -7200 # Node ID f5edb39a8db11ec993239dc19e024542dab9cc08 # Parent 1ed8af15581aa0e6498326b24e5a0ed2aa477089 Rename some function arguments for clarity. One letter variable names are generally not so good. diff -r 1ed8af15581a -r f5edb39a8db1 minijss/jloadxm.c --- a/minijss/jloadxm.c Thu Mar 05 04:59:01 2015 +0200 +++ b/minijss/jloadxm.c Thu Mar 05 04:59:29 2015 +0200 @@ -218,7 +218,7 @@ /* Convert XM envelope structure to JSS envelope structure */ -static int jssXMConvertEnvelope(JSSEnvelope * d, XMEnvelope * s, char * e, int instr) +static int jssXMConvertEnvelope(JSSEnvelope * dst, XMEnvelope * src, const char * name, const int ninstr) { int i; (void) name; @@ -227,57 +227,65 @@ // Convert envelope points for (i = 0; i < XM_MaxEnvPoints; i++) { - d->points[i].frame = s->points[i].frame; - d->points[i].value = s->points[i].value; + dst->points[i].frame = src->points[i].frame; + dst->points[i].value = src->points[i].value; } // Convert other values - d->npoints = s->npoints; - d->sustain = s->sustain; - d->loopS = s->loopS; - d->loopE = s->loopE; + dst->npoints = src->npoints; + dst->sustain = src->sustain; + dst->loopS = src->loopS; + dst->loopE = src->loopE; // Check if the envelope is used - if (s->flags & 0x01) + if (src->flags & 0x01) { // Convert envelope flags - d->flags = jenvfUsed; - if (s->flags & 0x02) - d->flags |= jenvfSustain; + dst->flags = jenvfUsed; + if (src->flags & 0x02) + dst->flags |= jenvfSustain; + + if (src->flags & 0x04) + dst->flags |= jenvfLooped; - if (s->flags & 0x04) - d->flags |= jenvfLooped; + if (src->flags & 0xf0) + { + JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA, + "Inst#%d/%s-env: Uses unsupported flags values, 0x%02x.\n", + ninstr, name, src->flags); + } // Check other values - if (s->npoints > XM_MaxEnvPoints) + if (src->npoints > XM_MaxEnvPoints) { JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA, - "Inst#%d/%s-env: nPoints > MAX, possibly broken file.\n", instr, e); - s->npoints = XM_MaxEnvPoints; + "Inst#%d/%s-env: nPoints > MAX, possibly broken file.\n", + ninstr, name); + dst->npoints = XM_MaxEnvPoints; } - if ((d->flags & jenvfSustain) && s->sustain > s->npoints) + if ((dst->flags & jenvfSustain) && src->sustain > src->npoints) { JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA, "Inst#%d/%s-env: iSustain > nPoints (%d > %d), possibly broken file.\n", - instr, e, s->sustain, s->npoints); - s->sustain = s->npoints; + ninstr, name, src->sustain, src->npoints); + dst->sustain = src->npoints; } - if ((d->flags & jenvfLooped) && s->loopE > s->npoints) + if ((dst->flags & jenvfLooped) && src->loopE > src->npoints) { JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA, "Inst#%d/%s-env: loopE > nPoints (%d > %d), possibly broken file.\n", - instr, e, s->loopE, s->npoints); - s->loopE = s->npoints; + ninstr, name, src->loopE, src->npoints); + dst->loopE = src->npoints; } - if ((d->flags & jenvfLooped) && s->loopS > s->loopE) + if ((dst->flags & jenvfLooped) && src->loopS > src->loopE) { JSSWARNING(DMERR_INVALID_DATA, DMERR_INVALID_DATA, "Inst#%d/%s-env: loopS > loopE (%d > %d), possibly broken file.\n", - instr, e, s->loopS, s->loopE); - s->loopS = 0; + ninstr, name, src->loopS, src->loopE); + dst->loopS = src->loopE; } }