Use -1 as a sentinel.
This commit is contained in:
@@ -182,6 +182,7 @@ void InputHandler_Carbon::AddDevices( int usagePage, int usage, InputDevice &id
|
||||
while( (device = IOIteratorNext(iter)) )
|
||||
{
|
||||
HIDDevice *dev = MakeDevice( id );
|
||||
int num;
|
||||
|
||||
if( !dev )
|
||||
{
|
||||
@@ -189,14 +190,12 @@ void InputHandler_Carbon::AddDevices( int usagePage, int usage, InputDevice &id
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !dev->Open(device) )
|
||||
if( !dev->Open(device) || (num = dev->AssignIDs(id)) == -1 )
|
||||
{
|
||||
delete dev;
|
||||
IOObjectRelease( device );
|
||||
continue;
|
||||
}
|
||||
|
||||
int num = dev->AssignIDs( id );
|
||||
io_iterator_t i;
|
||||
|
||||
enum_add( id, num );
|
||||
|
||||
@@ -103,7 +103,8 @@ public:
|
||||
/*
|
||||
* Returns the number of IDs assigned starting from startID. This is not meaningful for devices like
|
||||
* keyboards that all share the same InputDevice id. If a particular device has multiple logical
|
||||
* devices, then it must ensure that AssignIDs does not assign an ID outside of its range.
|
||||
* devices, then it must ensure that AssignIDs does not assign an ID outside of its range. Return
|
||||
* -1 to indicate that the device does not share the same InputDevice and none could be assigned.
|
||||
*/
|
||||
virtual int AssignIDs( InputDevice startID ) { return 0; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user