summaryrefslogtreecommitdiffstats
path: root/apps/plugins/mikmod/load_mod.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mikmod/load_mod.c')
-rw-r--r--apps/plugins/mikmod/load_mod.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/apps/plugins/mikmod/load_mod.c b/apps/plugins/mikmod/load_mod.c
index 6075e9c7e1..0fe0dcd595 100644
--- a/apps/plugins/mikmod/load_mod.c
+++ b/apps/plugins/mikmod/load_mod.c
@@ -6,12 +6,12 @@
it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
-
+
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -20,7 +20,7 @@
/*==============================================================================
- $Id: load_mod.c,v 1.3 2005/04/07 19:57:38 realtech Exp $
+ $Id$
Generic MOD loader (Protracker, StarTracker, FastTracker, etc)
@@ -108,7 +108,7 @@ static int MOD_CheckType(UBYTE *id, UBYTE *numchn, CHAR **descr)
*numchn = 4;
return 1;
}
-
+
/* Star Tracker */
if (((!memcmp(id, "FLT", 3)) || (!memcmp(id, "EXO", 3))) &&
(isdigit(id[3]))) {
@@ -190,6 +190,8 @@ static void MOD_Cleanup(void)
{
MikMod_free(mh);
MikMod_free(patbuf);
+ mh=NULL;
+ patbuf=NULL;
}
/*
@@ -277,7 +279,7 @@ static UBYTE ConvertNote(MODNOTE *n, UBYTE lasteffect)
/* Handle ``heavy'' volumes correctly */
if ((effect == 0xc) && (effdat > 0x40))
effdat = 0x40;
-
+
/* An isolated 100, 200 or 300 effect should be ignored (no
"standalone" porta memory in mod files). However, a sequence such
as 1XX, 100, 100, 100 is fine. */
@@ -288,7 +290,7 @@ static UBYTE ConvertNote(MODNOTE *n, UBYTE lasteffect)
UniPTEffect(effect, effdat);
if (effect == 8)
of.flags |= UF_PANNING;
-
+
return effect;
}
@@ -309,14 +311,13 @@ static UBYTE *ConvertTrack(MODNOTE *n, int numchn)
/* Loads all patterns of a modfile and converts them into the 3 byte format. */
static int ML_LoadPatterns(void)
{
- int t, tracks = 0;
- unsigned int s;
+ unsigned int t, s, tracks = 0;
if (!AllocPatterns())
return 0;
if (!AllocTracks())
return 0;
-
+
/* Allocate temporary buffer for loading and converting the patterns */
if (!(patbuf = (MODNOTE *)MikMod_calloc(64U * of.numchn, sizeof(MODNOTE))))
return 0;
@@ -385,10 +386,10 @@ static int MOD_Load(int curious)
mh->songlength = _mm_read_UBYTE(modreader);
- /* this fixes mods which declare more than 128 positions.
+ /* this fixes mods which declare more than 128 positions.
* eg: beatwave.mod */
if (mh->songlength > 128) { mh->songlength = 128; }
-
+
mh->magic1 = _mm_read_UBYTE(modreader);
_mm_read_UBYTES(mh->positions, 128, modreader);
_mm_read_UBYTES(mh->magic2, 4, modreader);
@@ -477,11 +478,11 @@ static int MOD_Load(int curious)
q++;
}
- of.modtype = StrDup(descr);
+ of.modtype = MikMod_strdup(descr);
if (!ML_LoadPatterns())
return 0;
-
+
return 1;
}