hid: fix inconsistent indentation

This commit is contained in:
Cameron Gutman 2021-11-20 13:17:59 -06:00
parent db60b27188
commit 343fa61215
1 changed files with 42 additions and 42 deletions

View File

@ -404,69 +404,69 @@ static void hid_device_removal_callback(void *context, IOReturn result,
static CFDictionaryRef static CFDictionaryRef
create_usage_match(const UInt32 page, const UInt32 usage, int *okay) create_usage_match(const UInt32 page, const UInt32 usage, int *okay)
{ {
CFDictionaryRef retval = NULL; CFDictionaryRef retval = NULL;
CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page); CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page);
CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage); CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);
const void *keys[2] = { (void *) CFSTR(kIOHIDDeviceUsagePageKey), (void *) CFSTR(kIOHIDDeviceUsageKey) }; const void *keys[2] = { (void *) CFSTR(kIOHIDDeviceUsagePageKey), (void *) CFSTR(kIOHIDDeviceUsageKey) };
const void *vals[2] = { (void *) pageNumRef, (void *) usageNumRef }; const void *vals[2] = { (void *) pageNumRef, (void *) usageNumRef };
if (pageNumRef && usageNumRef) { if (pageNumRef && usageNumRef) {
retval = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); retval = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
} }
if (pageNumRef) { if (pageNumRef) {
CFRelease(pageNumRef); CFRelease(pageNumRef);
} }
if (usageNumRef) { if (usageNumRef) {
CFRelease(usageNumRef); CFRelease(usageNumRef);
} }
if (!retval) { if (!retval) {
*okay = 0; *okay = 0;
} }
return retval; return retval;
} }
static CFDictionaryRef static CFDictionaryRef
create_vendor_match(const UInt32 vendor, int *okay) create_vendor_match(const UInt32 vendor, int *okay)
{ {
CFDictionaryRef retval = NULL; CFDictionaryRef retval = NULL;
CFNumberRef vidNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &vendor); CFNumberRef vidNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &vendor);
const void *keys[1] = { (void *) CFSTR(kIOHIDVendorIDKey) }; const void *keys[1] = { (void *) CFSTR(kIOHIDVendorIDKey) };
const void *vals[1] = { (void *) vidNumRef }; const void *vals[1] = { (void *) vidNumRef };
if (vidNumRef) { if (vidNumRef) {
retval = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); retval = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFRelease(vidNumRef); CFRelease(vidNumRef);
} }
if (!retval) { if (!retval) {
*okay = 0; *okay = 0;
} }
return retval; return retval;
} }
/* Initialize the IOHIDManager. Return 0 for success and -1 for failure. */ /* Initialize the IOHIDManager. Return 0 for success and -1 for failure. */
static int init_hid_manager(void) static int init_hid_manager(void)
{ {
int okay = 1; int okay = 1;
const void *vals[] = { const void *vals[] = {
(void *) create_usage_match(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay), (void *) create_usage_match(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay),
(void *) create_usage_match(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, &okay), (void *) create_usage_match(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, &okay),
(void *) create_usage_match(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay), (void *) create_usage_match(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay),
(void *) create_vendor_match(VALVE_USB_VID, &okay), (void *) create_vendor_match(VALVE_USB_VID, &okay),
}; };
const size_t numElements = SDL_arraysize(vals); const size_t numElements = SDL_arraysize(vals);
CFArrayRef matchingArray = okay ? CFArrayCreate(kCFAllocatorDefault, vals, numElements, &kCFTypeArrayCallBacks) : NULL; CFArrayRef matchingArray = okay ? CFArrayCreate(kCFAllocatorDefault, vals, numElements, &kCFTypeArrayCallBacks) : NULL;
size_t i; size_t i;
for (i = 0; i < numElements; i++) { for (i = 0; i < numElements; i++) {
if (vals[i]) { if (vals[i]) {
CFRelease((CFTypeRef) vals[i]); CFRelease((CFTypeRef) vals[i]);
} }
} }
/* Initialize all the HID Manager Objects */ /* Initialize all the HID Manager Objects */
hid_mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); hid_mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);