From 0236542d1adc5d0aece70ab37b4276e01da32171 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Mon, 6 Jul 2009 09:51:28 +0800 Subject: [PATCH] Fix bugs identified by clang static analyzer. Signed-off-by: Jonathan 'Wolf' Rentzsch --- Plugin/CTGradient.m | 2 +- Plugin/Plugin.m | 4 ++-- Plugin/SparkleManager.m | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Plugin/CTGradient.m b/Plugin/CTGradient.m index 2e72b9e9..5fff8535 100755 --- a/Plugin/CTGradient.m +++ b/Plugin/CTGradient.m @@ -53,7 +53,7 @@ - (void)dealloc { CGFunctionRelease(gradientFunction); - CTGradientElement *elementToRemove = elementList; + CTGradientElement *elementToRemove; while(elementList != nil) { elementToRemove = elementList; diff --git a/Plugin/Plugin.m b/Plugin/Plugin.m index d5a1a0be..e2b686f0 100755 --- a/Plugin/Plugin.m +++ b/Plugin/Plugin.m @@ -818,7 +818,7 @@ - (void) _drawGearIcon NSColor *startingColor = [NSColor colorWithDeviceWhite:1.0 alpha:1.0]; NSColor *endingColor = [NSColor colorWithDeviceWhite:1.0 alpha:0.0]; - [gradient initWithStartingColor:startingColor endingColor:endingColor]; + gradient = [gradient initWithStartingColor:startingColor endingColor:endingColor]; // draw gradient behind gear so that it's visible even on dark backgrounds [gradient drawFromCenter:gearImageCenter @@ -857,7 +857,7 @@ - (void) _drawBackground id gradient = [NSClassFromString(@"NSGradient") alloc]; if (gradient != nil) { - [gradient initWithStartingColor:startingColor endingColor:endingColor]; + gradient = [gradient initWithStartingColor:startingColor endingColor:endingColor]; [gradient drawInBezierPath:[NSBezierPath bezierPathWithRect:fillRect] angle:90.0 + ((mouseIsDown && mouseInside) ? 0.0 : 180.0)]; diff --git a/Plugin/SparkleManager.m b/Plugin/SparkleManager.m index e7ecad8d..ad1b5403 100644 --- a/Plugin/SparkleManager.m +++ b/Plugin/SparkleManager.m @@ -30,6 +30,8 @@ of this software and associated documentation files (the "Software"), to deal #import "CTFUserDefaultsController.h" #import "CTFPreferencesDictionary.h" +#import + // NSUserDefaults keys static NSString *sAutomaticallyCheckForUpdates = @"checkForUpdatesOnFirstLoad";