From 6cfc5b98492c50837f37d54176b982fbc5bbb912 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 13 Sep 2014 21:32:33 -0400 Subject: [PATCH] InputCommon: Initialize NSDictionaries using literal syntax. --- .../ControllerInterface/OSX/OSXJoystick.mm | 19 +++++++------------ .../ControllerInterface/OSX/OSXKeyboard.mm | 12 +++++------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm index 10a2c211c1..93dea13c28 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm @@ -22,13 +22,10 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) , m_ff_device(nullptr) { // Buttons - NSDictionary *buttonDict = - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInteger: kIOHIDElementTypeInput_Button], - @kIOHIDElementTypeKey, - [NSNumber numberWithInteger: kHIDPage_Button], - @kIOHIDElementUsagePageKey, - nil]; + NSDictionary *buttonDict = @{ + @kIOHIDElementTypeKey : [NSNumber numberWithInteger: kIOHIDElementTypeInput_Button], + @kIOHIDElementUsagePageKey : [NSNumber numberWithInteger: kHIDPage_Button] + }; CFArrayRef buttons = IOHIDDeviceCopyMatchingElements(m_device, (CFDictionaryRef)buttonDict, kIOHIDOptionsTypeNone); @@ -47,11 +44,9 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) } // Axes - NSDictionary *axisDict = - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInteger: kIOHIDElementTypeInput_Misc], - @kIOHIDElementTypeKey, - nil]; + NSDictionary *axisDict = @{ + @kIOHIDElementTypeKey : [NSNumber numberWithInteger: kIOHIDElementTypeInput_Misc] + }; CFArrayRef axes = IOHIDDeviceCopyMatchingElements(m_device, (CFDictionaryRef)axisDict, kIOHIDOptionsTypeNone); diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm index 98df7c3535..7ff67c0e7f 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXKeyboard.mm @@ -23,13 +23,11 @@ Keyboard::Keyboard(IOHIDDeviceRef device, std::string name, int index, void *win { // This class should only recieve Keyboard or Keypad devices // Now, filter on just the buttons we can handle sanely - NSDictionary *matchingElements = - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInteger: kIOHIDElementTypeInput_Button], - @kIOHIDElementTypeKey, - [NSNumber numberWithInteger: 0], @kIOHIDElementMinKey, - [NSNumber numberWithInteger: 1], @kIOHIDElementMaxKey, - nil]; + NSDictionary *matchingElements = @{ + @kIOHIDElementTypeKey : [NSNumber numberWithInteger: kIOHIDElementTypeInput_Button], + @kIOHIDElementMinKey : [NSNumber numberWithInteger: 0], + @kIOHIDElementMaxKey : [NSNumber numberWithInteger: 1] + }; CFArrayRef elements = IOHIDDeviceCopyMatchingElements(m_device, (CFDictionaryRef)matchingElements, kIOHIDOptionsTypeNone);