Commit 924d4ff8 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed logic errors in previous commit pointed by Pierre

parent 0d24c85c
...@@ -66,7 +66,7 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4; ...@@ -66,7 +66,7 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
#pragma public interface #pragma public interface
- (id) init { - (id) init {
self = [super init]; if(( self = [super init])) {
openInExclusiveMode = YES; openInExclusiveMode = YES;
queue = NULL; queue = NULL;
hidDeviceInterface = NULL; hidDeviceInterface = NULL;
...@@ -104,7 +104,7 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4; ...@@ -104,7 +104,7 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"37_33_21_20_2_37_33_21_20_2_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"37_33_21_20_2_37_33_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"42_33_21_20_14_12_2_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"42_33_21_20_14_12_2_"];
} }
}
/* defaults */ /* defaults */
[self setSimulatesPlusMinusHold: YES]; [self setSimulatesPlusMinusHold: YES];
...@@ -347,7 +347,7 @@ static AppleRemote* sharedInstance=nil; ...@@ -347,7 +347,7 @@ static AppleRemote* sharedInstance=nil;
if (cookieString == nil || [cookieString length] == 0) return nil; if (cookieString == nil || [cookieString length] == 0) return nil;
NSEnumerator* keyEnum = [[self cookieToButtonMapping] keyEnumerator]; NSEnumerator* keyEnum = [[self cookieToButtonMapping] keyEnumerator];
NSString* key; NSString* key;
while(key == [keyEnum nextObject]) { while((key = [keyEnum nextObject])) {
NSRange range = [cookieString rangeOfString:key]; NSRange range = [cookieString rangeOfString:key];
if (range.location == 0) return key; if (range.location == 0) return key;
} }
...@@ -458,7 +458,7 @@ static AppleRemote* sharedInstance=nil; ...@@ -458,7 +458,7 @@ static AppleRemote* sharedInstance=nil;
// happen when the main thread is too busy to handle all incoming events in time. // happen when the main thread is too busy to handle all incoming events in time.
NSString* subCookieString; NSString* subCookieString;
NSString* lastSubCookieString=nil; NSString* lastSubCookieString=nil;
while(subCookieString == [self validCookieSubstring: cookieString]) { while((subCookieString = [self validCookieSubstring: cookieString])) {
cookieString = [cookieString substringFromIndex: [subCookieString length]]; cookieString = [cookieString substringFromIndex: [subCookieString length]];
lastSubCookieString = subCookieString; lastSubCookieString = subCookieString;
if (processesBacklog) [self handleEventWithCookieString: subCookieString sumOfValues:sumOfValues]; if (processesBacklog) [self handleEventWithCookieString: subCookieString sumOfValues:sumOfValues];
...@@ -670,7 +670,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon, ...@@ -670,7 +670,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
@implementation AppleRemoteApplicationDelegate @implementation AppleRemoteApplicationDelegate
- (id) initWithApplicationDelegate: (id) delegate { - (id) initWithApplicationDelegate: (id) delegate {
self = [super init]; if((self = [super init]))
applicationDelegate = [delegate retain]; applicationDelegate = [delegate retain];
return self; return self;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment