added null ptr check
[mesa.git] / src / glut / glx / glut_input.c
index 007883d6b6e25557d4f0fc3253f84846e270af6f..a76ff9a435ecc06fe6588dbbf9f367a8b0a7ae6a 100644 (file)
@@ -5,6 +5,10 @@
    and is provided without guarantee or warrantee expressed or
    implied. This program is -not- in the public domain. */
 
+#ifdef __VMS
+#include <GL/vms_x_fix.h>
+#endif
+
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -19,6 +23,9 @@
 #endif
 #include <X11/Xutil.h>
 #else
+#ifdef __MINGW32__
+#include <GL/gl.h>
+#endif
 #include <windows.h>
 #ifndef __CYGWIN32__
 #include <mmsystem.h>  /* Win32 Multimedia API header. */
@@ -266,6 +273,10 @@ __glutProcessDeviceEvents(XEvent * event)
     JOYINFOEX info;
     JOYCAPS joyCaps;
 
+    memset(&info, 0, sizeof(JOYINFOEX)); 
+    info.dwSize = sizeof(JOYINFOEX); 
+    info.dwFlags = JOY_RETURNALL;
+
     if (joyGetPosEx(JOYSTICKID1,&info) != JOYERR_NOERROR) {
       __glutHasJoystick = 1;
       joyGetDevCaps(JOYSTICKID1, &joyCaps, sizeof(joyCaps));
@@ -307,7 +318,7 @@ probeDevices(void)
   XButtonInfoPtr b;
   XValuatorInfoPtr v;
   XAxisInfoPtr a;
-  int num_dev, btns, dials;
+  int num_dev = 0, btns = 0, dials = 0;
   int i, j, k;
 #endif /* !_WIN32 */
 
@@ -573,7 +584,7 @@ __glutUpdateInputDeviceMask(GLUTwindow * window)
 }
 
 /* CENTRY */
-int APIENTRY
+int GLUTAPIENTRY
 glutDeviceGet(GLenum param)
 {
   probeDevices();