@@ -227,7 +227,7 @@ static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t
227
227
if (!len )
228
228
return 0 ;
229
229
230
- str = IOHIDDeviceGetProperty (device , prop );
230
+ str = ( CFStringRef ) IOHIDDeviceGetProperty (device , prop );
231
231
232
232
buf [0 ] = 0 ;
233
233
@@ -297,7 +297,8 @@ static wchar_t *dup_wcs(const wchar_t *s)
297
297
static io_service_t hidapi_IOHIDDeviceGetService (IOHIDDeviceRef device )
298
298
{
299
299
static void * iokit_framework = NULL ;
300
- static io_service_t (* dynamic_IOHIDDeviceGetService )(IOHIDDeviceRef device ) = NULL ;
300
+ typedef io_service_t (* dynamic_IOHIDDeviceGetService_t )(IOHIDDeviceRef device );
301
+ static dynamic_IOHIDDeviceGetService_t dynamic_IOHIDDeviceGetService ;
301
302
302
303
/* Use dlopen()/dlsym() to get a pointer to IOHIDDeviceGetService() if it exists.
303
304
* If any of these steps fail, dynamic_IOHIDDeviceGetService will be left NULL
@@ -307,7 +308,7 @@ static io_service_t hidapi_IOHIDDeviceGetService(IOHIDDeviceRef device)
307
308
iokit_framework = dlopen ("/System/Library/IOKit.framework/IOKit" , RTLD_LAZY );
308
309
309
310
if (iokit_framework != NULL )
310
- dynamic_IOHIDDeviceGetService = dlsym (iokit_framework , "IOHIDDeviceGetService" );
311
+ dynamic_IOHIDDeviceGetService = ( dynamic_IOHIDDeviceGetService_t ) dlsym (iokit_framework , "IOHIDDeviceGetService" );
311
312
}
312
313
313
314
if (dynamic_IOHIDDeviceGetService != NULL ) {
@@ -555,7 +556,7 @@ static void hid_device_removal_callback(void *context, IOReturn result,
555
556
void * sender )
556
557
{
557
558
/* Stop the Run Loop for this device. */
558
- hid_device * d = context ;
559
+ hid_device * d = ( hid_device * ) context ;
559
560
560
561
d -> disconnected = 1 ;
561
562
CFRunLoopStop (d -> run_loop );
@@ -569,7 +570,7 @@ static void hid_report_callback(void *context, IOReturn result, void *sender,
569
570
uint8_t * report , CFIndex report_length )
570
571
{
571
572
struct input_report * rpt ;
572
- hid_device * dev = context ;
573
+ hid_device * dev = ( hid_device * ) context ;
573
574
574
575
/* Make a new Input Report object */
575
576
rpt = (input_report * ) calloc (1 , sizeof (struct input_report ));
@@ -616,13 +617,13 @@ static void hid_report_callback(void *context, IOReturn result, void *sender,
616
617
hid_close(), and serves to stop the read_thread's run loop. */
617
618
static void perform_signal_callback (void * context )
618
619
{
619
- hid_device * dev = context ;
620
+ hid_device * dev = ( hid_device * ) context ;
620
621
CFRunLoopStop (dev -> run_loop ); /*TODO: CFRunLoopGetCurrent()*/
621
622
}
622
623
623
624
static void * read_thread (void * param )
624
625
{
625
- hid_device * dev = param ;
626
+ hid_device * dev = ( hid_device * ) param ;
626
627
SInt32 code ;
627
628
628
629
/* Move the device's run loop to this thread. */
@@ -693,6 +694,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
693
694
{
694
695
hid_device * dev = NULL ;
695
696
io_registry_entry_t entry = MACH_PORT_NULL ;
697
+ IOReturn ret ;
696
698
697
699
dev = new_hid_device ();
698
700
@@ -715,7 +717,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
715
717
}
716
718
717
719
/* Open the IOHIDDevice */
718
- IOReturn ret = IOHIDDeviceOpen (dev -> device_handle , kIOHIDOptionsTypeSeizeDevice );
720
+ ret = IOHIDDeviceOpen (dev -> device_handle , kIOHIDOptionsTypeSeizeDevice );
719
721
if (ret == kIOReturnSuccess ) {
720
722
char str [32 ];
721
723
0 commit comments