@@ -124,7 +124,7 @@ struct hid_device_ {
124124
125125static hid_device * new_hid_device (void )
126126{
127- hid_device * dev = calloc (1 , sizeof (hid_device ));
127+ hid_device * dev = ( hid_device * ) calloc (1 , sizeof (hid_device ));
128128 dev -> device_handle = NULL ;
129129 dev -> blocking = 1 ;
130130 dev -> uses_numbered_reports = 0 ;
@@ -281,7 +281,7 @@ static int get_product_string(IOHIDDeviceRef device, wchar_t *buf, size_t len)
281281static wchar_t * dup_wcs (const wchar_t * s )
282282{
283283 size_t len = wcslen (s );
284- wchar_t * ret = malloc ((len + 1 )* sizeof (wchar_t ));
284+ wchar_t * ret = ( wchar_t * ) malloc ((len + 1 )* sizeof (wchar_t ));
285285 wcscpy (ret , s );
286286
287287 return ret ;
@@ -410,7 +410,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
410410
411411 /* Convert the list into a C array so we can iterate easily. */
412412 num_devices = CFSetGetCount (device_set );
413- IOHIDDeviceRef * device_array = calloc (num_devices , sizeof (IOHIDDeviceRef ));
413+ IOHIDDeviceRef * device_array = ( IOHIDDeviceRef * ) calloc (num_devices , sizeof (IOHIDDeviceRef ));
414414 CFSetGetValues (device_set , (const void * * ) device_array );
415415
416416 /* Iterate over each device, making an entry for it. */
@@ -437,7 +437,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
437437 io_string_t path ;
438438
439439 /* VID/PID match. Create the record. */
440- tmp = malloc (sizeof (struct hid_device_info ));
440+ tmp = ( struct hid_device_info * ) malloc (sizeof (struct hid_device_info ));
441441 if (cur_dev ) {
442442 cur_dev -> next = tmp ;
443443 }
@@ -561,8 +561,8 @@ static void hid_report_callback(void *context, IOReturn result, void *sender,
561561 hid_device * dev = context ;
562562
563563 /* Make a new Input Report object */
564- rpt = calloc (1 , sizeof (struct input_report ));
565- rpt -> data = calloc (1 , report_length );
564+ rpt = ( input_report * ) calloc (1 , sizeof (struct input_report ));
565+ rpt -> data = ( uint8_t * ) calloc (1 , report_length );
566566 memcpy (rpt -> data , report , report_length );
567567 rpt -> len = report_length ;
568568 rpt -> next = NULL ;
@@ -710,7 +710,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
710710
711711 /* Create the buffers for receiving data */
712712 dev -> max_input_report_len = (CFIndex ) get_max_report_length (dev -> device_handle );
713- dev -> input_report_buf = calloc (dev -> max_input_report_len , sizeof (uint8_t ));
713+ dev -> input_report_buf = ( uint8_t * ) calloc (dev -> max_input_report_len , sizeof (uint8_t ));
714714
715715 /* Create the Run Loop Mode for this device.
716716 printing the reference seems to work. */
0 commit comments