diff options
| -rw-r--r-- | DDHidLib.xcodeproj/project.pbxproj | 2 | ||||
| -rw-r--r-- | device_test/AppleMikeyPaneController.h | 2 | ||||
| -rw-r--r-- | device_test/AppleMikeyPaneController.m | 2 | ||||
| -rw-r--r-- | device_test/ButtonState.h | 1 | ||||
| -rw-r--r-- | device_test/KeyboardPaneController.m | 2 | ||||
| -rw-r--r-- | device_test/RemoteFeedbackView.m | 2 | ||||
| -rw-r--r-- | lib/DDHidAppleMikey.m | 2 | ||||
| -rw-r--r-- | lib/DDHidAppleRemote.m | 2 | ||||
| -rw-r--r-- | lib/DDHidDevice.m | 32 | ||||
| -rw-r--r-- | lib/DDHidJoystick.m | 4 | ||||
| -rw-r--r-- | lib/DDHidKeyboard.m | 6 | ||||
| -rw-r--r-- | lib/DDHidMouse.m | 4 | ||||
| -rw-r--r-- | vendor/NSXReturnThrowError/NSXReturnThrowError.m | 2 | 
13 files changed, 36 insertions, 27 deletions
| diff --git a/DDHidLib.xcodeproj/project.pbxproj b/DDHidLib.xcodeproj/project.pbxproj index 9f72bee..e7201f6 100644 --- a/DDHidLib.xcodeproj/project.pbxproj +++ b/DDHidLib.xcodeproj/project.pbxproj @@ -55,7 +55,6 @@  		556E1E690B5359F9002F709C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 556E1E680B5359F9002F709C /* IOKit.framework */; };  		55917B640B53408C005308AC /* HidBrowserController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917B630B53408C005308AC /* HidBrowserController.m */; };  		55917E1C0B53E454005308AC /* HexFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 55917E1B0B53E454005308AC /* HexFormatter.m */; }; -		559CBAEB0B5B31AB00C8FD74 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 559CBAE90B5B31AB00C8FD74 /* Info.plist */; };  		559CBAEC0B5B31AB00C8FD74 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 559CBAEA0B5B31AB00C8FD74 /* main.m */; };  		559CBB930B5B31E300C8FD74 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };  		559CBB940B5B31EA00C8FD74 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 556E1E680B5359F9002F709C /* IOKit.framework */; }; @@ -650,7 +649,6 @@  			isa = PBXResourcesBuildPhase;  			buildActionMask = 2147483647;  			files = ( -				559CBAEB0B5B31AB00C8FD74 /* Info.plist in Resources */,  				55170E670B8ECF0000C82155 /* AppleRemote.tiff in Resources */,  				55D5927D0BAE306E00364849 /* InfoPlist.strings in Resources */,  				55D592940BAE30B600364849 /* MainMenu.nib in Resources */, diff --git a/device_test/AppleMikeyPaneController.h b/device_test/AppleMikeyPaneController.h index 28f6fc1..e02ec41 100644 --- a/device_test/AppleMikeyPaneController.h +++ b/device_test/AppleMikeyPaneController.h @@ -40,7 +40,7 @@      DDHidAppleMikey * mCurrentMikey;  } -- (NSArray *) mMikeys; +- (NSArray *) mikeys;  - (void) setMikeys: (NSArray *) theMikeys;  - (unsigned) mikeyIndex; diff --git a/device_test/AppleMikeyPaneController.m b/device_test/AppleMikeyPaneController.m index 0760688..ba0764e 100644 --- a/device_test/AppleMikeyPaneController.m +++ b/device_test/AppleMikeyPaneController.m @@ -151,7 +151,7 @@      if(!usage)          return; -    NSMutableDictionary * row = [mMikeysEventsController newObject]; +    NSMutableDictionary * row = [[mMikeysEventsController newObject] autorelease];      [row setObject: upOrDown ? @"Down" : @"Up" forKey: @"event"];      [row setObject:usage forKey: @"description"];      [mMikeysEventsController addObject: row]; diff --git a/device_test/ButtonState.h b/device_test/ButtonState.h index 63bde74..d45ada5 100644 --- a/device_test/ButtonState.h +++ b/device_test/ButtonState.h @@ -30,6 +30,7 @@      BOOL mPressed;  } +- (id) initWithName: (NSString *) name;  - (NSString *) name;  - (BOOL) pressed; diff --git a/device_test/KeyboardPaneController.m b/device_test/KeyboardPaneController.m index 1f8730e..0472718 100644 --- a/device_test/KeyboardPaneController.m +++ b/device_test/KeyboardPaneController.m @@ -169,7 +169,7 @@                                         usage: usageId],          usageId]; -    NSMutableDictionary * row = [mKeyboardEventsController newObject]; +    NSMutableDictionary * row = [[mKeyboardEventsController newObject] autorelease];      [row setObject: event forKey: @"event"];      [row setObject: description forKey: @"description"];      [mKeyboardEventsController addObject: row]; diff --git a/device_test/RemoteFeedbackView.m b/device_test/RemoteFeedbackView.m index acfdf3c..3afa067 100644 --- a/device_test/RemoteFeedbackView.m +++ b/device_test/RemoteFeedbackView.m @@ -97,7 +97,7 @@  	DDHidAppleRemoteEventIdentifier buttonToSelect = lastButtonIdentifier; -	NSPoint buttonPos; +	NSPoint buttonPos = NSZeroPoint;  	float opacity = 0.5;  	switch(buttonToSelect) { diff --git a/lib/DDHidAppleMikey.m b/lib/DDHidAppleMikey.m index d56db23..1460e57 100644 --- a/lib/DDHidAppleMikey.m +++ b/lib/DDHidAppleMikey.m @@ -152,7 +152,7 @@  - (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue;  {      DDHidEvent * event; -    while (event = [hidQueue nextEvent]) +    while ((event = [hidQueue nextEvent]))      {          DDHidElement * element = [self elementForCookie: [event elementCookie]];          unsigned usageId = [[element usage] usageId]; diff --git a/lib/DDHidAppleRemote.m b/lib/DDHidAppleRemote.m index e8b31b2..265db45 100644 --- a/lib/DDHidAppleRemote.m +++ b/lib/DDHidAppleRemote.m @@ -199,7 +199,7 @@  	SInt32 sumOfValues = 0;      DDHidEvent * event; -    while (event = [hidQueue nextEvent]) +    while ((event = [hidQueue nextEvent]))      {          if ([event elementCookie] == [mIdElement cookie])          { diff --git a/lib/DDHidDevice.m b/lib/DDHidDevice.m index 8000185..387a1e5 100644 --- a/lib/DDHidDevice.m +++ b/lib/DDHidDevice.m @@ -115,9 +115,14 @@  	// name for all HID class devices  	CFMutableDictionaryRef hidMatchDictionary =          IOServiceMatching(kIOHIDDeviceKey); -    return [self allDevicesMatchingCFDictionary: hidMatchDictionary +    id retVal = nil; +    if(hidMatchDictionary) { +        retVal = [self allDevicesMatchingCFDictionary: hidMatchDictionary                                        withClass: [DDHidDevice class]                                skipZeroLocations: NO]; +        //CFRelease(hidMatchDictionary);//dont free, it is freed by IOServiceGetMatchingServices +    } +    return retVal;  }  + (NSArray *) allDevicesMatchingUsagePage: (unsigned) usagePage @@ -129,15 +134,20 @@  	// name for all HID class devices  	CFMutableDictionaryRef hidMatchDictionary =          IOServiceMatching(kIOHIDDeviceKey); -    NSMutableDictionary * objcMatchDictionary = -        (NSMutableDictionary *) hidMatchDictionary; -    [objcMatchDictionary ddhid_setObject: [NSNumber numberWithUnsignedInt: usagePage] -                               forString: kIOHIDDeviceUsagePageKey]; -    [objcMatchDictionary ddhid_setObject: [NSNumber numberWithUnsignedInt: usageId] -                               forString: kIOHIDDeviceUsageKey]; -    return [self allDevicesMatchingCFDictionary: hidMatchDictionary -                                      withClass: hidClass -                              skipZeroLocations: skipZeroLocations]; +    id retVal = nil; +    if(hidMatchDictionary) { +        NSMutableDictionary * objcMatchDictionary = +            (NSMutableDictionary *) hidMatchDictionary; +        [objcMatchDictionary ddhid_setObject: [NSNumber numberWithUnsignedInt: usagePage] +                                   forString: kIOHIDDeviceUsagePageKey]; +        [objcMatchDictionary ddhid_setObject: [NSNumber numberWithUnsignedInt: usageId] +                                   forString: kIOHIDDeviceUsageKey]; +        retVal = [self allDevicesMatchingCFDictionary: hidMatchDictionary +                                          withClass: hidClass +                                  skipZeroLocations: skipZeroLocations]; +        //CFRelease(hidMatchDictionary);//dont free, it is freed by IOServiceGetMatchingServices +    } +return retVal;  }  + (NSArray *) allDevicesMatchingCFDictionary: (CFDictionaryRef) matchDictionary @@ -157,7 +167,7 @@              return [NSArray array];          io_object_t hidDevice; -        while (hidDevice = IOIteratorNext(hidObjectIterator)) +        while ((hidDevice = IOIteratorNext(hidObjectIterator)))          {              [self addDevice: hidDevice                    withClass: hidClass diff --git a/lib/DDHidJoystick.m b/lib/DDHidJoystick.m index 601f9b3..986ea28 100644 --- a/lib/DDHidJoystick.m +++ b/lib/DDHidJoystick.m @@ -294,7 +294,7 @@  - (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue;  {      DDHidEvent * event; -    while (event = [hidQueue nextEvent]) +    while ((event = [hidQueue nextEvent]))      {          IOHIDElementCookie cookie = [event elementCookie];          SInt32 value = [event value]; @@ -346,7 +346,7 @@              else              {                  DDHidElement * element = [self elementForCookie: [event elementCookie]]; -                NSLog(@"Element: %@, value: %d", [[element usage] usageName], [event value]); +                NSLog(@"Element: %@, value: %d", [[element usage] usageName], (int)[event value]);              }          }      } diff --git a/lib/DDHidKeyboard.m b/lib/DDHidKeyboard.m index 7e37264..5b0db35 100644 --- a/lib/DDHidKeyboard.m +++ b/lib/DDHidKeyboard.m @@ -143,8 +143,8 @@          unsigned usageId = [[element usage] usageId];          if (usagePage == kHIDPage_KeyboardOrKeypad)          { -            if ((usageId >= 0x04) && (usageId <= 0xA4) || -                (usageId >= 0xE0) && (usageId <= 0xE7)) +            if (((usageId >= 0x04) && (usageId <= 0xA4)) || +                ((usageId >= 0xE0) && (usageId <= 0xE7)))              {                  [mKeyElements addObject: element];              } @@ -158,7 +158,7 @@  - (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue;  {      DDHidEvent * event; -    while (event = [hidQueue nextEvent]) +    while ((event = [hidQueue nextEvent]))      {          DDHidElement * element = [self elementForCookie: [event elementCookie]];          unsigned usageId = [[element usage] usageId]; diff --git a/lib/DDHidMouse.m b/lib/DDHidMouse.m index 7eeb5b3..ab478a3 100644 --- a/lib/DDHidMouse.m +++ b/lib/DDHidMouse.m @@ -224,7 +224,7 @@  - (void) ddhidQueueHasEvents: (DDHidQueue *) hidQueue;  {      DDHidEvent * event; -    while (event = [hidQueue nextEvent]) +    while ((event = [hidQueue nextEvent]))      {          IOHIDElementCookie cookie = [event elementCookie];          SInt32 value = [event value]; @@ -269,7 +269,7 @@              else              {                  DDHidElement * element = [self elementForCookie: [event elementCookie]]; -                NSLog(@"Element: %@, value: %d", [[element usage] usageName], [event value]); +                NSLog(@"Element: %@, value: %d", [[element usage] usageName], (int)[event value]);              }          }      } diff --git a/vendor/NSXReturnThrowError/NSXReturnThrowError.m b/vendor/NSXReturnThrowError/NSXReturnThrowError.m index 22f31a5..bb1f0d7 100644 --- a/vendor/NSXReturnThrowError/NSXReturnThrowError.m +++ b/vendor/NSXReturnThrowError/NSXReturnThrowError.m @@ -93,7 +93,7 @@ void NSXMakeErrorImp(const char *objCType_, intptr_t result_, const char *file_,  			break;  	} -	if (errorDomain) { +	if (errorDomain && error_) {  		*error_ = [NSError errorWithDomain:errorDomain  									  code:errorCode  								  userInfo:[NSDictionary dictionaryWithObjectsAndKeys: | 
