Fix various warnings for uninitialized or unused variables and functions SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Fri, 26 Aug 2011 14:37:39 +0200
branchSDL-1.2
changeset 5649 02ab15cfa992
parent 5648 0d28cf898765
child 5651 abba6814a65c
Fix various warnings for uninitialized or unused variables and functions
src/audio/mint/SDL_mintaudio_gsxb.c
src/audio/mint/SDL_mintaudio_mcsn.c
src/audio/mint/SDL_mintaudio_stfa.c
src/audio/mint/SDL_mintaudio_xbios.c
src/video/ataricommon/SDL_atarigl.c
src/video/ataricommon/SDL_biosevents.c
src/video/ataricommon/SDL_gemdosevents.c
src/video/ataricommon/SDL_ikbdevents.c
src/video/gem/SDL_gemevents.c
src/video/gem/SDL_gemmouse.c
src/video/gem/SDL_gemvideo.c
src/video/xbios/SDL_xbios.c
src/video/xbios/SDL_xbios_tveille.c
--- a/src/audio/mint/SDL_mintaudio_gsxb.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/audio/mint/SDL_mintaudio_gsxb.c	Fri Aug 26 14:37:39 2011 +0200
@@ -199,7 +199,7 @@
 
 static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
 {
-	long snd_format;
+	long snd_format = 0;
 	int i, resolution, format_signed, format_bigendian;
     Uint16 test_format = SDL_FirstAudioFormat(spec->format);
     int valid_datatype = 0;
--- a/src/audio/mint/SDL_mintaudio_mcsn.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/audio/mint/SDL_mintaudio_mcsn.c	Fri Aug 26 14:37:39 2011 +0200
@@ -112,10 +112,11 @@
 	}
 
 	/* Cookie MCSN present ? */
-	if (Getcookie(C_McSn, (long *) &cookie_mcsn) != C_FOUND) {
+	if (Getcookie(C_McSn, &dummy) != C_FOUND) {
 		DEBUG_PRINT((DEBUG_NAME "no MCSN audio\n"));
 		return(0);
 	}
+	cookie_mcsn = (cookie_mcsn_t *) dummy;
 
 	/* Check if interrupt at end of replay */
 	if (cookie_mcsn->pint == 0) {
--- a/src/audio/mint/SDL_mintaudio_stfa.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/audio/mint/SDL_mintaudio_stfa.c	Fri Aug 26 14:37:39 2011 +0200
@@ -84,6 +84,7 @@
 
 static int Audio_Available(void)
 {
+	unsigned long dummy;
 	const char *envr = SDL_getenv("SDL_AUDIODRIVER");
 
 	/* Check if user asked a different audio driver */
@@ -103,10 +104,11 @@
 	}
 
 	/* Cookie STFA present ? */
-	if (Getcookie(C_STFA, (long *) &cookie_stfa) != C_FOUND) {
+	if (Getcookie(C_STFA, &dummy) != C_FOUND) {
 		DEBUG_PRINT((DEBUG_NAME "no STFA audio\n"));
 		return(0);
 	}
+	cookie_stfa = (cookie_stfa_t *) dummy;
 
 	SDL_MintAudio_stfa = cookie_stfa;
 
--- a/src/audio/mint/SDL_mintaudio_xbios.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/audio/mint/SDL_mintaudio_xbios.c	Fri Aug 26 14:37:39 2011 +0200
@@ -79,7 +79,7 @@
 
 static int Audio_Available(void)
 {
-	unsigned long dummy;
+/*	unsigned long dummy;*/
 	const char *envr = SDL_getenv("SDL_AUDIODRIVER");
 
 	/*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);*/
@@ -104,7 +104,7 @@
 	/* Check if we have 16 bits audio */
 	if ((cookie_snd & SND_16BIT)==0) {
 		DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n"));
-	    return(0);
+		return(0);
 	}
 
 	/* Check if audio is lockable */
@@ -334,7 +334,6 @@
 static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
 {
 	int i;
-	Uint32 extclock;
 
 	DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff));
 	DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0)));
--- a/src/video/ataricommon/SDL_atarigl.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/video/ataricommon/SDL_atarigl.c	Fri Aug 26 14:37:39 2011 +0200
@@ -48,9 +48,9 @@
 
 /*--- Functions prototypes ---*/
 
+#if SDL_VIDEO_OPENGL
 static void SDL_AtariGL_UnloadLibrary(_THIS);
 
-#if SDL_VIDEO_OPENGL
 static void CopyShadowNull(_THIS, SDL_Surface *surface);
 static void CopyShadowDirect(_THIS, SDL_Surface *surface);
 static void CopyShadowRGBTo555(_THIS, SDL_Surface *surface);
@@ -389,9 +389,9 @@
 
 /*--- Private functions ---*/
 
+#if SDL_VIDEO_OPENGL
 static void SDL_AtariGL_UnloadLibrary(_THIS)
 {
-#if SDL_VIDEO_OPENGL
 	if (this->gl_config.dll_handle) {
 		SDL_UnloadObject(this->gl_config.dll_handle);
 		this->gl_config.dll_handle = NULL;
@@ -399,12 +399,10 @@
 		/* Restore pointers to static library */
 		SDL_AtariGL_InitPointers(this);
 	}
-#endif
 }
 
 /*--- Creation of an OpenGL context using new/old functions ---*/
 
-#if SDL_VIDEO_OPENGL
 static int InitNew(_THIS, SDL_Surface *current)
 {
 	GLenum osmesa_format;
--- a/src/video/ataricommon/SDL_biosevents.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/video/ataricommon/SDL_biosevents.c	Fri Aug 26 14:37:39 2011 +0200
@@ -47,8 +47,8 @@
 
 void AtariBios_InitOSKeymap(_THIS)
 {
-	int i, vectors_mask;
-	unsigned long dummy;
+	int vectors_mask;
+/*	unsigned long dummy;*/
 
 	SDL_memset(bios_currentkeyboard, 0, sizeof(bios_currentkeyboard));
 	SDL_memset(bios_previouskeyboard, 0, sizeof(bios_previouskeyboard));
--- a/src/video/ataricommon/SDL_gemdosevents.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/video/ataricommon/SDL_gemdosevents.c	Fri Aug 26 14:37:39 2011 +0200
@@ -56,8 +56,8 @@
 
 void AtariGemdos_InitOSKeymap(_THIS)
 {
-	int i, vectors_mask;
-	unsigned long dummy;
+	int vectors_mask;
+/*	unsigned long dummy;*/
 
 	SDL_memset(gemdos_currentkeyboard, 0, sizeof(gemdos_currentkeyboard));
 	SDL_memset(gemdos_previouskeyboard, 0, sizeof(gemdos_previouskeyboard));
--- a/src/video/ataricommon/SDL_ikbdevents.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/video/ataricommon/SDL_ikbdevents.c	Fri Aug 26 14:37:39 2011 +0200
@@ -45,9 +45,7 @@
 
 void AtariIkbd_InitOSKeymap(_THIS)
 {
-	int i;
-
-	SDL_memset(SDL_AtariIkbd_keyboard, KEY_UNDEFINED, sizeof(SDL_AtariIkbd_keyboard));
+	SDL_memset((void *) SDL_AtariIkbd_keyboard, KEY_UNDEFINED, sizeof(SDL_AtariIkbd_keyboard));
 
 	/* Now install our handler */
 	SDL_AtariIkbd_mouseb = SDL_AtariIkbd_mousex = SDL_AtariIkbd_mousey = 0;
@@ -72,7 +70,7 @@
 
 void AtariIkbd_PumpEvents(_THIS)
 {
-	int i, specialkeys;
+	int i;
 	SDL_keysym keysym;
 
 	/*--- Send keyboard events ---*/
--- a/src/video/gem/SDL_gemevents.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/video/gem/SDL_gemevents.c	Fri Aug 26 14:37:39 2011 +0200
@@ -36,6 +36,7 @@
 #include "../../events/SDL_events_c.h"
 #include "SDL_gemvideo.h"
 #include "SDL_gemevents_c.h"
+#include "SDL_gemmouse_c.h"
 #include "../ataricommon/SDL_atarikeys.h"	/* for keyboard scancodes */
 #include "../ataricommon/SDL_atarievents_c.h"
 #include "../ataricommon/SDL_xbiosevents_c.h"
--- a/src/video/gem/SDL_gemmouse.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/video/gem/SDL_gemmouse.c	Fri Aug 26 14:37:39 2011 +0200
@@ -34,6 +34,7 @@
 #include "../SDL_cursor_c.h"
 #include "SDL_gemmouse_c.h"
 #include "SDL_gemvideo.h"
+#include "../ataricommon/SDL_xbiosevents_c.h"
 
 /* Defines */
 
--- a/src/video/gem/SDL_gemvideo.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/video/gem/SDL_gemvideo.c	Fri Aug 26 14:37:39 2011 +0200
@@ -129,7 +129,7 @@
 {
 	SDL_VideoDevice *device;
 	int vectors_mask;
-	unsigned long dummy;
+/*	unsigned long dummy;*/
 
 	/* Initialize all variables that we clean on shutdown */
 	device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
--- a/src/video/xbios/SDL_xbios.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/video/xbios/SDL_xbios.c	Fri Aug 26 14:37:39 2011 +0200
@@ -138,7 +138,7 @@
 
 static int XBIOS_Available(void)
 {
-	unsigned long cookie_vdo, cookie_mil, cookie_hade, cookie_scpn;
+	unsigned long cookie_vdo, /*cookie_mil,*/ cookie_hade, cookie_scpn;
 	unsigned long cookie_fvdi;
 	const char *envr = SDL_getenv("SDL_VIDEODRIVER");
 
@@ -361,8 +361,7 @@
 
 static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
 {
-	int i,j8,j16;
-	xbiosmode_t *current_mode;
+	int i;
 	unsigned long cookie_blow, cookie_scpn, cookie_cnts;
 
 	/* Initialize all variables that we clean on shutdown */
@@ -1101,7 +1100,7 @@
 
 	/* Restore screensavers */
 	if (SDL_XBIOS_TveillePresent(this)) {
-		SDL_XBIOS_TveilleRestore(this);
+		SDL_XBIOS_TveilleEnable(this);
 	}
 }
 
--- a/src/video/xbios/SDL_xbios_tveille.c	Fri Aug 26 03:39:54 2011 -0400
+++ b/src/video/xbios/SDL_xbios_tveille.c	Fri Aug 26 14:37:39 2011 +0200
@@ -32,21 +32,32 @@
 #include "SDL_xbios.h"
 #include "SDL_xbios_tveille.h"
 
-static tveille_t *cookie_veil;
+static tveille_t *cookie_veil = NULL;
 static int status;
 
 int SDL_XBIOS_TveillePresent(_THIS)
 {
-	return (Getcookie(C_VeiL, (unsigned long *)&cookie_veil) == C_FOUND);
+	unsigned long dummy;
+
+	cookie_veil = NULL;
+	if (Getcookie(C_VeiL, &dummy) == C_FOUND) {
+		cookie_veil = (tveille_t *) dummy;
+	}
+
+	return (cookie_veil != NULL);
 }
 
 void SDL_XBIOS_TveilleDisable(_THIS)
 {
-	status = cookie_veil->enabled;
-	cookie_veil->enabled = 0xff;
+	if (cookie_veil) {
+		status = cookie_veil->enabled;
+		cookie_veil->enabled = 0xff;
+	}
 }
 
-void SDL_XBIOS_TveilleRestore(_THIS)
+void SDL_XBIOS_TveilleEnable(_THIS)
 {
-	cookie_veil->enabled = status;
+	if (cookie_veil) {
+		cookie_veil->enabled = status;
+	}
 }