David Lawrie <david.dljunk(a)gmail.com> wrote:
+static Boolean get_device_property_long(IOHIDDeviceRef in_device, CFStringRef in_key, long * out_value) +{ + Boolean result = FALSE; + CFTypeRef type; + + if (in_device) + { + assert(IOHIDDeviceGetTypeID() == CFGetTypeID(in_device)); + + type = IOHIDDeviceGetProperty(in_device, in_key); + + if (type) + { + if (CFNumberGetTypeID() == CFGetTypeID(type)) + result = CFNumberGetValue((CFNumberRef)type, kCFNumberLongType, out_value); + } + } + return result; +} + +long get_device_location_ID(IOHIDDeviceRef device) +{ + long result = 0; + get_device_property_long(device, CFSTR(kIOHIDLocationIDKey), &result); + return result; +}
The helper should be 'static'. Also, probably you should return value from the helper directly since you don't check for the boolean result anyway. Same comment applies for a similar winejoystick.drv patch. -- Dmitry.