Skip to content

Commit b7f797e

Browse files
author
Rowan James
committed
Fix many errors shown by analysis tool
1 parent 00cb9c6 commit b7f797e

8 files changed

+22
-11
lines changed

OpenRecentController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ - (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySe
119119

120120
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
121121
{
122-
id theValue;
122+
id theValue = nil;
123123
NSParameterAssert(rowIndex >= 0 && rowIndex < [currentResults count]);
124124

125125
NSURL* row = [currentResults objectAtIndex:rowIndex];

PBChangedFile.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ @implementation PBChangedFile
1515

1616
- (id) initWithPath:(NSString *)p
1717
{
18-
if (![super init])
19-
return nil;
20-
21-
path = p;
18+
self = [super init];
19+
20+
if (self) {
21+
path = p;
22+
}
2223
return self;
2324
}
2425

PBDiffWindowController.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ @implementation PBDiffWindowController
1717

1818
- (id) initWithDiff:(NSString *)aDiff
1919
{
20-
if (![super initWithWindowNibName:@"PBDiffWindow"])
21-
return nil;
20+
self = [super initWithWindowNibName:@"PBDiffWindow"];
2221

23-
diff = aDiff;
22+
if (self)
23+
diff = aDiff;
24+
2425
return self;
2526
}
2627

PBEasyPipe.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ + (NSString*) outputForCommand: (NSString*) cmd withArgs: (NSArray*) args inDir
115115

116116
[task launch];
117117
// This can cause a "Bad file descriptor"... when?
118-
NSData *data;
118+
NSData *data = nil;
119119
@try {
120120
data = [handle readDataToEndOfFile];
121121
}

PBGitHistoryGrapher.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ @implementation PBGitHistoryGrapher
1616

1717
- (id) initWithBaseCommits:(NSSet *)commits viewAllBranches:(BOOL)viewAll queue:(NSOperationQueue *)queue delegate:(id)theDelegate
1818
{
19+
self = [super init];
20+
1921
delegate = theDelegate;
2022
currentQueue = queue;
2123
searchSHAs = [NSMutableSet setWithSet:commits];

PBGitHistoryList.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ @implementation PBGitHistoryList
4545

4646
- (id) initWithRepository:(PBGitRepository *)repo
4747
{
48+
self = [super init];
49+
4850
commits = [NSMutableArray array];
4951
repository = repo;
5052
lastBranchFilter = -1;

PBGitRepositoryWatcher.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ @implementation PBGitRepositoryWatcher
4545
@synthesize repository;
4646

4747
- (id) initWithRepository:(PBGitRepository *)theRepository {
48-
if (self != [super init])
49-
return nil;
48+
self = [super init];
49+
if (!self)
50+
return nil;
5051

5152
repository = theRepository;
5253
FSEventStreamContext context = {0, self, NULL, NULL, NULL};

PBGitRevSpecifier.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ @implementation PBGitRevSpecifier
1818
// internal designated init
1919
- (id) initWithParameters:(NSArray *)params description:(NSString *)descrip
2020
{
21+
self = [super init];
2122
parameters = params;
2223
description = descrip;
2324

@@ -38,18 +39,21 @@ - (id) initWithParameters:(NSArray *)params description:(NSString *)descrip
3839

3940
- (id) initWithParameters:(NSArray *)params
4041
{
42+
self = [super init];
4143
[self initWithParameters:params description:nil];
4244
return self;
4345
}
4446

4547
- (id) initWithRef:(PBGitRef *)ref
4648
{
49+
self = [super init];
4750
[self initWithParameters:[NSArray arrayWithObject:ref.ref] description:ref.shortName];
4851
return self;
4952
}
5053

5154
- (id) initWithCoder:(NSCoder *)coder
5255
{
56+
self = [super init];
5357
[self initWithParameters:[coder decodeObjectForKey:@"Parameters"] description:[coder decodeObjectForKey:@"Description"]];
5458
return self;
5559
}

0 commit comments

Comments
 (0)