Commits

Shlomi Fish committed fabc22c

Eliminate more warnings.

Comments (0)

Files changed (14)

libmikmod/include/mikmod_internals.h

 
 extern void _mm_iobase_setcur(MREADER*);
 extern void _mm_iobase_revert(MREADER*);
-extern FILE *_mm_fopen(CHAR*,CHAR*);
+extern FILE * _mm_fopen(const CHAR *, const CHAR *);
 extern int	_mm_fclose(FILE *);
 extern void _mm_write_string(const CHAR*,MWRITER*);
 extern int  _mm_read_string (CHAR*,int,MREADER*);
 
 /* loader shared data */
 #define STM_NTRACKERS 3
-extern CHAR *STM_Signatures[STM_NTRACKERS];
+extern const CHAR *STM_Signatures[STM_NTRACKERS];
 
 /*========== Player interface */
 

libmikmod/loaders/load_stm.c

 static STMHEADER *mh = NULL;
 
 /* tracker identifiers */
-static CHAR* STM_Version[STM_NTRACKERS] = {
+static const CHAR * STM_Version[STM_NTRACKERS] = {
 	"Screamtracker 2",
 	"Converted by MOD2STM (STM format)",
 	"Wuzamod (STM format)"
 
 /*========== Loader code */
 
-BOOL STM_Test(void)
+static BOOL STM_Test(void)
 {
 	UBYTE str[44];
 	int t;
 	return 0;
 }
 
-BOOL STM_Init(void)
+static BOOL STM_Init(void)
 {
 	if(!(mh=(STMHEADER*)MikMod_malloc(sizeof(STMHEADER)))) return 0;
 	if(!(stmbuf=(STMNOTE*)MikMod_calloc(64U*4,sizeof(STMNOTE)))) return 0;
 	return 1;
 }
 
-BOOL STM_Load(BOOL curious)
+static BOOL STM_Load(BOOL curious)
 {
-	int t; 
+	int t;
 	ULONG MikMod_ISA; /* We must generate our own ISA, it's not stored in stm */
 	SAMPLE *q;
 
 	return 1;
 }
 
-CHAR *STM_LoadTitle(void)
+static CHAR *STM_LoadTitle(void)
 {
 	CHAR s[20];
 

libmikmod/loaders/load_ult.c

 
 /*========== Loader code */
 
-BOOL ULT_Test(void)
+static BOOL ULT_Test(void)
 {
 	CHAR id[16];
 
 	return 1;
 }
 
-BOOL ULT_Init(void)
+static BOOL ULT_Init(void)
 {
 	return 1;
 }
 
-void ULT_Cleanup(void)
+static void ULT_Cleanup(void)
 {
 }
 
 	return rep;
 }
 
-BOOL ULT_Load(BOOL curious)
+static BOOL ULT_Load(BOOL curious)
 {
 	int t,u,tracks=0;
 	SAMPLE *q;
 	return 1;
 }
 
-CHAR *ULT_LoadTitle(void)
+static CHAR * ULT_LoadTitle(void)
 {
 	CHAR s[32];
 

libmikmod/loaders/load_uni.c

 
 /*========== Loader code */
 
-static char* readstring(void)
+static char * readstring(void)
 {
-	char *s=NULL;
+	char *my_string=NULL;
 	UWORD len;
 	
 	len=_mm_read_I_UWORD(modreader);
 	if(len) {
-		s=MikMod_malloc(len+1);
-		_mm_read_UBYTES(s,len,modreader);
-		s[len]=0;
+		my_string=MikMod_malloc(len+1);
+		_mm_read_UBYTES(my_string,len,modreader);
+		my_string[len]=0;
 	}
-	return s;
+	return my_string;
 }
 
-BOOL UNI_Test(void)
+static BOOL UNI_Test(void)
 {
 	char id[6];
 
 	return 0;
 }
 
-BOOL UNI_Init(void)
+static BOOL UNI_Init(void)
 {
 	return 1;
 }
 
-void UNI_Cleanup(void)
+static void UNI_Cleanup(void)
 {
 	MikMod_free(wh);
 	s=NULL;
 static BOOL loadsmp6(void)
 {
 	int t;
-	SAMPLE *s;
+	SAMPLE *my_sample_ptr;
 
-	s=of.samples;
-	for(t=0;t<of.numsmp;t++,s++) {
+	my_sample_ptr=of.samples;
+	for(t=0;t<of.numsmp;t++,my_sample_ptr++) {
 		int flags;
 
 		flags         = _mm_read_M_UWORD(modreader);
-		s->flags=0;
-		if(flags&0x0004) s->flags|=SF_STEREO;
-		if(flags&0x0002) s->flags|=SF_SIGNED;
-		if(flags&0x0001) s->flags|=SF_16BITS;
+		my_sample_ptr->flags=0;
+		if(flags&0x0004) my_sample_ptr->flags|=SF_STEREO;
+		if(flags&0x0002) my_sample_ptr->flags|=SF_SIGNED;
+		if(flags&0x0001) my_sample_ptr->flags|=SF_16BITS;
 		/* convert flags */
 		if(universion>=0x104) {
-			if(flags&0x2000) s->flags|=SF_UST_LOOP;
-			if(flags&0x1000) s->flags|=SF_OWNPAN;
-			if(flags&0x0800) s->flags|=SF_SUSTAIN;
-			if(flags&0x0400) s->flags|=SF_REVERSE;
-			if(flags&0x0200) s->flags|=SF_BIDI;
-			if(flags&0x0100) s->flags|=SF_LOOP;
-			if(flags&0x0020) s->flags|=SF_ITPACKED;
-			if(flags&0x0010) s->flags|=SF_DELTA;
-			if(flags&0x0008) s->flags|=SF_BIG_ENDIAN;
+			if(flags&0x2000) my_sample_ptr->flags|=SF_UST_LOOP;
+			if(flags&0x1000) my_sample_ptr->flags|=SF_OWNPAN;
+			if(flags&0x0800) my_sample_ptr->flags|=SF_SUSTAIN;
+			if(flags&0x0400) my_sample_ptr->flags|=SF_REVERSE;
+			if(flags&0x0200) my_sample_ptr->flags|=SF_BIDI;
+			if(flags&0x0100) my_sample_ptr->flags|=SF_LOOP;
+			if(flags&0x0020) my_sample_ptr->flags|=SF_ITPACKED;
+			if(flags&0x0010) my_sample_ptr->flags|=SF_DELTA;
+			if(flags&0x0008) my_sample_ptr->flags|=SF_BIG_ENDIAN;
 		} else if(universion>=0x102) {
-			if(flags&0x0800) s->flags|=SF_UST_LOOP;
-			if(flags&0x0400) s->flags|=SF_OWNPAN;
-			if(flags&0x0200) s->flags|=SF_SUSTAIN;
-			if(flags&0x0100) s->flags|=SF_REVERSE;
-			if(flags&0x0080) s->flags|=SF_BIDI;
-			if(flags&0x0040) s->flags|=SF_LOOP;
-			if(flags&0x0020) s->flags|=SF_ITPACKED;
-			if(flags&0x0010) s->flags|=SF_DELTA;
-			if(flags&0x0008) s->flags|=SF_BIG_ENDIAN;
+			if(flags&0x0800) my_sample_ptr->flags|=SF_UST_LOOP;
+			if(flags&0x0400) my_sample_ptr->flags|=SF_OWNPAN;
+			if(flags&0x0200) my_sample_ptr->flags|=SF_SUSTAIN;
+			if(flags&0x0100) my_sample_ptr->flags|=SF_REVERSE;
+			if(flags&0x0080) my_sample_ptr->flags|=SF_BIDI;
+			if(flags&0x0040) my_sample_ptr->flags|=SF_LOOP;
+			if(flags&0x0020) my_sample_ptr->flags|=SF_ITPACKED;
+			if(flags&0x0010) my_sample_ptr->flags|=SF_DELTA;
+			if(flags&0x0008) my_sample_ptr->flags|=SF_BIG_ENDIAN;
 		} else {
-			if(flags&0x400) s->flags|=SF_UST_LOOP;
-			if(flags&0x200) s->flags|=SF_OWNPAN;
-			if(flags&0x100) s->flags|=SF_REVERSE;
-			if(flags&0x080) s->flags|=SF_SUSTAIN;
-			if(flags&0x040) s->flags|=SF_BIDI;
-			if(flags&0x020) s->flags|=SF_LOOP;
-			if(flags&0x010) s->flags|=SF_BIG_ENDIAN;
-			if(flags&0x008) s->flags|=SF_DELTA;
+			if(flags&0x400) my_sample_ptr->flags|=SF_UST_LOOP;
+			if(flags&0x200) my_sample_ptr->flags|=SF_OWNPAN;
+			if(flags&0x100) my_sample_ptr->flags|=SF_REVERSE;
+			if(flags&0x080) my_sample_ptr->flags|=SF_SUSTAIN;
+			if(flags&0x040) my_sample_ptr->flags|=SF_BIDI;
+			if(flags&0x020) my_sample_ptr->flags|=SF_LOOP;
+			if(flags&0x010) my_sample_ptr->flags|=SF_BIG_ENDIAN;
+			if(flags&0x008) my_sample_ptr->flags|=SF_DELTA;
 		}
 
-		s->speed      = _mm_read_M_ULONG(modreader);
-		s->volume     = _mm_read_UBYTE(modreader);
-		s->panning    = _mm_read_M_UWORD(modreader);
-		s->length     = _mm_read_M_ULONG(modreader);
-		s->loopstart  = _mm_read_M_ULONG(modreader);
-		s->loopend    = _mm_read_M_ULONG(modreader);
-		s->susbegin   = _mm_read_M_ULONG(modreader);
-		s->susend     = _mm_read_M_ULONG(modreader);
-		s->globvol    = _mm_read_UBYTE(modreader);
-		s->vibflags   = _mm_read_UBYTE(modreader);
-		s->vibtype    = _mm_read_UBYTE(modreader);
-		s->vibsweep   = _mm_read_UBYTE(modreader);
-		s->vibdepth   = _mm_read_UBYTE(modreader);
-		s->vibrate    = _mm_read_UBYTE(modreader);
+		my_sample_ptr->speed      = _mm_read_M_ULONG(modreader);
+		my_sample_ptr->volume     = _mm_read_UBYTE(modreader);
+		my_sample_ptr->panning    = _mm_read_M_UWORD(modreader);
+		my_sample_ptr->length     = _mm_read_M_ULONG(modreader);
+		my_sample_ptr->loopstart  = _mm_read_M_ULONG(modreader);
+		my_sample_ptr->loopend    = _mm_read_M_ULONG(modreader);
+		my_sample_ptr->susbegin   = _mm_read_M_ULONG(modreader);
+		my_sample_ptr->susend     = _mm_read_M_ULONG(modreader);
+		my_sample_ptr->globvol    = _mm_read_UBYTE(modreader);
+		my_sample_ptr->vibflags   = _mm_read_UBYTE(modreader);
+		my_sample_ptr->vibtype    = _mm_read_UBYTE(modreader);
+		my_sample_ptr->vibsweep   = _mm_read_UBYTE(modreader);
+		my_sample_ptr->vibdepth   = _mm_read_UBYTE(modreader);
+		my_sample_ptr->vibrate    = _mm_read_UBYTE(modreader);
 
-		s->samplename=readstring();
+		my_sample_ptr->samplename=readstring();
 
 		if(_mm_eof(modreader)) {
 			_mm_errno = MMERR_LOADING_SAMPLEINFO;
 	return 1;
 }
 
-BOOL UNI_Load(BOOL curious)
+static BOOL UNI_Load(BOOL curious)
 {
 	int t;
 	char *modtype,*oldtype=NULL;
 	return 1;
 }
 
-CHAR *UNI_LoadTitle(void)
+static CHAR *UNI_LoadTitle(void)
 {
 	UBYTE ver;
 	int posit[3]={304,306,26};

libmikmod/loaders/load_xm.c

 
 /*========== Loader code */
 
-BOOL XM_Test(void)
+static BOOL XM_Test(void)
 {
 	UBYTE id[38];
 
 	return 0;
 }
 
-BOOL XM_Init(void)
+static BOOL XM_Init(void)
 {
 	if(!(mh=(XMHEADER *)MikMod_malloc(sizeof(XMHEADER)))) return 0;
 	return 1;
 }
 
-void XM_Cleanup(void)
+static void XM_Cleanup(void)
 {
 	MikMod_free(mh);
 }
 	return 1;
 }
 
-BOOL XM_Load(BOOL curious)
+static BOOL XM_Load(BOOL curious)
 {
 	INSTRUMENT *d;
 	SAMPLE *q;
 	return 1;
 }
 
-CHAR *XM_LoadTitle(void)
+static CHAR *XM_LoadTitle(void)
 {
-	CHAR s[21];
+	CHAR my_str[21];
 
 	_mm_fseek(modreader,17,SEEK_SET);
-	if(!_mm_read_UBYTES(s,21,modreader)) return NULL;
+	if(!_mm_read_UBYTES(my_str, 21, modreader)) return NULL;
 
-	return(DupStr(s,21,1));
+	return(DupStr(my_str,21,1));
 }
 
 /*========== Loader information */

libmikmod/mmio/mmerror.c

 
 #include "mikmod_internals.h"
 
-CHAR *_mm_errmsg[MMERR_MAX+1] =
+const CHAR *_mm_errmsg[MMERR_MAX+1] =
 {
 /* No error */
 
 	"Invalid error code"
 };
 
-MIKMODAPI char *MikMod_strerror(int code)
+MIKMODAPI const char *MikMod_strerror(int code)
 {
 	if ((code<0)||(code>MMERR_MAX)) code=MMERR_MAX+1;
 	return _mm_errmsg[code];
 MIKMODAPI int  _mm_errno = 0;
 MIKMODAPI BOOL _mm_critical = 0;
 
-MikMod_handler_t _mm_registererrorhandler(MikMod_handler_t proc)
+static MikMod_handler_t _mm_registererrorhandler(MikMod_handler_t proc)
 {
 	MikMod_handler_t oldproc=_mm_errorhandler;
 

libmikmod/mmio/mmio.c

 
 //static long _mm_iobase=0,temp_iobase=0;
 
-FILE* _mm_fopen(CHAR* fname,CHAR* attrib)
+FILE* _mm_fopen(const CHAR* fname, const CHAR* attrib)
 {
 	FILE *fp;
 

libmikmod/playercode/mdreg.c

 
 #include "mikmod_internals.h"
 
-void _mm_registeralldrivers(void)
+static void _mm_registeralldrivers(void)
 {
 	/* Register network drivers */
 #ifdef DRV_AF

libmikmod/playercode/mloader.c

 	return (mf=MikMod_malloc(sizeof(MODULE)));
 }
 
-void Player_Free_internal(MODULE *mf)
+static void Player_Free_internal(MODULE *mf)
 {
 	if(mf) {
 		Player_Exit_internal(mf);
 }
 
 /* Loads a module given an reader */
-MODULE* Player_LoadGeneric_internal(MREADER *reader,int maxchan,BOOL curious)
+static MODULE* Player_LoadGeneric_internal(MREADER *reader,int maxchan,BOOL curious)
 {
 	int t;
 	MLOADER *l;

libmikmod/playercode/mlreg.c

 
 #include "mikmod_internals.h"
 
-void MikMod_RegisterAllLoaders_internal(void)
+static void MikMod_RegisterAllLoaders_internal(void)
 {
 	_mm_registerloader(&load_669);
 	_mm_registerloader(&load_amf);

libmikmod/playercode/mlutil.c

 
 /*========== Shared tracker identifiers */
 
-CHAR *STM_Signatures[STM_NTRACKERS] = {
+const CHAR *STM_Signatures[STM_NTRACKERS] = {
 	"!Scream!",
 	"BMOD2STM",
 	"WUZAMOD!"
 };
 
-CHAR *STM_Version[STM_NTRACKERS] = {
+const CHAR *STM_Version[STM_NTRACKERS] = {
 	"Screamtracker 2",
 	"Converted by MOD2STM (STM format)",
 	"Wuzamod (STM format)"
 
 int speed_to_finetune(ULONG speed,int sample)
 {
-    int ctmp=0,tmp,note=1,finetune=0;
+    int ctmp=0,tmp,note=1,local_finetune=0;
 
     speed>>=1;
     while((tmp=getfrequency(of.flags,getlinearperiod(note<<1,0)))<speed) {
     if(tmp!=speed) {
         if((tmp-speed)<(speed-ctmp))
             while(tmp>speed)
-                tmp=getfrequency(of.flags,getlinearperiod(note<<1,--finetune));
+                tmp=getfrequency(of.flags,getlinearperiod(note<<1,--local_finetune));
         else {
             note--;
             while(ctmp<speed)
-                ctmp=getfrequency(of.flags,getlinearperiod(note<<1,++finetune));
+                ctmp=getfrequency(of.flags,getlinearperiod(note<<1,++local_finetune));
         }
     }
 
     noteindex[sample]=note-4*OCTAVE;
-    return finetune;
+    return local_finetune;
 }
 
 /*========== Order stuff */

libmikmod/playercode/mplayer.c

 	}
 }
 
-void pt_UpdateVoices(MODULE *mod, int max_volume)
+static void pt_UpdateVoices(MODULE *mod, int max_volume)
 {
 	SWORD envpan,envvol,envpit,channel;
 	UWORD playperiod;
 }
 
 /* Handles new notes or instruments */
-void pt_Notes(MODULE *mod)
+static void pt_Notes(MODULE *mod)
 {
 	SWORD channel;
 	MP_CONTROL *a;
 }
 
 /* Handles effects */
-void pt_EffectsPass1(MODULE *mod)
+static void pt_EffectsPass1(MODULE *mod)
 {
 	SWORD channel;
 	MP_CONTROL *a;
 }
 
 /* NNA management */
-void pt_NNA(MODULE *mod)
+static void pt_NNA(MODULE *mod)
 {
 	SWORD channel;
 	MP_CONTROL *a;
 }
 
 /* Setup module and NNA voices */
-void pt_SetupVoices(MODULE *mod)
+static void pt_SetupVoices(MODULE *mod)
 {
 	SWORD channel;
 	MP_CONTROL *a;
 }
 
 /* second effect pass */
-void pt_EffectsPass2(MODULE *mod)
+static void pt_EffectsPass2(MODULE *mod)
 {
 	SWORD channel;
 	MP_CONTROL *a;

libmikmod/playercode/mwav.c

 	UWORD nFormatSpecific;
 } WAV;
 
-BOOL isWaveFile(MREADER* reader)
+static BOOL isWaveFile(MREADER* reader)
 {
 	WAV wh;
 
 	return 1;
 }
 
-SAMPLE* Sample_LoadGeneric_internal_wav(MREADER* reader)
+static SAMPLE* Sample_LoadGeneric_internal_wav(MREADER* reader)
 {
 	SAMPLE *si=NULL;
 	WAV wh;
 	return si;
 }
 
-SAMPLE* Sample_LoadRawGeneric_internal(MREADER* reader, ULONG rate, ULONG channel, ULONG flags)
+static SAMPLE* Sample_LoadRawGeneric_internal(MREADER* reader, ULONG rate, ULONG channel, ULONG flags)
 {
 	SAMPLE *si;
 	long len;
 	return si;
 }
 
-SAMPLE* Sample_LoadGeneric_internal(MREADER* reader, const char *options)
+static SAMPLE* Sample_LoadGeneric_internal(MREADER* reader, const char *options)
 {
 	if (isWaveFile(reader)) {
 		return Sample_LoadGeneric_internal_wav(reader);

libmikmod/playercode/sloader.c

 }
 
 /* unpack a 8bit IT packed sample */
-static BOOL read_itcompr8(ITPACK* status,MREADER *reader,SWORD *sl_buffer,UWORD count,UWORD* incnt)
+static BOOL read_itcompr8(ITPACK* status, MREADER *reader,
+                          SWORD *local_sl_buf, UWORD count,
+                          UWORD* incnt)
 {
-	SWORD *dest=sl_buffer,*end=sl_buffer+count;
+	SWORD *dest=local_sl_buf,*end=local_sl_buf+count;
 	UWORD x,y,needbits,havebits,new_count=0;
 	UWORD bits = status->bits;
 	UWORD bufbits = status->bufbits;
 	status->bufbits = bufbits;
 	status->last = last;
 	status->buf = buf;
-	return (dest-sl_buffer);
+	return (dest-local_sl_buf);
 }
 
 /* unpack a 16bit IT packed sample */
-static BOOL read_itcompr16(ITPACK *status,MREADER *reader,SWORD *sl_buffer,UWORD count,UWORD* incnt)
+static BOOL read_itcompr16(ITPACK *status,MREADER *reader,SWORD *local_sl_buf,UWORD count,UWORD* incnt)
 {
-	SWORD *dest=sl_buffer,*end=sl_buffer+count;
+	SWORD *dest=local_sl_buf,*end=local_sl_buf+count;
 	SLONG x,y,needbits,havebits,new_count=0;
 	UWORD bits = status->bits;
 	UWORD bufbits = status->bufbits;
 	status->bufbits = bufbits;
 	status->last = last;
 	status->buf = buf;
-	return (dest-sl_buffer);
+	return (dest-local_sl_buf);
 }
 
 static BOOL SL_LoadInternal(void* buffer,UWORD infmt,UWORD outfmt,int scalefactor,ULONG length,MREADER* reader,BOOL dither)