Commits

Shlomi Fish  committed ba692a9

Got rid of more warnings.

This time after the extra gcc warnings are enabled with the "debug" profile.

  • Participants
  • Parent commits ff70077

Comments (0)

Files changed (8)

File libmikmod/CMakeLists.txt

 SET (IS_DEBUG "")
 IF ((CMAKE_BUILD_TYPE STREQUAL debug) OR (CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo))
     SET (IS_DEBUG 1)
-    LIST(APPEND COMPILER_FLAGS_TO_CHECK "-DFCS_COMPILE_DEBUG_FUNCTIONS=1")
-    LIST(APPEND COMPILER_FLAGS_TO_CHECK "-DDEBUG=1")
 
     # Removed these flags because they emitted spurious warnings, which were of
     # no use to us:

File libmikmod/drivers/drv_aiff.c

         mySign = 0;
     }
 
-    if (theValue == 0)
+    if (theValue < 1e-18)
     {
         myExponent = 0;
         myHiMant = 0;

File libmikmod/include/mikmod_internals.h

 typedef __int64		SLONGLONG;
 #elif defined(WIN32) && !defined(__MWERKS__)
 typedef LONGLONG	SLONGLONG;
-#elif macintosh && !TYPE_LONGLONG
+#elif defined(macintosh) && !TYPE_LONGLONG
 #include <Types.h>
 typedef SInt64	    SLONGLONG;
 #else
 #define _mm_read_UBYTE(x) (UBYTE)x->Get(x)
 #define _mm_skip_BYTE(x)  (void)x->Get(x)
 
-#define _mm_write_SBYTES(x,y,z) z->Write(z,(void *)x,y)
-#define _mm_write_UBYTES(x,y,z) z->Write(z,(void *)x,y)
+#define _mm_write_SBYTES(x,y,z) z->Write(z,(const void *)x,y)
+#define _mm_write_UBYTES(x,y,z) z->Write(z,(const void *)x,y)
 #define _mm_read_SBYTES(x,y,z)  z->Read(z,(void *)x,y)
 #define _mm_read_UBYTES(x,y,z)  z->Read(z,(void *)x,y)
 
 extern void _mm_iobase_revert(MREADER*);
 extern FILE *_mm_fopen(CHAR*,CHAR*);
 extern int	_mm_fclose(FILE *);
-extern void _mm_write_string(CHAR*,MWRITER*);
+extern void _mm_write_string(const CHAR*,MWRITER*);
 extern int  _mm_read_string (CHAR*,int,MREADER*);
 
 extern SWORD _mm_read_M_SWORD(MREADER*);
 /*========== Loaders */
 
 typedef struct MLOADER {
-struct MLOADER* next;
-	CHAR*       type;
-	CHAR*       version;
+    struct MLOADER* next;
+	const CHAR*       type;
+	const CHAR*       version;
 	BOOL        (*Init)(void);
 	BOOL        (*Test)(void);
 	BOOL        (*Load)(BOOL);
 extern BOOL   AllocInstruments(void);
 extern BOOL   AllocSamples(void);
 extern CHAR*  DupStr(CHAR*,UWORD,BOOL);
-extern CHAR*  StrDup(CHAR *s);
+extern CHAR*  StrDup(const CHAR *s);
 
 /* loader utility functions */
 extern int*   AllocLinear(void);
 extern void unsignedtoulaw(char *,int);
 
 /* Parameter extraction helper */
-extern CHAR  *MD_GetAtom(CHAR*,CHAR*,BOOL);
+extern CHAR  *MD_GetAtom(const CHAR*, const CHAR*, BOOL);
 
 /* Internal software mixer stuff */
 extern void VC_SetupPointers(void);
 
 #if defined(unix) || defined(__APPLE__) && defined(__MACH__)
 /* POSIX helper functions */
-extern BOOL MD_Access(CHAR *);
+extern BOOL MD_Access(const CHAR *);
 extern BOOL MD_DropPrivileges(void);
 #endif
 

File libmikmod/loaders/load_669.c

 static	S69HEADER* mh=NULL;
 
 /* file type identification */
-static	CHAR* S69_Version[]={
+static	const CHAR* S69_Version[]={
 	"Composer 669",
 	"Extended 669"
 };
 
 /*========== Loader code */
 
-BOOL S69_Test(void)
+static BOOL S69_Test(void)
 {
 	UBYTE buf[0x80];
 
 	return 1;
 }
 
-BOOL S69_Init(void)
+static BOOL S69_Init(void)
 {
 	if(!(s69pat=(S69NOTE *)MikMod_malloc(64*8*sizeof(S69NOTE)))) return 0;
 	if(!(mh=(S69HEADER *)MikMod_malloc(sizeof(S69HEADER)))) return 0;
 	return 1;
 }
 
-void S69_Cleanup(void)
+static void S69_Cleanup(void)
 {
 	MikMod_free(s69pat);
 	MikMod_free(mh);
 	return 1;
 }
 
-BOOL S69_Load(BOOL curious)
+static BOOL S69_Load(BOOL curious)
 {
 	int i;
 	SAMPLE *current;
 	return 1;
 }
 
-CHAR *S69_LoadTitle(void)
+static CHAR *S69_LoadTitle(void)
 {
 	CHAR s[36];
 

File libmikmod/loaders/load_amf.c

 
 /*========== Loader code */
 
-BOOL AMF_Test(void)
+static BOOL AMF_Test(void)
 {
 	UBYTE id[3],ver;
 
 	return 0;
 }
 
-BOOL AMF_Init(void)
+static BOOL AMF_Init(void)
 {
 	if(!(mh=(AMFHEADER*)MikMod_malloc(sizeof(AMFHEADER)))) return 0;
 	if(!(track=(AMFNOTE*)MikMod_calloc(64,sizeof(AMFNOTE)))) return 0;
 	return 1;
 }
 
-void AMF_Cleanup(void)
+static void AMF_Cleanup(void)
 {
 	MikMod_free(mh);
 	MikMod_free(track);
 }
 
-static BOOL AMF_UnpackTrack(MREADER* modreader)
+static BOOL AMF_UnpackTrack(MREADER* local_modreader)
 {
 	ULONG tracksize;
 	UBYTE row,cmd;
 	memset(track,0,64*sizeof(AMFNOTE));
 
 	/* read packed track */
-	if (modreader) {
-		tracksize=_mm_read_I_UWORD(modreader);
-		tracksize+=((ULONG)_mm_read_UBYTE(modreader))<<16;
+	if (local_modreader) {
+		tracksize=_mm_read_I_UWORD(local_modreader);
+		tracksize+=((ULONG)_mm_read_UBYTE(local_modreader))<<16;
 		if (tracksize)
 			while(tracksize--) {
-				row=_mm_read_UBYTE(modreader);
-				cmd=_mm_read_UBYTE(modreader);
-				arg=_mm_read_SBYTE(modreader);
+				row=_mm_read_UBYTE(local_modreader);
+				cmd=_mm_read_UBYTE(local_modreader);
+				arg=_mm_read_SBYTE(local_modreader);
 				/* unexpected end of track */
 				if(!tracksize) {
 					if((row==0xff)&&(cmd==0xff)&&(arg==-1))
 	return UniDup();
 }
 
-BOOL AMF_Load(BOOL curious)
+static BOOL AMF_Load(BOOL curious)
 {
 	int t,u,realtrackcnt,realsmpcnt,defaultpanning;
 	AMFSAMPLE s;
 	return 1;
 }
 
-CHAR *AMF_LoadTitle(void)
+static CHAR *AMF_LoadTitle(void)
 {
 	CHAR s[32];
 

File libmikmod/mmio/mmio.c

 	return ftell(((MFILEWRITER*)writer)->file);
 }
 
-static BOOL _mm_FileWriter_Write(MWRITER* writer,void* ptr,size_t size)
+static BOOL _mm_FileWriter_Write(MWRITER* writer, const void* ptr, size_t size)
 {
 	return (fwrite(ptr,size,1,((MFILEWRITER*)writer)->file)==size);
 }
 	pos = ((MMEMREADER*)reader)->pos;
 	((MMEMREADER*)reader)->pos++;
 
-	return ((unsigned char*)(((MMEMREADER*)reader)->buffer))[pos];
+	return ((const unsigned char*)(((MMEMREADER*)reader)->buffer))[pos];
 }
 
 static BOOL _mm_MemReader_Seek(MREADER* reader,long offset,int whence)
 
 /*========== Write functions */
 
-void _mm_write_string(CHAR* data,MWRITER* writer)
+void _mm_write_string(const CHAR* data,MWRITER* writer)
 {
 	if(data)
 		_mm_write_UBYTES(data,strlen(data),writer);

File libmikmod/playercode/mdriver.c

    criticals).
 
    Returns the voice that the sound is being played on.                       */
-SBYTE Sample_Play_internal(SAMPLE *s,ULONG start,UBYTE flags)
+static SBYTE Sample_Play_internal(SAMPLE *s,ULONG start,UBYTE flags)
 {
 	int orig=sfxpool;/* for cases where all channels are critical */
 	int c;
 
 /*========== Parameter extraction helper */
 
-CHAR *MD_GetAtom(CHAR *atomname,CHAR *cmdline,BOOL implicit)
+CHAR *MD_GetAtom(const CHAR *atomname, const CHAR *cmdline, BOOL implicit)
 {
 	CHAR *ret=NULL;
 
    reasonable. Returns 1 if it is safe to rewrite the file, 0 otherwise.
    The goal is to prevent a setuid root libmikmod application from overriding
    files like /etc/passwd with digital sound... */
-BOOL MD_Access(CHAR *filename)
+BOOL MD_Access(const CHAR * filename)
 {
 	struct stat buf;
 

File libmikmod/playercode/mloader.c

 	return d;
 }
 
-CHAR *StrDup(CHAR *s)
+CHAR *StrDup(const CHAR *s)
 {
 	size_t l = strlen(s) + 1;
 	CHAR *d = MikMod_malloc(l);