(OSX) CXX_BUILD buildfix

This commit is contained in:
Twinaphex 2019-04-22 10:33:30 +02:00
parent 64dea335ff
commit 077a5dd685
1 changed files with 18 additions and 20 deletions

View File

@ -597,7 +597,7 @@ static void iohidmanager_hid_device_add_device(
* if so do not re-add the pad */ * if so do not re-add the pad */
for (i=0; i<MAX_USERS; i++) for (i=0; i<MAX_USERS; i++)
{ {
struct iohidmanager_hid_adapter *a = hid->slots[i].data; struct iohidmanager_hid_adapter *a = (struct iohidmanager_hid_adapter*)hid->slots[i].data;
if (a == NULL) if (a == NULL)
continue; continue;
if (a->uniqueId == deviceUniqueId) if (a->uniqueId == deviceUniqueId)
@ -982,9 +982,9 @@ static int iohidmanager_hid_manager_set_device_matching(
{ {
/* deterministically add all device currently plugged when lanching retroarch /* deterministically add all device currently plugged when lanching retroarch
* order by location id which seems to correspond to usb port number */ * order by location id which seems to correspond to usb port number */
CFSetRef set = IOHIDManagerCopyDevices(hid->ptr); CFSetRef set = IOHIDManagerCopyDevices(hid->ptr);
CFIndex num_devices = CFSetGetCount(set); CFIndex num_devices = CFSetGetCount(set);
IOHIDDeviceRef *device_array = calloc(num_devices, sizeof(IOHIDDeviceRef)); IOHIDDeviceRef *device_array = (IOHIDDeviceRef*)calloc(num_devices, sizeof(IOHIDDeviceRef));
CFSetGetValues(set, (const void **) device_array); CFSetGetValues(set, (const void **) device_array);
/* re order device by location id */ /* re order device by location id */
@ -1006,32 +1006,30 @@ static int iohidmanager_hid_manager_set_device_matching(
{ {
if ( devList == NULL ) if ( devList == NULL )
{ {
devList = (hid_list_t *)malloc(sizeof(hid_list_t)); devList = (hid_list_t *)malloc(sizeof(hid_list_t));
devList->device = dev; devList->device = dev;
devList->lid = iohidmanager_hid_device_get_location_id(dev); devList->lid = iohidmanager_hid_device_get_location_id(dev);
devList->next = NULL; devList->next = NULL;
} }
else else
{ {
hid_list_t * new = (hid_list_t *)malloc(sizeof(hid_list_t)); hid_list_t * devnew = (hid_list_t *)malloc(sizeof(hid_list_t));
new->device = dev; devnew->device = dev;
new->lid = iohidmanager_hid_device_get_location_id(dev); devnew->lid = iohidmanager_hid_device_get_location_id(dev);
new->next = NULL; devnew->next = NULL;
hid_list_t * ptr = devList; hid_list_t * ptr = devList;
if ( new->lid < ptr->lid ) if (devnew->lid < ptr->lid)
{ {
new->next = ptr; devnew->next = ptr;
devList = new; devList = devnew;
} }
else else
{ {
while ( ( ptr->lid < new->lid ) && (ptr->next != NULL) ) while ( ( ptr->lid < devnew->lid ) && (ptr->next != NULL) )
{
ptr = ptr->next; ptr = ptr->next;
} devnew->next = ptr->next;
new->next = ptr->next; ptr->next = devnew;
ptr->next = new;
} }
} }
} }