PrefPane: clang warnings and setup for Sparkle
authorRudy Richter
Sat Aug 01 20:50:32 2009 -0400 (2009-08-01)
changeset 426148b7c994f6c8
parent 4260 e954301ab4aa
child 4262 1e66707c1402
PrefPane: clang warnings and setup for Sparkle
Core/Source/GrowlApplicationController.m
Core/Source/GrowlApplicationTicket.m
Core/Source/GrowlPreferencePane.m
Core/Source/GrowlPreferencesController.m
     1.1 --- a/Core/Source/GrowlApplicationController.m	Sat Aug 01 20:48:54 2009 -0400
     1.2 +++ b/Core/Source/GrowlApplicationController.m	Sat Aug 01 20:50:32 2009 -0400
     1.3 @@ -95,7 +95,7 @@
     1.4  //static struct Version version = { 0U, 8U, 0U, releaseType_svn, 0U, };
     1.5  #warning Having to update this struct manually is ugly. Use the info.plist.
     1.6  #warning And once code is in to automagically update this from Info.plist, the documentation in GrowlVersionUtilities.h should also be updated.
     1.7 -static struct Version version = { 1U, 1U, 6U, releaseType_beta, 3U, };
     1.8 +static struct Version version = { 1U, 2U, 0U, releaseType_development, 1U, };
     1.9  //XXX - update these constants whenever the version changes
    1.10  
    1.11  static void checkVersion(CFRunLoopTimerRef timer, void *context) {
    1.12 @@ -539,7 +539,6 @@
    1.13  				[filename getCharacters:filenameBuf];
    1.14  				err = FSMakeFSRefUnicode(&folderRef, [filename length], filenameBuf, kTextEncodingUnknown, outRef);
    1.15  				if (err == noErr) {
    1.16 -					foundIt = YES;
    1.17  					break;
    1.18  				}
    1.19  			}
     2.1 --- a/Core/Source/GrowlApplicationTicket.m	Sat Aug 01 20:48:54 2009 -0400
     2.2 +++ b/Core/Source/GrowlApplicationTicket.m	Sat Aug 01 20:50:32 2009 -0400
     2.3 @@ -592,6 +592,8 @@
     2.4  			CFURLRef url = (CFURLRef)createFileURLWithDockDescription(file_data);
     2.5  			if (url) {
     2.6  				fullPath = [(NSString *)CFURLCopyPath(url) autorelease];
     2.7 +				if(fullPath)
     2.8 +					CFMakeCollectable(fullPath);		
     2.9  				CFRelease(url);
    2.10  			}
    2.11  		} else if ([location isKindOfClass:[NSString class]]) {
    2.12 @@ -613,6 +615,8 @@
    2.13  													&appURL);
    2.14  			if (err == noErr) {
    2.15  				fullPath = [(NSString *)CFURLCopyPath(appURL) autorelease];
    2.16 +				if(fullPath)
    2.17 +					CFMakeCollectable(fullPath);		
    2.18  				CFRelease(appURL);
    2.19  			}
    2.20  		}
     3.1 --- a/Core/Source/GrowlPreferencePane.m	Sat Aug 01 20:48:54 2009 -0400
     3.2 +++ b/Core/Source/GrowlPreferencePane.m	Sat Aug 01 20:50:32 2009 -0400
     3.3 @@ -230,45 +230,11 @@
     3.4   */
     3.5  - (IBAction) checkVersion:(id)sender {
     3.6  #pragma unused(sender)
     3.7 -	[growlVersionProgress startAnimation:self];
     3.8 -
     3.9 -	if (!versionCheckURL)
    3.10 -		versionCheckURL = [[NSURL alloc] initWithString:@"http://growl.info/version.xml"];
    3.11 -
    3.12 -	NSBundle *bundle = [self bundle];
    3.13 -	NSDictionary *infoDict = [bundle infoDictionary];
    3.14 -	NSString *currVersionNumber = [infoDict objectForKey:(NSString *)kCFBundleVersionKey];
    3.15 -	NSDictionary *productVersionDict = [[NSDictionary alloc] initWithContentsOfURL:versionCheckURL];
    3.16 -	NSString *executableName = [infoDict objectForKey:(NSString *)kCFBundleExecutableKey];
    3.17 -	NSString *latestVersionNumber = [productVersionDict objectForKey:executableName];
    3.18 -
    3.19 -	CFURLRef downloadURL = CFURLCreateWithString(kCFAllocatorDefault,
    3.20 -		(CFStringRef)[productVersionDict objectForKey:[executableName stringByAppendingString:@"DownloadURL"]], NULL);
    3.21  	/*
    3.22 -	 NSLog([[[NSBundle bundleWithIdentifier:GROWL_PREFPANE_BUNDLE_IDENTIFIER] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] );
    3.23 -	 NSLog(currVersionNumber);
    3.24 -	 NSLog(latestVersionNumber);
    3.25 -	 */
    3.26 -
    3.27 -	// do nothing--be quiet if there is no active connection or if the
    3.28 -	// version number could not be downloaded
    3.29 -	if (latestVersionNumber && (compareVersionStringsTranslating1_0To0_5(latestVersionNumber, currVersionNumber) > 0))
    3.30 -		NSBeginAlertSheet(/*title*/ NSLocalizedStringFromTableInBundle(@"Update Available", nil, bundle, @""),
    3.31 -						  /*defaultButton*/ nil, // use default localized button title ("OK" in English)
    3.32 -						  /*alternateButton*/ NSLocalizedStringFromTableInBundle(@"Cancel", nil, bundle, @""),
    3.33 -						  /*otherButton*/ nil,
    3.34 -						  /*docWindow*/ nil,
    3.35 -						  /*modalDelegate*/ self,
    3.36 -						  /*didEndSelector*/ NULL,
    3.37 -						  /*didDismissSelector*/ @selector(downloadSelector:returnCode:contextInfo:),
    3.38 -						  /*contextInfo*/ (void *)downloadURL,
    3.39 -						  /*msg*/ NSLocalizedStringFromTableInBundle(@"A newer version of Growl is available online. Would you like to download it now?", nil, [self bundle], @""));
    3.40 -	else
    3.41 -		CFRelease(downloadURL);
    3.42 -
    3.43 -	[productVersionDict release];
    3.44 +	 [growlVersionProgress startAnimation:self];
    3.45  
    3.46  	[growlVersionProgress stopAnimation:self];
    3.47 +	*/
    3.48  }
    3.49  
    3.50  - (void) downloadSelector:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
     4.1 --- a/Core/Source/GrowlPreferencesController.m	Sat Aug 01 20:48:54 2009 -0400
     4.2 +++ b/Core/Source/GrowlPreferencesController.m	Sat Aug 01 20:50:32 2009 -0400
     4.3 @@ -90,6 +90,8 @@
     4.4  
     4.5  - (id) objectForKey:(NSString *)key {
     4.6  	id value = (id)CFPreferencesCopyAppValue((CFStringRef)key, (CFStringRef)GROWL_HELPERAPP_BUNDLE_IDENTIFIER);
     4.7 +	if(value)
     4.8 +		CFMakeCollectable(value);
     4.9  	return [value autorelease];
    4.10  }
    4.11  
    4.12 @@ -259,10 +261,12 @@
    4.13  
    4.14  	while (GetNextProcess(&PSN) == noErr) {
    4.15  		NSDictionary *infoDict = (NSDictionary *)ProcessInformationCopyDictionary(&PSN, kProcessDictionaryIncludeAllInformationMask);
    4.16 -		NSString *bundleID = [infoDict objectForKey:(NSString *)kCFBundleIdentifierKey];
    4.17 -		isRunning = bundleID && [bundleID isEqualToString:theBundleIdentifier];
    4.18 -		[infoDict release];
    4.19 -
    4.20 +		if(infoDict) {
    4.21 +			NSString *bundleID = [infoDict objectForKey:(NSString *)kCFBundleIdentifierKey];
    4.22 +			isRunning = bundleID && [bundleID isEqualToString:theBundleIdentifier];
    4.23 +			CFMakeCollectable(infoDict);
    4.24 +			[infoDict release];
    4.25 +		}
    4.26  		if (isRunning)
    4.27  			break;
    4.28  	}
    4.29 @@ -401,8 +405,11 @@
    4.30  	NSString *passwordString;
    4.31  	if (status == noErr) {
    4.32  		passwordString = (NSString *)CFStringCreateWithBytes(kCFAllocatorDefault, password, passwordLength, kCFStringEncodingUTF8, false);
    4.33 -		[passwordString autorelease];
    4.34 -		SecKeychainItemFreeContent(NULL, password);
    4.35 +		if(passwordString) {
    4.36 +			CFMakeCollectable(passwordString);
    4.37 +			[passwordString autorelease];
    4.38 +			SecKeychainItemFreeContent(NULL, password);
    4.39 +		}
    4.40  	} else {
    4.41  		if (status != errSecItemNotFound)
    4.42  			NSLog(@"Failed to retrieve password from keychain. Error: %d", status);