Use -1 as a sentinel.

This commit is contained in:
Steve Checkoway
2006-02-27 00:20:18 +00:00
parent d5f650dce5
commit 5a916de95b
2 changed files with 4 additions and 4 deletions
@@ -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 );
+2 -1
View File
@@ -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; }