Fixed constness of joystick data.
diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h
index 21f2550..691d4ed 100644
--- a/include/GLFW/glfw3.h
+++ b/include/GLFW/glfw3.h
@@ -1973,7 +1973,7 @@
*
* @ingroup input
*/
-GLFWAPI float* glfwGetJoystickAxes(int joy, int* count);
+GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
/*! @brief Returns the values of all buttons of the specified joystick.
* @param[in] joy The joystick to query.
@@ -1985,7 +1985,7 @@
*
* @ingroup input
*/
-GLFWAPI unsigned char* glfwGetJoystickButtons(int joy, int* count);
+GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
/*! @brief Returns the name of the specified joystick.
*
diff --git a/src/cocoa_joystick.m b/src/cocoa_joystick.m
index 9795ff9..63d253d 100644
--- a/src/cocoa_joystick.m
+++ b/src/cocoa_joystick.m
@@ -463,7 +463,7 @@
return _glfw.ns.joysticks[joy].present;
}
-float* _glfwPlatformGetJoystickAxes(int joy, int* count)
+const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{
_GLFWjoy* joystick = _glfw.ns.joysticks + joy;
@@ -476,7 +476,7 @@
return joystick->axes;
}
-unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
+const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
{
_GLFWjoy* joystick = _glfw.ns.joysticks + joy;
diff --git a/src/internal.h b/src/internal.h
index eb5d45c..051b149 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -418,12 +418,12 @@
/*! @copydoc glfwGetJoystickAxes
* @ingroup platform
*/
-float* _glfwPlatformGetJoystickAxes(int joy, int* count);
+const float* _glfwPlatformGetJoystickAxes(int joy, int* count);
/*! @copydoc glfwGetJoystickButtons
* @ingroup platform
*/
-unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count);
+const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count);
/*! @copydoc glfwGetJoystickName
* @ingroup platform
diff --git a/src/joystick.c b/src/joystick.c
index 8a8ee73..919614c 100644
--- a/src/joystick.c
+++ b/src/joystick.c
@@ -48,7 +48,7 @@
return _glfwPlatformJoystickPresent(joy);
}
-GLFWAPI float* glfwGetJoystickAxes(int joy, int* count)
+GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
{
*count = 0;
@@ -63,7 +63,7 @@
return _glfwPlatformGetJoystickAxes(joy, count);
}
-GLFWAPI unsigned char* glfwGetJoystickButtons(int joy, int* count)
+GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
{
*count = 0;
diff --git a/src/win32_joystick.c b/src/win32_joystick.c
index 8a69fcc..fff747d 100644
--- a/src/win32_joystick.c
+++ b/src/win32_joystick.c
@@ -84,7 +84,7 @@
return GL_TRUE;
}
-float* _glfwPlatformGetJoystickAxes(int joy, int* count)
+const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{
JOYCAPS jc;
JOYINFOEX ji;
@@ -117,7 +117,7 @@
return axes;
}
-unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
+const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
{
JOYCAPS jc;
JOYINFOEX ji;
diff --git a/src/x11_joystick.c b/src/x11_joystick.c
index 17edf8a..7e5aad3 100644
--- a/src/x11_joystick.c
+++ b/src/x11_joystick.c
@@ -241,7 +241,7 @@
return _glfw.x11.joystick[joy].present;
}
-float* _glfwPlatformGetJoystickAxes(int joy, int* count)
+const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
{
pollJoystickEvents();
@@ -252,7 +252,7 @@
return _glfw.x11.joystick[joy].axes;
}
-unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
+const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
{
pollJoystickEvents();
diff --git a/tests/joysticks.c b/tests/joysticks.c
index 61f2764..cd49cd4 100644
--- a/tests/joysticks.c
+++ b/tests/joysticks.c
@@ -138,8 +138,8 @@
if (glfwJoystickPresent(GLFW_JOYSTICK_1 + i))
{
- float* axes;
- unsigned char* buttons;
+ const float* axes;
+ const unsigned char* buttons;
int axis_count, button_count;
free(j->name);