Skip to content

Commit f9ccf1f

Browse files
committed
Solved compilation warnings
1 parent abbb208 commit f9ccf1f

31 files changed

+41
-49
lines changed

ApplicationController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ - (NSPersistentStoreCoordinator *) persistentStoreCoordinator {
245245
fileManager = [NSFileManager defaultManager];
246246
applicationSupportFolder = [self applicationSupportFolder];
247247
if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) {
248-
[fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil];
248+
[fileManager createDirectoryAtPath:applicationSupportFolder withIntermediateDirectories:YES attributes:nil error:nil];
249249
}
250250

251251
url = [NSURL fileURLWithPath: [applicationSupportFolder stringByAppendingPathComponent: @"GitTest.xml"]];

Commands/PBCommandFactory.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
#import "PBGitRepository.h"
1010

1111
@protocol PBCommandFactory
12-
+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository;
12+
+ (NSArray *) commandsForObject:(id<PBPresentable>) object repository:(PBGitRepository *) repository;
1313
@end

Commands/PBCommandWithParameter.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @implementation PBCommandWithParameter
1616
@synthesize parameterDisplayName;
1717

1818
- initWithCommand:(PBCommand *) aCommand parameterName:(NSString *) param parameterDisplayName:(NSString *) paramDisplayName {
19-
if (self = [super initWithDisplayName:[aCommand displayName] parameters:nil repository:[aCommand repository]]) {
19+
if ((self = [super initWithDisplayName:[aCommand displayName] parameters:nil repository:[aCommand repository]])) {
2020
command = [aCommand retain];
2121
parameterName = [param retain];
2222
parameterDisplayName = [paramDisplayName retain];

Commands/PBOpenDocumentCommand.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@implementation PBOpenDocumentCommand
1414

1515
- (id) initWithDocumentAbsolutePath:(NSString *) path {
16-
if (self = [super initWithDisplayName:@"Open" parameters:nil repository:nil]) {
16+
if ((self = [super initWithDisplayName:@"Open" parameters:nil repository:nil])) {
1717
documentURL = [[NSURL alloc] initWithString:path];
1818
}
1919
return self;

Commands/PBRemoteCommandFactory.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ + (NSArray *) commandsForSubmodule:(PBGitSubmodule *) submodule inRepository:(PB
5858
return commands;
5959
}
6060

61-
+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository {
61+
+ (NSArray *) commandsForObject:(id<PBPresentable>) object repository:(PBGitRepository *) repository {
6262
if ([object isKindOfClass:[PBGitSubmodule class]]) {
6363
return [PBRemoteCommandFactory commandsForSubmodule:(id)object inRepository:repository];
6464
}

Commands/PBRevealWithFinderCommand.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ - (id) initWithDocumentAbsolutePath:(NSString *) path {
1717
return nil;
1818
}
1919

20-
if (self = [super initWithDisplayName:@"Reveal in Finder" parameters:nil repository:nil]) {
20+
if ((self = [super initWithDisplayName:@"Reveal in Finder" parameters:nil repository:nil])) {
2121
documentURL = [[NSURL alloc] initWithString:path];
2222
}
2323
return self;

Commands/PBStashCommandFactory.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ + (NSArray *) commandsForRef:(PBGitRef *) ref repository:(PBGitRepository *) rep
2222

2323
@implementation PBStashCommandFactory
2424

25-
+ (NSArray *) commandsForObject:(NSObject *) object repository:(PBGitRepository *) repository {
25+
+ (NSArray *) commandsForObject:(id<PBPresentable>) object repository:(PBGitRepository *) repository {
2626
NSArray *cmds = nil;
2727
if ([object isKindOfClass:[PBGitStash class]]) {
2828
cmds = [PBStashCommandFactory commandsForStash:(id)object repository:repository];

Controller/PBArgumentPickerController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@implementation PBArgumentPickerController
1414

1515
- initWithCommandWithParameter:(PBCommandWithParameter *) aCommand {
16-
if (self = [super initWithWindowNibName:@"PBArgumentPicker" owner:self]) {
16+
if ((self = [super initWithWindowNibName:@"PBArgumentPicker" owner:self])) {
1717
cmdWithParameter = [aCommand retain];
1818
}
1919
return self;

Controller/PBGitResetController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@implementation PBGitResetController
1616

1717
- (id) initWithRepository:(PBGitRepository *) repo {
18-
if (self = [super init]){
18+
if ((self = [super init])){
1919
repository = [repo retain];
2020
}
2121
return self;

Controller/PBSubmoduleController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ @implementation PBSubmoduleController
1919
@synthesize submodules;
2020

2121
- (id) initWithRepository:(PBGitRepository *) repo {
22-
if (self = [super init]){
22+
if ((self = [super init])){
2323
repository = [repo retain];
2424
}
2525
return self;

DBPrefsWindowController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#import <Cocoa/Cocoa.h>
4343

4444

45-
@interface DBPrefsWindowController : NSWindowController {
45+
@interface DBPrefsWindowController : NSWindowController <NSAnimationDelegate,NSToolbarDelegate>{
4646
NSMutableArray *toolbarIdentifiers;
4747
NSMutableDictionary *toolbarViews;
4848
NSMutableDictionary *toolbarItems;

GLFileView.m

-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ - (NSString *) parseBlame:(NSString *)txt
485485

486486
int n;
487487
for(n=1;n<nLines;n++){
488-
line=[lines objectAtIndex:i++];
489488
do{
490489
line=[lines objectAtIndex:i++];
491490
}while([line characterAtIndex:0]!='\t');

GitX.xcodeproj/project.pbxproj

+6-2
Original file line numberDiff line numberDiff line change
@@ -2005,6 +2005,7 @@
20052005
GCC_DYNAMIC_NO_PIC = NO;
20062006
GCC_OPTIMIZATION_LEVEL = 0;
20072007
PRODUCT_NAME = "Generate PList Prefix";
2008+
SDKROOT = "";
20082009
};
20092010
name = Debug;
20102011
};
@@ -2016,6 +2017,7 @@
20162017
GCC_ENABLE_FIX_AND_CONTINUE = NO;
20172018
INFOPLIST_PREPROCESS = YES;
20182019
PRODUCT_NAME = "Generate PList Prefix";
2020+
SDKROOT = "";
20192021
ZERO_LINK = NO;
20202022
};
20212023
name = Release;
@@ -2052,6 +2054,7 @@
20522054
);
20532055
PREBINDING = NO;
20542056
PRODUCT_NAME = GitXTesting;
2057+
SDKROOT = "";
20552058
};
20562059
name = Debug;
20572060
};
@@ -2082,6 +2085,7 @@
20822085
);
20832086
PREBINDING = NO;
20842087
PRODUCT_NAME = GitXTesting;
2088+
SDKROOT = "";
20852089
ZERO_LINK = NO;
20862090
};
20872091
name = Release;
@@ -2111,7 +2115,7 @@
21112115
);
21122116
PREBINDING = NO;
21132117
PRODUCT_NAME = SpeedTest;
2114-
SDKROOT = macosx10.5;
2118+
SDKROOT = "";
21152119
};
21162120
name = Debug;
21172121
};
@@ -2136,7 +2140,7 @@
21362140
);
21372141
PREBINDING = NO;
21382142
PRODUCT_NAME = SpeedTest;
2139-
SDKROOT = iphoneos2.0;
2143+
SDKROOT = "";
21402144
ZERO_LINK = NO;
21412145
};
21422146
name = Release;

Model/PBGitStash.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @implementation PBGitStash
1616
@synthesize stashSourceMessage;
1717

1818
- initWithRawStashLine:(NSString *) stashLineFromStashListOutput {
19-
if (self = [super init]) {
19+
if ((self = [super init])) {
2020
stashRawString = [stashLineFromStashListOutput retain];
2121
NSArray *lineComponents = [stashLineFromStashListOutput componentsSeparatedByString:@":"];
2222
name = [[lineComponents objectAtIndex:0] retain];

Model/PBGitSubmodule.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ - (NSMutableArray *) submodules {
3232
- (id) initWithRawSubmoduleStatusString:(NSString *) submoduleStatusString {
3333
NSParameterAssert([submoduleStatusString length] > 0);
3434

35-
if (self = [super init]) {
35+
if ((self = [super init])) {
3636
unichar status = [submoduleStatusString characterAtIndex:0];
3737
submoduleState = [PBGitSubmodule submoduleStateFromCharacter:status];
3838
NSScanner *scanner = [NSScanner scannerWithString:[submoduleStatusString substringFromIndex:1]];
@@ -47,7 +47,7 @@ - (id) initWithRawSubmoduleStatusString:(NSString *) submoduleStatusString {
4747
shouldContinue = [scanner scanString:@"(" intoString:NULL];
4848
}
4949
if (shouldContinue) {
50-
shouldContinue = [scanner scanUpToString:@")" intoString:&coName];
50+
[scanner scanUpToString:@")" intoString:&coName];
5151
}
5252
self.path = [fullPath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
5353
coName = [coName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

PBChangedFile.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ - (NSString *)indexInfo
2626
{
2727
NSAssert(status == NEW || self.commitBlobSHA, @"File is not new, but doesn't have an index entry!");
2828
if (!self.commitBlobSHA)
29-
return [NSString stringWithFormat:@"0 0000000000000000000000000000000000000000\t%@\0", self.path];
29+
return [NSString stringWithFormat:@"0 0000000000000000000000000000000000000000\t%@", self.path];
3030
else
31-
return [NSString stringWithFormat:@"%@ %@\t%@\0", self.commitBlobMode, self.commitBlobSHA, self.path];
31+
return [NSString stringWithFormat:@"%@ %@\t%@", self.commitBlobMode, self.commitBlobSHA, self.path];
3232
}
3333

3434
+ (NSImage *) iconForStatus:(PBChangedFileStatus) aStatus {

PBCommandMenuItem.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ @implementation PBCommandMenuItem
1818
@synthesize command;
1919

2020
- initWithCommand:(PBCommand *) aCommand {
21-
if (self = [super init]) {
21+
if ((self = [super init])) {
2222
self.command = aCommand;
2323
super.title = [aCommand displayName];
2424
[self setTarget:aCommand];

PBGitHistoryController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
@class PBHistorySearchController;
2525

26-
@interface PBGitHistoryController : PBViewController {
26+
@interface PBGitHistoryController : PBViewController <NSOutlineViewDelegate>{
2727
IBOutlet PBRefController *refController;
2828
IBOutlet NSSearchField *searchField;
2929
IBOutlet NSArrayController* commitController;

PBGitMenuItem.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ @implementation PBGitMenuItem
1717
//---------------------------------------------------------------------------------------------
1818

1919
- initWithSourceObject:(id<PBPresentable>) anObject {
20-
if (self = [super init]) {
20+
if ((self = [super init])) {
2121
super.title = [anObject displayDescription];
2222
sourceObject = [anObject retain];
2323
}

PBGitRepository.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSEr
143143
NSURL* gitDirURL = [PBGitRepository gitDirForURL:[self fileURL]];
144144
if (!gitDirURL) {
145145
if (outError) {
146-
NSDictionary* userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%@ does not appear to be a git repository.", [self fileName]]
146+
NSDictionary* userInfo = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%@ does not appear to be a git repository.", [self fileURL]]
147147
forKey:NSLocalizedRecoverySuggestionErrorKey];
148148
*outError = [NSError errorWithDomain:PBGitRepositoryErrorDomain code:0 userInfo:userInfo];
149149
}

PBGitRevList.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ - (void) walkRevisionListWithSpecifier:(PBGitRevSpecifier*)rev
225225
[self performSelectorOnMainThread:@selector(finishedParsing) withObject:nil waitUntilDone:NO];
226226
}
227227
else {
228-
NSLog(@"[%@ %s] thread has been canceled", [self class], NSStringFromSelector(_cmd));
228+
NSLog(@"[%@ %@] thread has been canceled", [self class], NSStringFromSelector(_cmd));
229229
}
230230

231231
[task terminate];

PBGitSidebarController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@class PBGitHistoryController;
1414
@class PBGitCommitController;
1515

16-
@interface PBGitSidebarController : PBViewController {
16+
@interface PBGitSidebarController : PBViewController <NSOutlineViewDelegate>{
1717
IBOutlet NSWindow *window;
1818
IBOutlet NSOutlineView *sourceView;
1919
IBOutlet NSView *sourceListControlsView;

PBGitSidebarController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ - (void) outlineDoubleClicked {
244244
PBSourceViewItem *item = [self selectedItem];
245245
if ([item isKindOfClass:[PBGitMenuItem class]]) {
246246
PBGitMenuItem *sidebarItem = (PBGitMenuItem *) item;
247-
NSObject *sourceObject = [sidebarItem sourceObject];
247+
id<PBPresentable> sourceObject = [sidebarItem sourceObject];
248248
if ([sourceObject isKindOfClass:[PBGitSubmodule class]]) {
249249
[[repository.submoduleController defaultCommandForSubmodule:(id)sourceObject] invoke];
250250
}

PBGitTree.m

+3-13
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,6 @@ - (BOOL) isLocallyCached
113113
return NO;
114114
}
115115

116-
- (BOOL)hasBinaryHeader:(NSString*)contents
117-
{
118-
if (!contents)
119-
return NO;
120-
121-
return [contents rangeOfString:@"\0"
122-
options:0
123-
range:NSMakeRange(0, ([contents length] >= 8000) ? 7999 : [contents length])].location != NSNotFound;
124-
}
125-
126116
- (BOOL)hasBinaryAttributes
127117
{
128118
// First ask git check-attr if the file has a binary attribute custom set
@@ -231,7 +221,7 @@ - (NSString *) diff:(NSString *)format error:(NSError **)anError
231221
}
232222
res=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff", sha, des,[self fullPath], nil]];
233223
if ([res length]==0) {
234-
NSLog(@"--%d",[res length]);
224+
NSLog(@"--%@",[res length]);
235225
if (anError != NULL) {
236226
*anError = [NSError errorWithDomain:@"diff" code:1 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"No Diff",NSLocalizedDescriptionKey,nil]];
237227
}
@@ -296,7 +286,7 @@ - (void) saveToFolder: (NSString *) dir
296286
NSData* data = [handle readDataToEndOfFile];
297287
[data writeToFile:newName atomically:YES];
298288
} else { // Directory
299-
[[NSFileManager defaultManager] createDirectoryAtPath:newName attributes:nil];
289+
[[NSFileManager defaultManager] createDirectoryAtPath:newName withIntermediateDirectories:YES attributes:nil error:nil];
300290
for (PBGitTree* child in [self children])
301291
[child saveToFolder: newName];
302292
}
@@ -383,7 +373,7 @@ - (NSString*) fullPath
383373
- (void) finalize
384374
{
385375
if (localFileName)
386-
[[NSFileManager defaultManager] removeFileAtPath:localFileName handler:nil];
376+
[[NSFileManager defaultManager] removeItemAtPath:localFileName error:nil];
387377
[super finalize];
388378
}
389379
@end

PBGitWindowController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
@class PBViewController, PBGitSidebarController, PBGitCommitController;
1616

17-
@interface PBGitWindowController : NSWindowController {
17+
@interface PBGitWindowController : NSWindowController <NSWindowDelegate>{
1818
__weak PBGitRepository* repository;
1919

2020
PBViewController *contentController;

PBGitWindowController.m

-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ - (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode
216216
}
217217

218218
- (IBAction) changeLayout:(id)sender{
219-
NSLog(@"selectedSegment=%ld (%d)",[sender selectedSegment],[sender isSelectedForSegment:[sender selectedSegment]]);
220219
NSSplitView *sp=nil;
221220
switch ([sender selectedSegment]) {
222221
case 0:

PBGitXProtocol.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ - (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLRespons
1717
// note that this leaks!
1818
CFRetain(client);
1919

20-
if (self = [super initWithRequest:request cachedResponse:cachedResponse client:client])
20+
if ((self = [super initWithRequest:request cachedResponse:cachedResponse client:client]))
2121
{
2222
}
2323

PBSourceViewCell.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ @implementation PBSourceViewCell
2222
# pragma mark context menu delegate methods
2323

2424
- init {
25-
if (self = [super init]) {
25+
if ((self = [super init])) {
2626

2727
}
2828
return self;

PBStashController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ @implementation PBStashController
2323
@synthesize stashes;
2424

2525
- (id) initWithRepository:(PBGitRepository *) repo {
26-
if (self = [super init]){
26+
if ((self = [super init])){
2727
repository = [repo retain];
2828
}
2929
return self;

PBViewController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ - (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGit
1919
{
2020
NSString *nibName = [[[self class] description] stringByReplacingOccurrencesOfString:@"Controller"
2121
withString:@"View"];
22-
if(self = [self initWithNibName:nibName bundle:nil]) {
22+
if((self = [self initWithNibName:nibName bundle:nil])) {
2323
repository = theRepository;
2424
superController = controller;
2525
}

gitx_askpasswd_main.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define WINDOWAUTOSAVENAME @"GitXAskPasswordWindowFrame"
3131

3232

33-
@interface GAPAppDelegate : NSObject
33+
@interface GAPAppDelegate : NSObject <NSApplicationDelegate>
3434
{
3535
NSPanel* mPasswordPanel;
3636
NSSecureTextField* mPasswordField;
@@ -48,7 +48,7 @@ -(IBAction) doCancelButton: (id)sender;
4848
OSStatus StorePasswordKeychain (const char *url, UInt32 urlLength, void* password,UInt32 passwordLength);
4949

5050

51-
@implementation GAPAppDelegate
51+
@implementation GAPAppDelegate
5252

5353
-(NSPanel*)passwordPanel:(NSString *)prompt remember:(BOOL)remember
5454
{
@@ -167,7 +167,7 @@ -(IBAction) doOKButton: (id)sender
167167
if ((rememberCheck!=nil) && [rememberCheck state]==NSOnState) {
168168
OSStatus status = StorePasswordKeychain ([url cStringUsingEncoding:NSASCIIStringEncoding],
169169
[url lengthOfBytesUsingEncoding:NSASCIIStringEncoding],
170-
[pas cStringUsingEncoding:NSASCIIStringEncoding],
170+
(void *)[pas cStringUsingEncoding:NSASCIIStringEncoding],
171171
[pas lengthOfBytesUsingEncoding:NSASCIIStringEncoding]); //Call
172172
if (status != noErr) {
173173
[[NSApplication sharedApplication] stopModalWithCode:-1];
@@ -329,7 +329,7 @@ int main( int argc, const char* argv[] )
329329

330330
void *passwordData = nil;
331331
SecKeychainItemRef itemRef = nil;
332-
UInt32 passwordLength = nil;
332+
UInt32 passwordLength = 0;
333333

334334
OSStatus status = GetPasswordKeychain ([url cStringUsingEncoding:NSASCIIStringEncoding],[url lengthOfBytesUsingEncoding:NSASCIIStringEncoding],&passwordData,&passwordLength,&itemRef);
335335
if (status == noErr) {

0 commit comments

Comments
 (0)