diff --git a/ApplicationController.m b/ApplicationController.m index 8efcded..c4681ea 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -245,7 +245,7 @@ fileManager = [NSFileManager defaultManager]; applicationSupportFolder = [self applicationSupportFolder]; if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) { - [fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil]; + [fileManager createDirectoryAtPath:applicationSupportFolder withIntermediateDirectories:YES attributes:nil error:nil]; } url = [NSURL fileURLWithPath: [applicationSupportFolder stringByAppendingPathComponent: @"GitTest.xml"]]; diff --git a/Commands/PBCommandFactory.h b/Commands/PBCommandFactory.h index a613c7b..477a52b 100644 --- a/Commands/PBCommandFactory.h +++ b/Commands/PBCommandFactory.h @@ -9,5 +9,5 @@ #import "PBGitRepository.h" @protocol PBCommandFactory -+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository; ++ (NSArray *) commandsForObject:(id) object repository:(PBGitRepository *) repository; @end diff --git a/Commands/PBCommandWithParameter.m b/Commands/PBCommandWithParameter.m index 9f50b51..15b8afe 100644 --- a/Commands/PBCommandWithParameter.m +++ b/Commands/PBCommandWithParameter.m @@ -16,7 +16,7 @@ @synthesize parameterDisplayName; - initWithCommand:(PBCommand *) aCommand parameterName:(NSString *) param parameterDisplayName:(NSString *) paramDisplayName { - if (self = [super initWithDisplayName:[aCommand displayName] parameters:nil repository:[aCommand repository]]) { + if ((self = [super initWithDisplayName:[aCommand displayName] parameters:nil repository:[aCommand repository]])) { command = [aCommand retain]; parameterName = [param retain]; parameterDisplayName = [paramDisplayName retain]; diff --git a/Commands/PBOpenDocumentCommand.m b/Commands/PBOpenDocumentCommand.m index 16f6906..ff703ef 100644 --- a/Commands/PBOpenDocumentCommand.m +++ b/Commands/PBOpenDocumentCommand.m @@ -13,7 +13,7 @@ @implementation PBOpenDocumentCommand - (id) initWithDocumentAbsolutePath:(NSString *) path { - if (self = [super initWithDisplayName:@"Open" parameters:nil repository:nil]) { + if ((self = [super initWithDisplayName:@"Open" parameters:nil repository:nil])) { documentURL = [[NSURL alloc] initWithString:path]; } return self; diff --git a/Commands/PBRemoteCommandFactory.m b/Commands/PBRemoteCommandFactory.m index 2b02524..56f3146 100644 --- a/Commands/PBRemoteCommandFactory.m +++ b/Commands/PBRemoteCommandFactory.m @@ -58,7 +58,7 @@ return commands; } -+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository { ++ (NSArray *) commandsForObject:(id) object repository:(PBGitRepository *) repository { if ([object isKindOfClass:[PBGitSubmodule class]]) { return [PBRemoteCommandFactory commandsForSubmodule:(id)object inRepository:repository]; } diff --git a/Commands/PBRevealWithFinderCommand.m b/Commands/PBRevealWithFinderCommand.m index 2f94a58..055825f 100644 --- a/Commands/PBRevealWithFinderCommand.m +++ b/Commands/PBRevealWithFinderCommand.m @@ -17,7 +17,7 @@ return nil; } - if (self = [super initWithDisplayName:@"Reveal in Finder" parameters:nil repository:nil]) { + if ((self = [super initWithDisplayName:@"Reveal in Finder" parameters:nil repository:nil])) { documentURL = [[NSURL alloc] initWithString:path]; } return self; diff --git a/Commands/PBStashCommandFactory.m b/Commands/PBStashCommandFactory.m index 195cd7b..9601b40 100644 --- a/Commands/PBStashCommandFactory.m +++ b/Commands/PBStashCommandFactory.m @@ -22,7 +22,7 @@ @implementation PBStashCommandFactory -+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository { ++ (NSArray *) commandsForObject:(id) object repository:(PBGitRepository *) repository { NSArray *cmds = nil; if ([object isKindOfClass:[PBGitStash class]]) { cmds = [PBStashCommandFactory commandsForStash:(id)object repository:repository]; diff --git a/Controller/PBArgumentPickerController.m b/Controller/PBArgumentPickerController.m index 51d542e..420b547 100644 --- a/Controller/PBArgumentPickerController.m +++ b/Controller/PBArgumentPickerController.m @@ -13,7 +13,7 @@ @implementation PBArgumentPickerController - initWithCommandWithParameter:(PBCommandWithParameter *) aCommand { - if (self = [super initWithWindowNibName:@"PBArgumentPicker" owner:self]) { + if ((self = [super initWithWindowNibName:@"PBArgumentPicker" owner:self])) { cmdWithParameter = [aCommand retain]; } return self; diff --git a/Controller/PBGitResetController.m b/Controller/PBGitResetController.m index 773a74d..c9e5fb6 100644 --- a/Controller/PBGitResetController.m +++ b/Controller/PBGitResetController.m @@ -15,7 +15,7 @@ static NSString * const kCommandKey = @"command"; @implementation PBGitResetController - (id) initWithRepository:(PBGitRepository *) repo { - if (self = [super init]){ + if ((self = [super init])){ repository = [repo retain]; } return self; diff --git a/Controller/PBSubmoduleController.m b/Controller/PBSubmoduleController.m index 7da580b..c789778 100644 --- a/Controller/PBSubmoduleController.m +++ b/Controller/PBSubmoduleController.m @@ -19,7 +19,7 @@ @synthesize submodules; - (id) initWithRepository:(PBGitRepository *) repo { - if (self = [super init]){ + if ((self = [super init])){ repository = [repo retain]; } return self; diff --git a/DBPrefsWindowController.h b/DBPrefsWindowController.h index 5cb711e..417b295 100644 --- a/DBPrefsWindowController.h +++ b/DBPrefsWindowController.h @@ -42,7 +42,7 @@ #import -@interface DBPrefsWindowController : NSWindowController { +@interface DBPrefsWindowController : NSWindowController { NSMutableArray *toolbarIdentifiers; NSMutableDictionary *toolbarViews; NSMutableDictionary *toolbarItems; diff --git a/GLFileView.m b/GLFileView.m index a35b3bf..2c47262 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -485,7 +485,6 @@ int n; for(n=1;n 0); - if (self = [super init]) { + if ((self = [super init])) { unichar status = [submoduleStatusString characterAtIndex:0]; submoduleState = [PBGitSubmodule submoduleStateFromCharacter:status]; NSScanner *scanner = [NSScanner scannerWithString:[submoduleStatusString substringFromIndex:1]]; @@ -47,7 +47,7 @@ shouldContinue = [scanner scanString:@"(" intoString:NULL]; } if (shouldContinue) { - shouldContinue = [scanner scanUpToString:@")" intoString:&coName]; + [scanner scanUpToString:@")" intoString:&coName]; } self.path = [fullPath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; coName = [coName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; diff --git a/PBChangedFile.m b/PBChangedFile.m index 5a7492e..6905d71 100644 --- a/PBChangedFile.m +++ b/PBChangedFile.m @@ -26,9 +26,9 @@ { NSAssert(status == NEW || self.commitBlobSHA, @"File is not new, but doesn't have an index entry!"); if (!self.commitBlobSHA) - return [NSString stringWithFormat:@"0 0000000000000000000000000000000000000000\t%@\0", self.path]; + return [NSString stringWithFormat:@"0 0000000000000000000000000000000000000000\t%@", self.path]; else - return [NSString stringWithFormat:@"%@ %@\t%@\0", self.commitBlobMode, self.commitBlobSHA, self.path]; + return [NSString stringWithFormat:@"%@ %@\t%@", self.commitBlobMode, self.commitBlobSHA, self.path]; } + (NSImage *) iconForStatus:(PBChangedFileStatus) aStatus { diff --git a/PBCommandMenuItem.m b/PBCommandMenuItem.m index 50becd2..8eff7cd 100644 --- a/PBCommandMenuItem.m +++ b/PBCommandMenuItem.m @@ -18,7 +18,7 @@ @synthesize command; - initWithCommand:(PBCommand *) aCommand { - if (self = [super init]) { + if ((self = [super init])) { self.command = aCommand; super.title = [aCommand displayName]; [self setTarget:aCommand]; diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h index d592943..4db3210 100644 --- a/PBGitHistoryController.h +++ b/PBGitHistoryController.h @@ -23,7 +23,7 @@ @class PBHistorySearchController; -@interface PBGitHistoryController : PBViewController { +@interface PBGitHistoryController : PBViewController { IBOutlet PBRefController *refController; IBOutlet NSSearchField *searchField; IBOutlet NSArrayController* commitController; diff --git a/PBGitMenuItem.m b/PBGitMenuItem.m index 38b6895..7d08c79 100644 --- a/PBGitMenuItem.m +++ b/PBGitMenuItem.m @@ -17,7 +17,7 @@ //--------------------------------------------------------------------------------------------- - initWithSourceObject:(id) anObject { - if (self = [super init]) { + if ((self = [super init])) { super.title = [anObject displayDescription]; sourceObject = [anObject retain]; } diff --git a/PBGitRepository.m b/PBGitRepository.m index 50be481..9362568 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -143,7 +143,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; NSURL* gitDirURL = [PBGitRepository gitDirForURL:[self fileURL]]; if (!gitDirURL) { if (outError) { - NSDictionary* userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%@ does not appear to be a git repository.", [self fileName]] + NSDictionary* userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%@ does not appear to be a git repository.", [self fileURL]] forKey:NSLocalizedRecoverySuggestionErrorKey]; *outError = [NSError errorWithDomain:PBGitRepositoryErrorDomain code:0 userInfo:userInfo]; } diff --git a/PBGitRevList.mm b/PBGitRevList.mm index 8ab64e1..18fcdf7 100644 --- a/PBGitRevList.mm +++ b/PBGitRevList.mm @@ -225,7 +225,7 @@ using namespace std; [self performSelectorOnMainThread:@selector(finishedParsing) withObject:nil waitUntilDone:NO]; } else { - NSLog(@"[%@ %s] thread has been canceled", [self class], NSStringFromSelector(_cmd)); + NSLog(@"[%@ %@] thread has been canceled", [self class], NSStringFromSelector(_cmd)); } [task terminate]; diff --git a/PBGitSidebarController.h b/PBGitSidebarController.h index 4126ff9..8bacbe2 100644 --- a/PBGitSidebarController.h +++ b/PBGitSidebarController.h @@ -13,7 +13,7 @@ @class PBGitHistoryController; @class PBGitCommitController; -@interface PBGitSidebarController : PBViewController { +@interface PBGitSidebarController : PBViewController { IBOutlet NSWindow *window; IBOutlet NSOutlineView *sourceView; IBOutlet NSView *sourceListControlsView; diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index eee30ea..a9a936e 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -244,7 +244,7 @@ static NSString * const kObservingContextSubmodules = @"submodulesChanged"; PBSourceViewItem *item = [self selectedItem]; if ([item isKindOfClass:[PBGitMenuItem class]]) { PBGitMenuItem *sidebarItem = (PBGitMenuItem *) item; - NSObject *sourceObject = [sidebarItem sourceObject]; + id sourceObject = [sidebarItem sourceObject]; if ([sourceObject isKindOfClass:[PBGitSubmodule class]]) { [[repository.submoduleController defaultCommandForSubmodule:(id)sourceObject] invoke]; } diff --git a/PBGitTree.m b/PBGitTree.m index f1ba694..dee9114 100644 --- a/PBGitTree.m +++ b/PBGitTree.m @@ -113,16 +113,6 @@ return NO; } -- (BOOL)hasBinaryHeader:(NSString*)contents -{ - if (!contents) - return NO; - - return [contents rangeOfString:@"\0" - options:0 - range:NSMakeRange(0, ([contents length] >= 8000) ? 7999 : [contents length])].location != NSNotFound; -} - - (BOOL)hasBinaryAttributes { // First ask git check-attr if the file has a binary attribute custom set @@ -231,7 +221,7 @@ } res=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff", sha, des,[self fullPath], nil]]; if ([res length]==0) { - NSLog(@"--%d",[res length]); + NSLog(@"--%@",[res length]); if (anError != NULL) { *anError = [NSError errorWithDomain:@"diff" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"No Diff",NSLocalizedDescriptionKey,nil]]; } @@ -296,7 +286,7 @@ NSData* data = [handle readDataToEndOfFile]; [data writeToFile:newName atomically:YES]; } else { // Directory - [[NSFileManager defaultManager] createDirectoryAtPath:newName attributes:nil]; + [[NSFileManager defaultManager] createDirectoryAtPath:newName withIntermediateDirectories:YES attributes:nil error:nil]; for (PBGitTree* child in [self children]) [child saveToFolder: newName]; } @@ -383,7 +373,7 @@ - (void) finalize { if (localFileName) - [[NSFileManager defaultManager] removeFileAtPath:localFileName handler:nil]; + [[NSFileManager defaultManager] removeItemAtPath:localFileName error:nil]; [super finalize]; } @end diff --git a/PBGitWindowController.h b/PBGitWindowController.h index 70b268d..c481fa3 100644 --- a/PBGitWindowController.h +++ b/PBGitWindowController.h @@ -14,7 +14,7 @@ @class PBViewController, PBGitSidebarController, PBGitCommitController; -@interface PBGitWindowController : NSWindowController { +@interface PBGitWindowController : NSWindowController { __weak PBGitRepository* repository; PBViewController *contentController; diff --git a/PBGitWindowController.m b/PBGitWindowController.m index 498ddec..c4a445e 100644 --- a/PBGitWindowController.m +++ b/PBGitWindowController.m @@ -216,7 +216,6 @@ } - (IBAction) changeLayout:(id)sender{ - NSLog(@"selectedSegment=%ld (%d)",[sender selectedSegment],[sender isSelectedForSegment:[sender selectedSegment]]); NSSplitView *sp=nil; switch ([sender selectedSegment]) { case 0: diff --git a/PBGitXProtocol.m b/PBGitXProtocol.m index 052a667..ae06283 100644 --- a/PBGitXProtocol.m +++ b/PBGitXProtocol.m @@ -17,7 +17,7 @@ // note that this leaks! CFRetain(client); - if (self = [super initWithRequest:request cachedResponse:cachedResponse client:client]) + if ((self = [super initWithRequest:request cachedResponse:cachedResponse client:client])) { } diff --git a/PBSourceViewCell.m b/PBSourceViewCell.m index 06221d8..2c9fd5a 100644 --- a/PBSourceViewCell.m +++ b/PBSourceViewCell.m @@ -22,7 +22,7 @@ # pragma mark context menu delegate methods - init { - if (self = [super init]) { + if ((self = [super init])) { } return self; diff --git a/PBStashController.m b/PBStashController.m index eccde18..ec6bcf4 100644 --- a/PBStashController.m +++ b/PBStashController.m @@ -23,7 +23,7 @@ static NSString * const kCommandName = @"stash"; @synthesize stashes; - (id) initWithRepository:(PBGitRepository *) repo { - if (self = [super init]){ + if ((self = [super init])){ repository = [repo retain]; } return self; diff --git a/PBViewController.m b/PBViewController.m index 77e4f3f..a0de1da 100644 --- a/PBViewController.m +++ b/PBViewController.m @@ -19,7 +19,7 @@ { NSString *nibName = [[[self class] description] stringByReplacingOccurrencesOfString:@"Controller" withString:@"View"]; - if(self = [self initWithNibName:nibName bundle:nil]) { + if((self = [self initWithNibName:nibName bundle:nil])) { repository = theRepository; superController = controller; } diff --git a/gitx_askpasswd_main.m b/gitx_askpasswd_main.m index b6a63ce..12fcc93 100644 --- a/gitx_askpasswd_main.m +++ b/gitx_askpasswd_main.m @@ -30,7 +30,7 @@ #define WINDOWAUTOSAVENAME @"GitXAskPasswordWindowFrame" -@interface GAPAppDelegate : NSObject +@interface GAPAppDelegate : NSObject { NSPanel* mPasswordPanel; NSSecureTextField* mPasswordField; @@ -48,7 +48,7 @@ NSString* url; OSStatus StorePasswordKeychain (const char *url, UInt32 urlLength, void* password,UInt32 passwordLength); -@implementation GAPAppDelegate +@implementation GAPAppDelegate -(NSPanel*)passwordPanel:(NSString *)prompt remember:(BOOL)remember { @@ -167,7 +167,7 @@ OSStatus StorePasswordKeychain (const char *url, UInt32 urlLength, void* passw if ((rememberCheck!=nil) && [rememberCheck state]==NSOnState) { OSStatus status = StorePasswordKeychain ([url cStringUsingEncoding:NSASCIIStringEncoding], [url lengthOfBytesUsingEncoding:NSASCIIStringEncoding], - [pas cStringUsingEncoding:NSASCIIStringEncoding], + (void *)[pas cStringUsingEncoding:NSASCIIStringEncoding], [pas lengthOfBytesUsingEncoding:NSASCIIStringEncoding]); //Call if (status != noErr) { [[NSApplication sharedApplication] stopModalWithCode:-1]; @@ -329,7 +329,7 @@ int main( int argc, const char* argv[] ) void *passwordData = nil; SecKeychainItemRef itemRef = nil; - UInt32 passwordLength = nil; + UInt32 passwordLength = 0; OSStatus status = GetPasswordKeychain ([url cStringUsingEncoding:NSASCIIStringEncoding],[url lengthOfBytesUsingEncoding:NSASCIIStringEncoding],&passwordData,&passwordLength,&itemRef); if (status == noErr) {