Hopefully fixed the last of the C variable declaration problems which caused compile failures with Visual Studio.
authorSam Lantinga <slouken@libsdl.org>
Mon, 11 Feb 2013 18:28:05 -0800
changeset 6854 7b1d78036e84
parent 6853 4f26c9dfe50f
child 6856 245a50142ffb
Hopefully fixed the last of the C variable declaration problems which caused compile failures with Visual Studio.
src/joystick/SDL_gamecontroller.c
--- a/src/joystick/SDL_gamecontroller.c	Mon Feb 11 18:22:32 2013 -0800
+++ b/src/joystick/SDL_gamecontroller.c	Mon Feb 11 18:28:05 2013 -0800
@@ -423,9 +423,10 @@
 
 		if ( button != SDL_CONTROLLER_BUTTON_INVALID )
 		{
+            int ridx;
 			pMapping->hatasbutton[ button ].hat = hat;
 			pMapping->hatasbutton[ button ].mask = mask;
-			int ridx = (hat << 4) | mask;
+			ridx = (hat << 4) | mask;
 			pMapping->rhatasbutton[ ridx ] = button;
 		}
 		else if ( axis != SDL_CONTROLLER_AXIS_INVALID )
@@ -1071,13 +1072,13 @@
 int
 SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button, Uint8 state)
 {
-    if ( button == SDL_CONTROLLER_BUTTON_INVALID )
-        return (0);
-
     int posted;
 #if !SDL_EVENTS_DISABLED
 	SDL_Event event;
 
+    if ( button == SDL_CONTROLLER_BUTTON_INVALID )
+        return (0);
+
     switch (state) {
     case SDL_PRESSED:
         event.type = SDL_CONTROLLERBUTTONDOWN;