From 5ef567877af73722e84eeb157bad25621ecf5f9b Mon Sep 17 00:00:00 2001 From: Meep-Eep Date: Sat, 23 Jan 2010 22:14:33 +0000 Subject: [PATCH] Fix warnings. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3512 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/libs/input/sdl/vcontrol.c | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sc2/src/libs/input/sdl/vcontrol.c b/sc2/src/libs/input/sdl/vcontrol.c index 302c3ba6c..089cb1132 100644 --- a/sc2/src/libs/input/sdl/vcontrol.c +++ b/sc2/src/libs/input/sdl/vcontrol.c @@ -66,8 +66,8 @@ static joystick *joysticks; #endif /* HAVE_JOYSTICK */ -static int joycount; -static int num_sdl_keys = 0; +static unsigned int joycount; +static unsigned int num_sdl_keys = 0; static keybinding **bindings = NULL; static keypool *pool; @@ -112,7 +112,7 @@ create_joystick (int index) { SDL_Joystick *stick; int axes, buttons, hats; - if (index >= joycount) + if ((unsigned int) index >= joycount) { log_add (log_Warning, "VControl warning: Tried to open a non-existent joystick!"); return; @@ -183,7 +183,7 @@ destroy_joystick (int index) static void key_init (void) { - int i; + unsigned int i; pool = allocate_key_chunk (); (void)SDL_GetKeyState (&num_sdl_keys); bindings = (keybinding **) HMalloc (sizeof (keybinding *) * num_sdl_keys); @@ -219,7 +219,7 @@ key_init (void) static void key_uninit (void) { - int i; + unsigned int i; free_key_pool (pool); for (i = 0; i < num_sdl_keys; i++) bindings[i] = NULL; @@ -250,7 +250,7 @@ int VControl_SetJoyThreshold (int port, int threshold) { #ifdef HAVE_JOYSTICK - if (port >= 0 && port < joycount) + if (port >= 0 && (unsigned int) port < joycount) { joysticks[port].threshold = threshold; return 0; @@ -489,7 +489,7 @@ VControl_RemoveGestureBinding (VCONTROL_GESTURE *g, int *target) int VControl_AddKeyBinding (SDLKey symbol, int *target) { - if ((symbol < 0) || (symbol >= num_sdl_keys)) { + if ((unsigned int) symbol >= num_sdl_keys) { log_add (log_Warning, "VControl: Illegal key index %d", symbol); return -1; } @@ -500,7 +500,7 @@ VControl_AddKeyBinding (SDLKey symbol, int *target) void VControl_RemoveKeyBinding (SDLKey symbol, int *target) { - if ((symbol < 0) || (symbol >= num_sdl_keys)) { + if ((unsigned int) symbol >= num_sdl_keys) { log_add (log_Warning, "VControl: Illegal key index %d", symbol); return; } @@ -511,7 +511,7 @@ int VControl_AddJoyAxisBinding (int port, int axis, int polarity, int *target) { #ifdef HAVE_JOYSTICK - if (port >= 0 && port < joycount) + if (port >= 0 && (unsigned int) port < joycount) { joystick *j = &joysticks[port]; if (!(j->stick)) @@ -556,7 +556,7 @@ void VControl_RemoveJoyAxisBinding (int port, int axis, int polarity, int *target) { #ifdef HAVE_JOYSTICK - if (port >= 0 && port < joycount) + if (port >= 0 && (unsigned int) port < joycount) { joystick *j = &joysticks[port]; if (!(j->stick)) @@ -597,7 +597,7 @@ int VControl_AddJoyButtonBinding (int port, int button, int *target) { #ifdef HAVE_JOYSTICK - if (port >= 0 && port < joycount) + if (port >= 0 && (unsigned int) port < joycount) { joystick *j = &joysticks[port]; if (!(j->stick)) @@ -629,7 +629,7 @@ void VControl_RemoveJoyButtonBinding (int port, int button, int *target) { #ifdef HAVE_JOYSTICK - if (port >= 0 && port < joycount) + if (port >= 0 && (unsigned int) port < joycount) { joystick *j = &joysticks[port]; if (!(j->stick)) @@ -658,7 +658,7 @@ int VControl_AddJoyHatBinding (int port, int which, Uint8 dir, int *target) { #ifdef HAVE_JOYSTICK - if (port >= 0 && port < joycount) + if (port >= 0 && (unsigned int) port < joycount) { joystick *j = &joysticks[port]; if (!(j->stick)) @@ -711,7 +711,7 @@ void VControl_RemoveJoyHatBinding (int port, int which, Uint8 dir, int *target) { #ifdef HAVE_JOYSTICK - if (port >= 0 && port < joycount) + if (port >= 0 && (unsigned int) port < joycount) { joystick *j = &joysticks[port]; if (!(j->stick)) @@ -766,7 +766,7 @@ VControl_RemoveAllBindings (void) void VControl_ProcessKeyDown (SDLKey symbol) { - if ((symbol < 0) || (symbol >= num_sdl_keys)) { + if (symbol >= num_sdl_keys) { log_add (log_Warning, "VControl: Got unknown key index %d", symbol); return; } @@ -777,7 +777,7 @@ VControl_ProcessKeyDown (SDLKey symbol) void VControl_ProcessKeyUp (SDLKey symbol) { - if ((symbol < 0) || (symbol >= num_sdl_keys)) + if (symbol >= num_sdl_keys) return; deactivate (bindings[symbol]);