Permalink
Browse files

renamed all methods that start with underscore, since that's reserved…

… by Apple. Similiar for global variable that started with double underscore
  • Loading branch information...
Sean McBride Sean McBride
Sean McBride authored and Sean McBride committed Jan 1, 2010
1 parent 152e6f9 commit dab8a36a13c8e23c6bf6aca95bb72b12834dca99
View
@@ -34,7 +34,7 @@ - (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)aHost
[appcast fetchAppcastFromURL:URL];
}
-- (id <SUVersionComparison>)_versionComparator
+- (id <SUVersionComparison>)versionComparator
{
id <SUVersionComparison> comparator = nil;
@@ -51,7 +51,7 @@ - (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)aHost
- (BOOL)isItemNewer:(SUAppcastItem *)ui
{
- return [[self _versionComparator] compareVersion:[host version] toVersion:[ui versionString]] == NSOrderedAscending;
+ return [[self versionComparator] compareVersion:[host version] toVersion:[ui versionString]] == NSOrderedAscending;
}
- (BOOL)hostSupportsItem:(SUAppcastItem *)ui
@@ -64,7 +64,7 @@ - (BOOL)itemContainsSkippedVersion:(SUAppcastItem *)ui
{
NSString *skippedVersion = [host objectForUserDefaultsKey:SUSkippedVersionKey];
if (skippedVersion == nil) { return NO; }
- return [[self _versionComparator] compareVersion:[ui versionString] toVersion:skippedVersion] != NSOrderedDescending;
+ return [[self versionComparator] compareVersion:[ui versionString] toVersion:skippedVersion] != NSOrderedDescending;
}
- (BOOL)itemContainsValidUpdate:(SUAppcastItem *)ui
@@ -247,7 +247,7 @@ - (void)installUpdate
else
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't copy relauncher (%@) to temporary path (%@)! %@", relaunchPathToCopy, targetPath, (error ? [error localizedDescription] : @"")], NSLocalizedFailureReasonErrorKey, nil]]];
- [SUInstaller installFromUpdateFolder:[downloadPath stringByDeletingLastPathComponent] overHost:host delegate:self synchronously:[self shouldInstallSynchronously] versionComparator:[self _versionComparator]];
+ [SUInstaller installFromUpdateFolder:[downloadPath stringByDeletingLastPathComponent] overHost:host delegate:self synchronously:[self shouldInstallSynchronously] versionComparator:[self versionComparator]];
}
- (void)installerFinishedForHost:(SUHost *)aHost
View
@@ -13,12 +13,12 @@
@implementation SUDiskImageUnarchiver
-+ (BOOL)_canUnarchivePath:(NSString *)path
++ (BOOL)canUnarchivePath:(NSString *)path
{
return [[path pathExtension] isEqualToString:@"dmg"];
}
-- (void)_extractDMG
+- (void)extractDMG
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
BOOL mountedSuccessfully = NO;
@@ -60,11 +60,11 @@ - (void)_extractDMG
err = FSCopyObjectSync(&srcRef, &dstRef, (CFStringRef)mountPointName, NULL, kFSFileOperationSkipSourcePermissionErrors);
if (err != noErr) goto reportError;
- [self performSelectorOnMainThread:@selector(_notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
+ [self performSelectorOnMainThread:@selector(notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
goto finally;
reportError:
- [self performSelectorOnMainThread:@selector(_notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
+ [self performSelectorOnMainThread:@selector(notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
finally:
if (mountedSuccessfully)
@@ -74,12 +74,12 @@ - (void)_extractDMG
- (void)start
{
- [NSThread detachNewThreadSelector:@selector(_extractDMG) toTarget:self withObject:nil];
+ [NSThread detachNewThreadSelector:@selector(extractDMG) toTarget:self withObject:nil];
}
+ (void)load
{
- [self _registerImplementation:self];
+ [self registerImplementation:self];
}
@end
View
@@ -15,7 +15,7 @@
@class SUHost;
@interface SUInstaller : NSObject { }
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
-+ (void)_finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate;
++ (void)finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate;
@end
@interface NSObject (SUInstallerDelegateInformalProtocol)
View
@@ -13,7 +13,7 @@
@implementation SUInstaller
-+ (BOOL)_isAliasFolderAtPath:(NSString *)path
++ (BOOL)isAliasFolderAtPath:(NSString *)path
{
FSRef fileRef;
OSStatus err = noErr;
@@ -78,7 +78,7 @@ + (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host
}
// Some DMGs have symlinks into /Applications! That's no good!
- if ([self _isAliasFolderAtPath:currentPath])
+ if ([self isAliasFolderAtPath:currentPath])
[dirEnum skipDescendents];
}
@@ -92,15 +92,15 @@ + (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host
if (newAppDownloadPath == nil)
{
- [self _finishInstallationWithResult:NO host:host error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find an appropriate update in the downloaded package." forKey:NSLocalizedDescriptionKey]] delegate:delegate];
+ [self finishInstallationWithResult:NO host:host error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find an appropriate update in the downloaded package." forKey:NSLocalizedDescriptionKey]] delegate:delegate];
}
else
{
[(isPackage ? [SUPackageInstaller class] : [SUPlainInstaller class]) performInstallationWithPath:newAppDownloadPath host:host delegate:delegate synchronously:synchronously versionComparator:comparator];
}
}
-+ (void)_mdimportHost:(SUHost *)host
++ (void)mdimportHost:(SUHost *)host
{
NSTask *mdimport = [[[NSTask alloc] init] autorelease];
[mdimport setLaunchPath:@"/usr/bin/mdimport"];
@@ -116,11 +116,11 @@ + (void)_mdimportHost:(SUHost *)host
}
}
-+ (void)_finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate
++ (void)finishInstallationWithResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate
{
if (result)
{
- [self _mdimportHost:host];
+ [self mdimportHost:host];
if ([delegate respondsToSelector:@selector(installerFinishedForHost:)])
[delegate installerFinishedForHost:host];
}
View
@@ -15,20 +15,20 @@
@implementation SUPackageInstaller
-+ (void)_finishInstallationWithInfo:(NSDictionary *)info
++ (void)finishInstallationWithInfo:(NSDictionary *)info
{
- [self _finishInstallationWithResult:YES host:[info objectForKey:SUPackageInstallerHostKey] error:nil delegate:[info objectForKey:SUPackageInstallerDelegateKey]];
+ [self finishInstallationWithResult:YES host:[info objectForKey:SUPackageInstallerHostKey] error:nil delegate:[info objectForKey:SUPackageInstallerDelegateKey]];
}
-+ (void)_performInstallationWithInfo:(NSDictionary *)info
++ (void)performInstallationWithInfo:(NSDictionary *)info
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSTask *installer = [NSTask launchedTaskWithLaunchPath:[info objectForKey:SUPackageInstallerCommandKey] arguments:[info objectForKey:SUPackageInstallerArgumentsKey]];
[installer waitUntilExit];
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
- [self performSelectorOnMainThread:@selector(_finishInstallationWithInfo:) withObject:info waitUntilDone:NO];
+ [self performSelectorOnMainThread:@selector(finishInstallationWithInfo:) withObject:info waitUntilDone:NO];
[pool drain];
}
@@ -54,15 +54,15 @@ + (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegat
if (![[NSFileManager defaultManager] fileExistsAtPath:command])
{
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingInstallerToolError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find Apple's installer tool!" forKey:NSLocalizedDescriptionKey]];
- [self _finishInstallationWithResult:NO host:host error:error delegate:delegate];
+ [self finishInstallationWithResult:NO host:host error:error delegate:delegate];
}
else
{
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:command, SUPackageInstallerCommandKey, args, SUPackageInstallerArgumentsKey, host, SUPackageInstallerHostKey, delegate, SUPackageInstallerDelegateKey, nil];
if (synchronously)
- [self _performInstallationWithInfo:info];
+ [self performInstallationWithInfo:info];
else
- [NSThread detachNewThreadSelector:@selector(_performInstallationWithInfo:) toTarget:self withObject:info];
+ [NSThread detachNewThreadSelector:@selector(performInstallationWithInfo:) toTarget:self withObject:info];
}
}
View
@@ -11,13 +11,13 @@
@implementation SUPipedUnarchiver
-+ (SEL)_selectorConformingToTypeOfPath:(NSString *)path
++ (SEL)selectorConformingToTypeOfPath:(NSString *)path
{
static NSDictionary *typeSelectorDictionary;
if (!typeSelectorDictionary)
- typeSelectorDictionary = [[NSDictionary dictionaryWithObjectsAndKeys:@"_extractZIP", @".zip", @"_extractTAR", @".tar",
- @"_extractTGZ", @".tar.gz", @"_extractTGZ", @".tgz",
- @"_extractTBZ", @".tar.bz2", @"_extractTBZ", @".tbz", nil] retain];
+ typeSelectorDictionary = [[NSDictionary dictionaryWithObjectsAndKeys:@"extractZIP", @".zip", @"extractTAR", @".tar",
+ @"extractTGZ", @".tar.gz", @"extractTGZ", @".tgz",
+ @"extractTBZ", @".tar.bz2", @"extractTBZ", @".tbz", nil] retain];
NSString *lastPathComponent = [path lastPathComponent];
NSEnumerator *typeEnumerator = [typeSelectorDictionary keyEnumerator];
@@ -33,16 +33,16 @@ + (SEL)_selectorConformingToTypeOfPath:(NSString *)path
- (void)start
{
- [NSThread detachNewThreadSelector:[[self class] _selectorConformingToTypeOfPath:archivePath] toTarget:self withObject:nil];
+ [NSThread detachNewThreadSelector:[[self class] selectorConformingToTypeOfPath:archivePath] toTarget:self withObject:nil];
}
-+ (BOOL)_canUnarchivePath:(NSString *)path
++ (BOOL)canUnarchivePath:(NSString *)path
{
- return ([self _selectorConformingToTypeOfPath:path] != nil);
+ return ([self selectorConformingToTypeOfPath:path] != nil);
}
// This method abstracts the types that use a command line tool piping data from stdin.
-- (void)_extractArchivePipingDataToCommand:(NSString *)command
+- (void)extractArchivePipingDataToCommand:(NSString *)command
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
FILE *fp = NULL, *cmdFP = NULL;
@@ -76,48 +76,48 @@ - (void)_extractArchivePipingDataToCommand:(NSString *)command
goto reportError;
}
- [self performSelectorOnMainThread:@selector(_notifyDelegateOfExtractedLength:) withObject:[NSNumber numberWithUnsignedLong:len] waitUntilDone:NO];
+ [self performSelectorOnMainThread:@selector(notifyDelegateOfExtractedLength:) withObject:[NSNumber numberWithUnsignedLong:len] waitUntilDone:NO];
}
pclose(cmdFP);
if( ferror( fp ) )
goto reportError;
- [self performSelectorOnMainThread:@selector(_notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
+ [self performSelectorOnMainThread:@selector(notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
goto finally;
reportError:
- [self performSelectorOnMainThread:@selector(_notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
+ [self performSelectorOnMainThread:@selector(notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
finally:
if (fp)
fclose(fp);
[pool drain];
}
-- (void)_extractTAR
+- (void)extractTAR
{
- return [self _extractArchivePipingDataToCommand:@"tar -xC \"$DESTINATION\""];
+ return [self extractArchivePipingDataToCommand:@"tar -xC \"$DESTINATION\""];
}
-- (void)_extractTGZ
+- (void)extractTGZ
{
- return [self _extractArchivePipingDataToCommand:@"tar -zxC \"$DESTINATION\""];
+ return [self extractArchivePipingDataToCommand:@"tar -zxC \"$DESTINATION\""];
}
-- (void)_extractTBZ
+- (void)extractTBZ
{
- return [self _extractArchivePipingDataToCommand:@"tar -jxC \"$DESTINATION\""];
+ return [self extractArchivePipingDataToCommand:@"tar -jxC \"$DESTINATION\""];
}
-- (void)_extractZIP
+- (void)extractZIP
{
- return [self _extractArchivePipingDataToCommand:@"ditto -x -k - \"$DESTINATION\""];
+ return [self extractArchivePipingDataToCommand:@"ditto -x -k - \"$DESTINATION\""];
}
+ (void)load
{
- [self _registerImplementation:self];
+ [self registerImplementation:self];
}
@end
View
@@ -20,12 +20,12 @@
@implementation SUPlainInstaller
-+ (void)_finishInstallationWithInfo:(NSDictionary *)info
++ (void)finishInstallationWithInfo:(NSDictionary *)info
{
- [self _finishInstallationWithResult:[[info objectForKey:SUInstallerResultKey] boolValue] host:[info objectForKey:SUInstallerHostKey] error:[info objectForKey:SUInstallerErrorKey] delegate:[info objectForKey:SUInstallerDelegateKey]];
+ [self finishInstallationWithResult:[[info objectForKey:SUInstallerResultKey] boolValue] host:[info objectForKey:SUInstallerHostKey] error:[info objectForKey:SUInstallerErrorKey] delegate:[info objectForKey:SUInstallerDelegateKey]];
}
-+ (void)_performInstallationWithInfo:(NSDictionary *)info
++ (void)performInstallationWithInfo:(NSDictionary *)info
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -37,7 +37,7 @@ + (void)_performInstallationWithInfo:(NSDictionary *)info
[mutableInfo setObject:[NSNumber numberWithBool:result] forKey:SUInstallerResultKey];
if (!result && error)
[mutableInfo setObject:error forKey:SUInstallerErrorKey];
- [self performSelectorOnMainThread:@selector(_finishInstallationWithInfo:) withObject:mutableInfo waitUntilDone:NO];
+ [self performSelectorOnMainThread:@selector(finishInstallationWithInfo:) withObject:mutableInfo waitUntilDone:NO];
[pool drain];
}
@@ -49,17 +49,17 @@ + (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegat
{
NSString * errorMessage = [NSString stringWithFormat:@"Sparkle Updater: Possible attack in progress! Attempting to \"upgrade\" from %@ to %@. Aborting update.", [host version], [[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:@"CFBundleVersion"]];
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
- [self _finishInstallationWithResult:NO host:host error:error delegate:delegate];
+ [self finishInstallationWithResult:NO host:host error:error delegate:delegate];
return;
}
NSString *targetPath = [host bundlePath];
NSString *tempName = [self temporaryNameForPath:targetPath];
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:path, SUInstallerPathKey, targetPath, SUInstallerTargetPathKey, tempName, SUInstallerTempNameKey, host, SUInstallerHostKey, delegate, SUInstallerDelegateKey, nil];
if (synchronously)
- [self _performInstallationWithInfo:info];
+ [self performInstallationWithInfo:info];
else
- [NSThread detachNewThreadSelector:@selector(_performInstallationWithInfo:) toTarget:self withObject:info];
+ [NSThread detachNewThreadSelector:@selector(performInstallationWithInfo:) toTarget:self withObject:info];
}
@end
@@ -85,7 +85,7 @@ + (NSString *)temporaryNameForPath:(NSString *)path
return [tempDir lastPathComponent];
}
-+ (BOOL)_copyPathWithForcedAuthentication:(NSString *)src toPath:(NSString *)dst temporaryPath:(NSString *)tmp error:(NSError **)error
++ (BOOL)copyPathWithForcedAuthentication:(NSString *)src toPath:(NSString *)dst temporaryPath:(NSString *)tmp error:(NSError **)error
{
const char* srcPath = [src fileSystemRepresentation];
const char* tmpPath = [tmp fileSystemRepresentation];
@@ -185,7 +185,7 @@ + (BOOL)_copyPathWithForcedAuthentication:(NSString *)src toPath:(NSString *)dst
return res;
}
-+ (void)_movePathToTrash:(NSString *)path
++ (void)movePathToTrash:(NSString *)path
{
NSInteger tag = 0;
if (![[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[path stringByDeletingLastPathComponent] destination:@"" files:[NSArray arrayWithObject:[path lastPathComponent]] tag:&tag])
@@ -209,7 +209,7 @@ + (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temp
NSString *tmpPath = [[dst stringByDeletingLastPathComponent] stringByAppendingPathComponent:tmp];
if (0 != access([dst fileSystemRepresentation], W_OK) || 0 != access([[dst stringByDeletingLastPathComponent] fileSystemRepresentation], W_OK))
- return [self _copyPathWithForcedAuthentication:src toPath:dst temporaryPath:tmpPath error:error];
+ return [self copyPathWithForcedAuthentication:src toPath:dst temporaryPath:tmpPath error:error];
err = FSPathMakeRef((UInt8 *)[[dst stringByDeletingLastPathComponent] fileSystemRepresentation], &targetRef, NULL);
if (err == noErr)
@@ -235,11 +235,11 @@ + (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temp
// Trash the old copy of the app.
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
if (FSMoveObjectToTrashSync == NULL)
- [self performSelectorOnMainThread:@selector(_movePathToTrash:) withObject:tmpPath waitUntilDone:YES];
+ [self performSelectorOnMainThread:@selector(movePathToTrash:) withObject:tmpPath waitUntilDone:YES];
else if (noErr != FSMoveObjectToTrashSync(&movedRef, NULL, 0))
NSLog(@"Sparkle error: couldn't move %@ to the trash. This is often a sign of a permissions error.", tmpPath);
#else
- [self performSelectorOnMainThread:@selector(_movePathToTrash:) withObject:tmpPath waitUntilDone:YES];
+ [self performSelectorOnMainThread:@selector(movePathToTrash:) withObject:tmpPath waitUntilDone:YES];
#endif
// If the currently-running application is trusted, the new
View
@@ -87,7 +87,7 @@ - (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)r
[statusController setMaxProgressValue:[response expectedContentLength]];
}
-- (NSString *)_humanReadableSizeFromDouble:(double)value
+- (NSString *)humanReadableSizeFromDouble:(double)value
{
if (value < 1000)
return [NSString stringWithFormat:@"%.0lf %@", value, SULocalizedString(@"B", @"the unit for bytes")];
@@ -105,9 +105,9 @@ - (void)download:(NSURLDownload *)download didReceiveDataOfLength:(NSUInteger)le
{
[statusController setProgressValue:[statusController progressValue] + (double)length];
if ([statusController maxProgressValue] > 0.0)
- [statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", nil), [self _humanReadableSizeFromDouble:[statusController progressValue]], [self _humanReadableSizeFromDouble:[statusController maxProgressValue]]]];
+ [statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", nil), [self humanReadableSizeFromDouble:[statusController progressValue]], [self humanReadableSizeFromDouble:[statusController maxProgressValue]]]];
else
- [statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", nil), [self _humanReadableSizeFromDouble:[statusController progressValue]]]];
+ [statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", nil), [self humanReadableSizeFromDouble:[statusController progressValue]]]];
}
- (void)extractUpdate
Oops, something went wrong.

0 comments on commit dab8a36

Please sign in to comment.