@@ -226,7 +226,7 @@ static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t
226
226
if (!len )
227
227
return 0 ;
228
228
229
- str = IOHIDDeviceGetProperty (device , prop );
229
+ str = ( CFStringRef ) IOHIDDeviceGetProperty (device , prop );
230
230
231
231
buf [0 ] = 0 ;
232
232
@@ -296,7 +296,8 @@ static wchar_t *dup_wcs(const wchar_t *s)
296
296
static io_service_t hidapi_IOHIDDeviceGetService (IOHIDDeviceRef device )
297
297
{
298
298
static void * iokit_framework = NULL ;
299
- static io_service_t (* dynamic_IOHIDDeviceGetService )(IOHIDDeviceRef device ) = NULL ;
299
+ typedef io_service_t (* dynamic_IOHIDDeviceGetService_t )(IOHIDDeviceRef device );
300
+ static dynamic_IOHIDDeviceGetService_t dynamic_IOHIDDeviceGetService ;
300
301
301
302
/* Use dlopen()/dlsym() to get a pointer to IOHIDDeviceGetService() if it exists.
302
303
* If any of these steps fail, dynamic_IOHIDDeviceGetService will be left NULL
@@ -306,7 +307,7 @@ static io_service_t hidapi_IOHIDDeviceGetService(IOHIDDeviceRef device)
306
307
iokit_framework = dlopen ("/System/Library/IOKit.framework/IOKit" , RTLD_LAZY );
307
308
308
309
if (iokit_framework != NULL )
309
- dynamic_IOHIDDeviceGetService = dlsym (iokit_framework , "IOHIDDeviceGetService" );
310
+ dynamic_IOHIDDeviceGetService = ( dynamic_IOHIDDeviceGetService_t ) dlsym (iokit_framework , "IOHIDDeviceGetService" );
310
311
}
311
312
312
313
if (dynamic_IOHIDDeviceGetService != NULL ) {
@@ -544,7 +545,7 @@ static void hid_device_removal_callback(void *context, IOReturn result,
544
545
void * sender )
545
546
{
546
547
/* Stop the Run Loop for this device. */
547
- hid_device * d = context ;
548
+ hid_device * d = ( hid_device * ) context ;
548
549
549
550
d -> disconnected = 1 ;
550
551
CFRunLoopStop (d -> run_loop );
@@ -558,7 +559,7 @@ static void hid_report_callback(void *context, IOReturn result, void *sender,
558
559
uint8_t * report , CFIndex report_length )
559
560
{
560
561
struct input_report * rpt ;
561
- hid_device * dev = context ;
562
+ hid_device * dev = ( hid_device * ) context ;
562
563
563
564
/* Make a new Input Report object */
564
565
rpt = (input_report * ) calloc (1 , sizeof (struct input_report ));
@@ -605,13 +606,13 @@ static void hid_report_callback(void *context, IOReturn result, void *sender,
605
606
hid_close(), and serves to stop the read_thread's run loop. */
606
607
static void perform_signal_callback (void * context )
607
608
{
608
- hid_device * dev = context ;
609
+ hid_device * dev = ( hid_device * ) context ;
609
610
CFRunLoopStop (dev -> run_loop ); /*TODO: CFRunLoopGetCurrent()*/
610
611
}
611
612
612
613
static void * read_thread (void * param )
613
614
{
614
- hid_device * dev = param ;
615
+ hid_device * dev = ( hid_device * ) param ;
615
616
SInt32 code ;
616
617
617
618
/* Move the device's run loop to this thread. */
@@ -682,6 +683,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
682
683
{
683
684
hid_device * dev = NULL ;
684
685
io_registry_entry_t entry = MACH_PORT_NULL ;
686
+ IOReturn ret ;
685
687
686
688
dev = new_hid_device ();
687
689
@@ -704,7 +706,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
704
706
}
705
707
706
708
/* Open the IOHIDDevice */
707
- IOReturn ret = IOHIDDeviceOpen (dev -> device_handle , kIOHIDOptionsTypeSeizeDevice );
709
+ ret = IOHIDDeviceOpen (dev -> device_handle , kIOHIDOptionsTypeSeizeDevice );
708
710
if (ret == kIOReturnSuccess ) {
709
711
char str [32 ];
710
712
0 commit comments