src/joystick/bsd/SDL_sysjoystick.c
changeset 6963 4658b1101200
parent 6885 700f1b25f77f
child 7037 3fedf1f25b94
     1.1 --- a/src/joystick/bsd/SDL_sysjoystick.c	Mon Mar 04 11:35:03 2013 -0300
     1.2 +++ b/src/joystick/bsd/SDL_sysjoystick.c	Mon Mar 04 20:27:51 2013 -0800
     1.3 @@ -83,7 +83,9 @@
     1.4  
     1.5  struct report
     1.6  {
     1.7 -#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
     1.8 +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)
     1.9 +    void *buf; /* Buffer */
    1.10 +#elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
    1.11      struct usb_gen_descriptor *buf; /* Buffer */
    1.12  #else
    1.13      struct usb_ctl_report *buf; /* Buffer */
    1.14 @@ -149,8 +151,10 @@
    1.15  static int report_alloc(struct report *, struct report_desc *, int);
    1.16  static void report_free(struct report *);
    1.17  
    1.18 -#if defined(USBHID_UCR_DATA)
    1.19 +#if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063)
    1.20  #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
    1.21 +#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000))
    1.22 +#define REP_BUF_DATA(rep) ((rep)->buf)
    1.23  #elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
    1.24  #define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
    1.25  #else
    1.26 @@ -636,8 +640,12 @@
    1.27      r->size = len;
    1.28  
    1.29      if (r->size > 0) {
    1.30 +#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)
    1.31 +        r->buf = SDL_malloc(r->size);
    1.32 +#else
    1.33          r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +
    1.34                              r->size);
    1.35 +#endif
    1.36          if (r->buf == NULL) {
    1.37              SDL_OutOfMemory();
    1.38              return (-1);