projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added a safety-check on a memory allocation. (Timers were using
[freeglut]
/
src
/
freeglut_joystick.c
diff --git
a/src/freeglut_joystick.c
b/src/freeglut_joystick.c
index
5174c7b
..
82fc444
100644
(file)
--- a/
src/freeglut_joystick.c
+++ b/
src/freeglut_joystick.c
@@
-56,8
+56,12
@@
#else
# include <unistd.h>
# include <fcntl.h>
#else
# include <unistd.h>
# include <fcntl.h>
-# ifdef __FreeBSD__
+# if defined(__FreeBSD__) || defined(__NetBSD__)
+# if __FreeBSD_version >= 500000
+# include <sys/joystick.h>
+# else
# include <machine/joystick.h>
# include <machine/joystick.h>
+# endif
# define JS_DATA_TYPE joystick
# define JS_RETURN (sizeof(struct JS_DATA_TYPE))
# elif defined(__linux__)
# define JS_DATA_TYPE joystick
# define JS_RETURN (sizeof(struct JS_DATA_TYPE))
# elif defined(__linux__)
@@
-247,13
+251,13
@@
static void fghJoystickRawRead ( SFG_Joystick* joy, int* buttons, float* axes )
if( status != JS_RETURN )
{
if( status != JS_RETURN )
{
- fgWarning( joy->fname );
+ fgWarning( "%s", joy->fname );
joy->error = TRUE;
return;
}
if( buttons )
joy->error = TRUE;
return;
}
if( buttons )
-# ifdef __FreeBSD__
+# if defined(__FreeBSD__) || defined(__NetBSD__)
*buttons = (joy->js.b1 ? 1 : 0) | (joy->js.b2 ? 2 : 0);
# else
*buttons = joy->js.buttons;
*buttons = (joy->js.b1 ? 1 : 0) | (joy->js.b2 ? 2 : 0);
# else
*buttons = joy->js.buttons;