Skip to content

Commit

Permalink
Clean up Clang static analyzer (I love that thing) warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
K8TIY committed Apr 21, 2011
1 parent 852dd79 commit 477f25e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions BigLetterView.m
Expand Up @@ -11,7 +11,8 @@ -(void)drawStringCenteredIn:(NSRect)r;
@implementation BigLetterView
-(id)initWithFrame:(NSRect)rect
{
if (![super initWithFrame:rect]) return nil;
self = [super initWithFrame:rect];
if (!self) return nil;
[self prepareAttributes];
bgColor = [[NSColor grayColor] retain];
string = [[NSMutableString alloc] init];
Expand Down Expand Up @@ -62,7 +63,7 @@ -(BOOL)becomeFirstResponder { return canBecomeFirstResponder; }
-(void)setCanBecomeFirstResponder:(BOOL)flag { canBecomeFirstResponder = flag; }
-(void)setBGColor:(NSColor*)col
{
col = [col retain];
[col retain];
if (bgColor) [bgColor release];
bgColor = col;
[self setNeedsDisplay:YES];
Expand Down
11 changes: 7 additions & 4 deletions LED.m
Expand Up @@ -32,6 +32,8 @@ @implementation LED
-(id)init
{
self = [super init];
CFSetRef deviceCFSetRef = NULL;
IOHIDDeviceRef* refs = NULL;
// create a IO HID Manager reference
IOHIDManagerRef mgr = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
require(mgr, Oops);
Expand All @@ -46,12 +48,12 @@ -(id)init
IOReturn err = IOHIDManagerOpen(mgr, kIOHIDOptionsTypeNone);
require_noerr(err, Oops);
// and copy out its devices
CFSetRef deviceCFSetRef = IOHIDManagerCopyDevices(mgr);
deviceCFSetRef = IOHIDManagerCopyDevices(mgr);
require(deviceCFSetRef, Oops);
// how many devices in the set?
CFIndex deviceIndex, deviceCount = CFSetGetCount(deviceCFSetRef);
// allocate a block of memory to extact the device refs from the set into
IOHIDDeviceRef* refs = malloc(sizeof(IOHIDDeviceRef) * deviceCount);
refs = malloc(sizeof(IOHIDDeviceRef) * deviceCount);
require(refs, Oops);
// now extract the device refs from the set
CFSetGetValues(deviceCFSetRef, (const void**)refs);
Expand Down Expand Up @@ -91,13 +93,14 @@ -(id)init
continue;
}
next_device: ;
CFRelease(elements);
if (elements) CFRelease(elements);
continue;
}
if (mgr) CFRelease(mgr);
[dic release];
free(refs);
Oops: ;
if (deviceCFSetRef) CFRelease(deviceCFSetRef);
if (refs) free(refs);
return self;
}

Expand Down
4 changes: 1 addition & 3 deletions Morse.m
Expand Up @@ -276,7 +276,6 @@ -(id)initWithWPM:(float)wpm

-(uint16_t)feed:(double*)duration
{
uint16_t chr = MorseNoCharacter;
// Put the event in the buffer
if (duration)
{
Expand All @@ -292,8 +291,7 @@ -(uint16_t)feed:(double*)duration
if (_bufferCount < MorseBufferSize) _bufferCount++;
_buffer[where] = *duration;
}
chr = [self _recognize];
return chr;
return [self _recognize];
}

-(MorseRecognizerQuality)quality
Expand Down

0 comments on commit 477f25e

Please sign in to comment.