dinput: Use the proper mutable Core Foundation types for mutable collections and avoid casting.

This commit is contained in:
Ken Thomases 2014-04-13 18:34:11 -05:00 committed by Alexandre Julliard
parent 4637b607b2
commit bf938311a2
1 changed files with 9 additions and 9 deletions

View File

@ -96,7 +96,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(dinput); WINE_DEFAULT_DEBUG_CHANNEL(dinput);
static IOHIDManagerRef hid_manager = NULL; static IOHIDManagerRef hid_manager = NULL;
static CFArrayRef device_main_elements = NULL; static CFMutableArrayRef device_main_elements = NULL;
typedef struct JoystickImpl JoystickImpl; typedef struct JoystickImpl JoystickImpl;
static const IDirectInputDevice8AVtbl JoystickAvt; static const IDirectInputDevice8AVtbl JoystickAvt;
@ -283,7 +283,7 @@ static CFMutableDictionaryRef create_osx_device_match(int usage)
return result; return result;
} }
static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFArrayRef main_elements) static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFMutableArrayRef main_elements)
{ {
CFArrayRef elements; CFArrayRef elements;
CFIndex total = 0; CFIndex total = 0;
@ -310,7 +310,7 @@ static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFArrayRef main_element
if (usage_page == kHIDPage_GenericDesktop && if (usage_page == kHIDPage_GenericDesktop &&
(usage == kHIDUsage_GD_Joystick || usage == kHIDUsage_GD_GamePad)) (usage == kHIDUsage_GD_Joystick || usage == kHIDUsage_GD_GamePad))
{ {
CFArrayAppendValue((CFMutableArrayRef)main_elements, element); CFArrayAppendValue(main_elements, element);
total++; total++;
} }
} }
@ -319,7 +319,7 @@ static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFArrayRef main_element
return total; return total;
} }
static void get_element_children(IOHIDElementRef element, CFArrayRef all_children) static void get_element_children(IOHIDElementRef element, CFMutableArrayRef all_children)
{ {
CFIndex idx, cnt; CFIndex idx, cnt;
CFArrayRef element_children = IOHIDElementGetChildren(element); CFArrayRef element_children = IOHIDElementGetChildren(element);
@ -337,7 +337,7 @@ static void get_element_children(IOHIDElementRef element, CFArrayRef all_childre
if (IOHIDElementGetType(child) == kIOHIDElementTypeCollection) if (IOHIDElementGetType(child) == kIOHIDElementTypeCollection)
get_element_children(child, all_children); get_element_children(child, all_children);
else else
CFArrayAppendValue((CFMutableArrayRef)all_children, child); CFArrayAppendValue(all_children, child);
} }
} }
@ -345,7 +345,7 @@ static int find_osx_devices(void)
{ {
CFMutableDictionaryRef result; CFMutableDictionaryRef result;
CFSetRef devset; CFSetRef devset;
CFArrayRef matching; CFMutableArrayRef matching;
hid_manager = IOHIDManagerCreate( kCFAllocatorDefault, 0L ); hid_manager = IOHIDManagerCreate( kCFAllocatorDefault, 0L );
if (IOHIDManagerOpen( hid_manager, 0 ) != kIOReturnSuccess) if (IOHIDManagerOpen( hid_manager, 0 ) != kIOReturnSuccess)
@ -364,14 +364,14 @@ static int find_osx_devices(void)
CFRelease(matching); CFRelease(matching);
return 0; return 0;
} }
CFArrayAppendValue( ( CFMutableArrayRef )matching, result ); CFArrayAppendValue( matching, result );
result = create_osx_device_match(kHIDUsage_GD_GamePad); result = create_osx_device_match(kHIDUsage_GD_GamePad);
if (!result) if (!result)
{ {
CFRelease(matching); CFRelease(matching);
return 0; return 0;
} }
CFArrayAppendValue( ( CFMutableArrayRef )matching, result ); CFArrayAppendValue( matching, result );
IOHIDManagerSetDeviceMatchingMultiple( hid_manager, matching); IOHIDManagerSetDeviceMatchingMultiple( hid_manager, matching);
devset = IOHIDManagerCopyDevices( hid_manager ); devset = IOHIDManagerCopyDevices( hid_manager );
@ -458,7 +458,7 @@ static void insert_sort_button(int header, IOHIDElementRef element,
static void get_osx_device_elements(JoystickImpl *device, int axis_map[8]) static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
{ {
IOHIDElementRef device_main_element; IOHIDElementRef device_main_element;
CFArrayRef elements; CFMutableArrayRef elements;
DWORD axes = 0; DWORD axes = 0;
DWORD sliders = 0; DWORD sliders = 0;
DWORD buttons = 0; DWORD buttons = 0;