performed a code review, specifically:

- changed some #include to #import
- fixed some NULL -> nil Cocoa coding conventions
- added new compiler warnings and fixed some warnings they generated
- check for nil from NSTemporaryDirectory
- added missing files to unit test and test app targets
- added xcconfig files for unit test target
- added @private to some ivars
- changes some variables from signed to unsigned as appropriate
- changed from base 2 to base 10 measurements of file size, consistent with both the actual meaning of metric prefixes and Apple's new policy as of 10.6
- reduced some unneeded copy-paste of code
- fixed failure to check for null from malloc and unneeded check against null before calling free
- OSErr was incorrectly used instead of OSStatus
- added some consts & statics to global strings
- fixed some issues discovered by static analysis
- fixed some 64bit issues, mostly related to casting and the use of slightly incorrect types/sizes
- some dealloc methods were using accessors, changed to access ivars directly, as per Apple guidelines
- removed old NS_DURING, NS_HANDLER, NS_ENDHANDLER macros
- fixed a bug where immutable data was being mutated
- removed all instance of "== YES" as they are dangerous
- removed some redundant nil checks
- fixed some leaks
- conditionally replaced deprecated method usage
- cleanup CF/NSMakeCollectable usage
- fixed bug in GC where memory could be collected too early due to lack of strong references when using UTF8String
- prevent passing null to CFRelease
This commit is contained in:
Sean McBride committed 2009-10-31 21:07:00 -04:00
1 parent bd80144c7b
commit d7774c0dc0
43 files changed
+307 -281

No files matched your search

+10 -15
View File
@@ -56,10 +56,10 @@
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self setTask:nil];
[self setOutputPipe:nil];
[self setInputPipe:nil];
[self setOutput:nil];
[mv_task release];
[mv_outputPipe release];
[mv_inputPipe release];
[mv_output release];
[super dealloc];
}
@@ -70,7 +70,7 @@
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSData* result=nil;
NS_DURING
@try
{
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
@@ -81,8 +81,7 @@
[task release];
}
NS_HANDLER;
NS_ENDHANDLER;
@catch (NSException *localException) { }
[pool drain];
@@ -92,10 +91,6 @@
return result;
}
@end
@implementation NTSynchronousTask (Private)
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
{
BOOL success = NO;
@@ -118,12 +113,12 @@
[[[self outputPipe] fileHandleForReading] readToEndOfFileInBackgroundAndNotifyForModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, NSEventTrackingRunLoopMode, nil]];
NS_DURING
@try
{
[[self task] launch];
success = YES;
NS_HANDLER
;
NS_ENDHANDLER
}
@catch (NSException *localException) { }
if (success)
{