From 87f28934fe305f46aeadd575e202308e009bc2a5 Mon Sep 17 00:00:00 2001 From: andym Date: Sun, 30 Dec 2007 05:48:11 +0000 Subject: [PATCH] Fixed warnings for missing newlines at the end of the file. Replaced use of SystemVersion.plist with Gestalt() --- NSBundle+SUAdditions.h | 2 +- NSFileManager+Authentication.h | 2 +- NSFileManager+Verification.h | 2 +- NSString+extras.h | 2 +- NSWorkspace_RBAdditions.h | 2 +- NTSynchronousTask.h | 2 +- RSS.h | 2 +- SUAppcast.h | 2 +- SUAppcastItem.h | 2 +- SUConstants.h | 2 +- SUConstants.m | 2 +- SUStandardVersionComparator.h | 2 +- SUStandardVersionComparator.m | 2 +- SUStatusChecker.h | 2 +- SUStatusChecker.m | 14 ++++++++------ SUStatusController.h | 2 +- SUSystemProfiler.h | 2 +- SUSystemProfiler.m | 3 ++- SUUnarchiver.h | 2 +- SUUpdateAlert.h | 2 +- SUUpdater.h | 2 +- SUUpdater.m | 7 +++++-- SUUserDefaults.h | 2 +- SUVersionComparisonProtocol.h | 2 +- Sparkle.h | 19 ++++++++++++++----- relaunch.m | 2 +- 26 files changed, 51 insertions(+), 36 deletions(-) diff --git a/NSBundle+SUAdditions.h b/NSBundle+SUAdditions.h index a5f124d0..2d243ca0 100644 --- a/NSBundle+SUAdditions.h +++ b/NSBundle+SUAdditions.h @@ -45,4 +45,4 @@ - (BOOL)isRunningFromDiskImage; @end -#endif \ No newline at end of file +#endif diff --git a/NSFileManager+Authentication.h b/NSFileManager+Authentication.h index be525358..50eefc24 100644 --- a/NSFileManager+Authentication.h +++ b/NSFileManager+Authentication.h @@ -13,4 +13,4 @@ - (BOOL)copyPath:(NSString *)src overPath:(NSString *)dst withAuthentication:(BOOL)useAuthentication; @end -#endif \ No newline at end of file +#endif diff --git a/NSFileManager+Verification.h b/NSFileManager+Verification.h index 36193a1d..9a97eacd 100644 --- a/NSFileManager+Verification.h +++ b/NSFileManager+Verification.h @@ -14,4 +14,4 @@ - (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString; @end -#endif \ No newline at end of file +#endif diff --git a/NSString+extras.h b/NSString+extras.h index 4ddf9f7f..7d84b688 100644 --- a/NSString+extras.h +++ b/NSString+extras.h @@ -63,4 +63,4 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA @end -#endif \ No newline at end of file +#endif diff --git a/NSWorkspace_RBAdditions.h b/NSWorkspace_RBAdditions.h index 265785d4..bd50fb13 100644 --- a/NSWorkspace_RBAdditions.h +++ b/NSWorkspace_RBAdditions.h @@ -38,4 +38,4 @@ extern NSString* NSWorkspace_RBserverURL; @end -#endif \ No newline at end of file +#endif diff --git a/NTSynchronousTask.h b/NTSynchronousTask.h index dce0eee9..23ca6ef6 100644 --- a/NTSynchronousTask.h +++ b/NTSynchronousTask.h @@ -26,4 +26,4 @@ @end -#endif \ No newline at end of file +#endif diff --git a/RSS.h b/RSS.h index dd3c9e4b..59cc7391 100644 --- a/RSS.h +++ b/RSS.h @@ -101,4 +101,4 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA @end -#endif \ No newline at end of file +#endif diff --git a/SUAppcast.h b/SUAppcast.h index 436e13cd..60e6c118 100644 --- a/SUAppcast.h +++ b/SUAppcast.h @@ -29,4 +29,4 @@ - (NSString *)userAgentForAppcast:(SUAppcast *)appcast; @end -#endif \ No newline at end of file +#endif diff --git a/SUAppcastItem.h b/SUAppcastItem.h index de2f60ba..b3e85385 100644 --- a/SUAppcastItem.h +++ b/SUAppcastItem.h @@ -62,4 +62,4 @@ @end -#endif \ No newline at end of file +#endif diff --git a/SUConstants.h b/SUConstants.h index 1562ba11..72938231 100644 --- a/SUConstants.h +++ b/SUConstants.h @@ -42,4 +42,4 @@ extern NSString *SUEnableAutomaticChecksKey; #endif -#endif \ No newline at end of file +#endif diff --git a/SUConstants.m b/SUConstants.m index 2f3cae47..5bb7bce7 100644 --- a/SUConstants.m +++ b/SUConstants.m @@ -21,4 +21,4 @@ NSString *SUExpectsDSASignatureKey = @"SUExpectsDSASignature"; NSString *SUPublicDSAKeyKey = @"SUPublicDSAKey"; NSString *SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate"; NSString *SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates"; -NSString *SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks"; \ No newline at end of file +NSString *SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks"; diff --git a/SUStandardVersionComparator.h b/SUStandardVersionComparator.h index 35364591..b45a5b9b 100644 --- a/SUStandardVersionComparator.h +++ b/SUStandardVersionComparator.h @@ -33,4 +33,4 @@ - (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB; @end -#endif \ No newline at end of file +#endif diff --git a/SUStandardVersionComparator.m b/SUStandardVersionComparator.m index 123f6e59..57cc02f4 100644 --- a/SUStandardVersionComparator.m +++ b/SUStandardVersionComparator.m @@ -155,4 +155,4 @@ typedef enum { } -@end \ No newline at end of file +@end diff --git a/SUStatusChecker.h b/SUStatusChecker.h index ec79876d..a1fca913 100644 --- a/SUStatusChecker.h +++ b/SUStatusChecker.h @@ -27,4 +27,4 @@ @end -#endif \ No newline at end of file +#endif diff --git a/SUStatusChecker.m b/SUStatusChecker.m index 72ce7561..0e67f3fa 100644 --- a/SUStatusChecker.m +++ b/SUStatusChecker.m @@ -16,7 +16,7 @@ @implementation SUStatusChecker -+ (SUStatusChecker *)statusCheckerForDelegate:(id)inDelegate; ++ (SUStatusChecker *)statusCheckerForDelegate:(id)inDelegate { SUStatusChecker *statusChecker = [[self alloc] initForDelegate:inDelegate]; @@ -25,12 +25,14 @@ - (id)initForDelegate:(id)inDelegate { - [super init]; - - scDelegate = [inDelegate retain]; - - [self checkForUpdatesAndNotify:NO]; + self = [super init]; + if (self) + { + scDelegate = [inDelegate retain]; + [self checkForUpdatesAndNotify:NO]; + } + return self; } diff --git a/SUStatusController.h b/SUStatusController.h index 94ce2ec9..c7f26468 100644 --- a/SUStatusController.h +++ b/SUStatusController.h @@ -37,4 +37,4 @@ @end -#endif \ No newline at end of file +#endif diff --git a/SUSystemProfiler.h b/SUSystemProfiler.h index 3fd04c0b..6c732ba1 100644 --- a/SUSystemProfiler.h +++ b/SUSystemProfiler.h @@ -13,4 +13,4 @@ + (NSURL *)profiledURLForAppcastURL:(NSURL *)appcastURL hostBundle:(NSBundle *)hostBundle; @end -#endif \ No newline at end of file +#endif diff --git a/SUSystemProfiler.m b/SUSystemProfiler.m index 07242a1d..785d9836 100644 --- a/SUSystemProfiler.m +++ b/SUSystemProfiler.m @@ -3,7 +3,8 @@ // Sparkle // // Created by Andy Matuschak on 12/22/07. -// Copyright 2007 __MyCompanyName__. All rights reserved. +// Copyright 2007 Andy Matuschak. All rights reserved. +// Adapted from Sparkle+, by Tom Harrington. // #import "Sparkle.h" diff --git a/SUUnarchiver.h b/SUUnarchiver.h index e5a5748d..c5e037a4 100644 --- a/SUUnarchiver.h +++ b/SUUnarchiver.h @@ -24,4 +24,4 @@ - (void)unarchiverDidFail:(SUUnarchiver *)unarchiver; @end -#endif \ No newline at end of file +#endif diff --git a/SUUpdateAlert.h b/SUUpdateAlert.h index ae5dcc99..781819e2 100644 --- a/SUUpdateAlert.h +++ b/SUUpdateAlert.h @@ -41,4 +41,4 @@ typedef enum - (void)updateAlert:(SUUpdateAlert *)updateAlert finishedWithChoice:(SUUpdateAlertChoice)updateChoice; @end -#endif \ No newline at end of file +#endif diff --git a/SUUpdater.h b/SUUpdater.h index 5d4a9db0..53cc87ce 100644 --- a/SUUpdater.h +++ b/SUUpdater.h @@ -67,4 +67,4 @@ #define SU_DEFAULT_CHECK_INTERVAL 60*60*24 #endif -#endif \ No newline at end of file +#endif diff --git a/SUUpdater.m b/SUUpdater.m index 03aed624..adbbe14d 100644 --- a/SUUpdater.m +++ b/SUUpdater.m @@ -47,8 +47,11 @@ - init { self = [super init]; - [self setHostBundle:[NSBundle mainBundle]]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidFinishLaunching:) name:NSApplicationDidFinishLaunchingNotification object:NSApp]; + if (self) + { + [self setHostBundle:[NSBundle mainBundle]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidFinishLaunching:) name:NSApplicationDidFinishLaunchingNotification object:NSApp]; + } return self; } diff --git a/SUUserDefaults.h b/SUUserDefaults.h index 5023e7e7..85293a30 100644 --- a/SUUserDefaults.h +++ b/SUUserDefaults.h @@ -38,4 +38,4 @@ - (void)setBool:(BOOL)value forKey:(NSString *)defaultName; @end -#endif \ No newline at end of file +#endif diff --git a/SUVersionComparisonProtocol.h b/SUVersionComparisonProtocol.h index 8a52b248..a45cba90 100644 --- a/SUVersionComparisonProtocol.h +++ b/SUVersionComparisonProtocol.h @@ -24,4 +24,4 @@ @end -#endif \ No newline at end of file +#endif diff --git a/Sparkle.h b/Sparkle.h index 6caa17e3..6ac6e65b 100644 --- a/Sparkle.h +++ b/Sparkle.h @@ -15,16 +15,26 @@ #define SULocalizedString(key,comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", [NSBundle bundleForClass:[self class]], comment) +#import #ifdef __OBJC__ #import #import "SUConstants.h" #endif -// Apple recommends using SystemVersion.plist instead of Gestalt() here, don't ask me why. -// This code *should* use NSSearchPathForDirectoriesInDomains(NSCoreServiceDirectory, NSSystemDomainMask, YES) -// but that returns /Library/CoreServices for some reason // This returns a version string of the form X.Y.Z -#define SUSystemVersionString() [[NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"] objectForKey:@"ProductVersion"] +inline NSString* SUSystemVersionString(void) +{ + long major, minor, bugfix; + OSErr err1 = Gestalt (gestaltSystemVersionMajor, &major); + OSErr err2 = Gestalt (gestaltSystemVersionMinor, &minor); + OSErr err3 = Gestalt (gestaltSystemVersionBugFix, &bugfix); + NSString* verStr = nil; + if (!err1 && !err2 && !err3) + { + verStr = [NSString stringWithFormat:@"%ld.%ld.%ld", major, minor, bugfix]; + } + return verStr; +} // This list should include the shared headers. It doesn't matter if some of them aren't shared (unless @@ -55,4 +65,3 @@ #import "SUVersionComparisonProtocol.h" #endif - diff --git a/relaunch.m b/relaunch.m index 1482d13e..daf17688 100644 --- a/relaunch.m +++ b/relaunch.m @@ -66,4 +66,4 @@ int main (int argc, const char * argv[]) [pool release]; return EXIT_SUCCESS; -} \ No newline at end of file +}