From 53fab2f16bfa3eaeac36eb6b54cd728bd4afcf41 Mon Sep 17 00:00:00 2001
From: Camilla Berglund <elmindreda@elmindreda.org>
Date: Tue, 17 Apr 2012 17:55:11 +0200
Subject: [PATCH] Fixed VC++ errors.

---
 src/win32_joystick.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
 mode change 100644 => 100755 src/win32_joystick.c

diff --git a/src/win32_joystick.c b/src/win32_joystick.c
old mode 100644
new mode 100755
index 9fad3002..c27218db
--- a/src/win32_joystick.c
+++ b/src/win32_joystick.c
@@ -80,6 +80,7 @@ static float calcJoystickPos(DWORD pos, DWORD min, DWORD max)
 int _glfwPlatformGetJoystickParam(int joy, int param)
 {
     JOYCAPS jc;
+    int hats;
 
     if (!isJoystickPresent(joy))
         return 0;
@@ -91,7 +92,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
     // Get joystick capabilities
     _glfw_joyGetDevCaps(joy - GLFW_JOYSTICK_1, &jc, sizeof(JOYCAPS));
 
-    const int hats = (jc.wCaps & JOYCAPS_HASPOV) && (jc.wCaps & JOYCAPS_POV4DIR) ? 1 : 0;
+    hats = (jc.wCaps & JOYCAPS_HASPOV) && (jc.wCaps & JOYCAPS_POV4DIR) ? 1 : 0;
 
     switch (param)
     {
@@ -166,7 +167,10 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
 {
     JOYCAPS jc;
     JOYINFOEX ji;
-    int button;
+    int button, hats;
+
+    // Bit fields of button presses for each direction, including nil
+    const int directions[9] = { 1, 3, 2, 6, 4, 12, 8, 9, 0 };
 
     if (!isJoystickPresent(joy))
         return 0;
@@ -187,11 +191,11 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
     }
 
     // Virtual buttons - Inject data from hats
-    // Each hat is exposed as 4 buttons which exposes 8 directions with concurrent button presses
-    // (Note: This API only exposes one hat)
+    // Each hat is exposed as 4 buttons which exposes 8 directions with
+    // concurrent button presses
+    // NOTE: this API exposes only one hat
 
-    const int hats = (jc.wCaps & JOYCAPS_HASPOV) && (jc.wCaps & JOYCAPS_POV4DIR) ? 1 : 0;
-    const int directions[9] = { 1, 3, 2, 6, 4, 12, 8, 9, 0 }; // Bit fields of button presses for each direction, including nil
+    hats = (jc.wCaps & JOYCAPS_HASPOV) && (jc.wCaps & JOYCAPS_POV4DIR) ? 1 : 0;
 
     if (hats > 0)
     {