mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 10:48:51 -05:00
Fixed issues found with static analysis.
This commit is contained in:
parent
8e4e70d7a4
commit
c9820b2ba5
|
@ -336,7 +336,12 @@ void _glfwInitJoysticks(void)
|
||||||
result = IOMasterPort(bootstrap_port, &masterPort);
|
result = IOMasterPort(bootstrap_port, &masterPort);
|
||||||
hidMatchDictionary = IOServiceMatching(kIOHIDDeviceKey);
|
hidMatchDictionary = IOServiceMatching(kIOHIDDeviceKey);
|
||||||
if (kIOReturnSuccess != result || !hidMatchDictionary)
|
if (kIOReturnSuccess != result || !hidMatchDictionary)
|
||||||
|
{
|
||||||
|
if (hidMatchDictionary)
|
||||||
|
CFRelease(hidMatchDictionary);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
result = IOServiceGetMatchingServices(masterPort,
|
result = IOServiceGetMatchingServices(masterPort,
|
||||||
hidMatchDictionary,
|
hidMatchDictionary,
|
||||||
|
@ -370,19 +375,27 @@ void _glfwInitJoysticks(void)
|
||||||
/* Check device type */
|
/* Check device type */
|
||||||
refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsagePageKey));
|
refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsagePageKey));
|
||||||
if (refCF)
|
if (refCF)
|
||||||
|
{
|
||||||
CFNumberGetValue(refCF, kCFNumberLongType, &usagePage);
|
CFNumberGetValue(refCF, kCFNumberLongType, &usagePage);
|
||||||
|
if (usagePage != kHIDPage_GenericDesktop)
|
||||||
|
{
|
||||||
|
/* We are not interested in this device */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsageKey));
|
refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDPrimaryUsageKey));
|
||||||
if (refCF)
|
if (refCF)
|
||||||
|
{
|
||||||
CFNumberGetValue(refCF, kCFNumberLongType, &usage);
|
CFNumberGetValue(refCF, kCFNumberLongType, &usage);
|
||||||
|
|
||||||
if ((usagePage != kHIDPage_GenericDesktop) ||
|
if ((usage != kHIDUsage_GD_Joystick &&
|
||||||
(usage != kHIDUsage_GD_Joystick &&
|
usage != kHIDUsage_GD_GamePad &&
|
||||||
usage != kHIDUsage_GD_GamePad &&
|
usage != kHIDUsage_GD_MultiAxisController))
|
||||||
usage != kHIDUsage_GD_MultiAxisController))
|
{
|
||||||
{
|
/* We are not interested in this device */
|
||||||
/* We don't interested in this device */
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwJoystick* joystick = &_glfwJoysticks[deviceCounter];
|
_glfwJoystick* joystick = &_glfwJoysticks[deviceCounter];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user