From fee6778710c82dfbee04ab23061a96d324facfdb Mon Sep 17 00:00:00 2001 From: "thomasvl@gmail.com" Date: Thu, 5 Mar 2009 21:30:41 +0000 Subject: - Changed gtm_createCGPath to gtm_cgPath in GTMNSBezier+CGPath. The path returned is now autoreleased so you don't need to worry about releasing it. - Made some changes to the GTMNSObject+UnitTesting APIs. Specifically renamed gtm_createUnitTestImage to gtm_unitTestImage. The value it returns is now autoreleased, so no need to release it. Also change gtm_createUnitTestBitmapOfSize:withData: to a C function. - Cleaned up GTM so that it passes the Clang checker without any warnings. --- AppKit/GTMHotKeyTextField.m | 2 +- AppKit/GTMNSBezierPath+CGPath.h | 4 ++-- AppKit/GTMNSBezierPath+CGPath.m | 7 ++++--- AppKit/GTMNSBezierPath+CGPathTest.m | 5 ++--- AppKit/GTMNSBezierPath+Shading.m | 14 +++++--------- 5 files changed, 14 insertions(+), 18 deletions(-) (limited to 'AppKit') diff --git a/AppKit/GTMHotKeyTextField.m b/AppKit/GTMHotKeyTextField.m index 6410041..6573743 100644 --- a/AppKit/GTMHotKeyTextField.m +++ b/AppKit/GTMHotKeyTextField.m @@ -209,7 +209,7 @@ static CFStringRef kGTM_TISPropertyUnicodeKeyLayoutData = NULL; #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 -- (int)integerValue { +- (NSInteger)integerValue { // Defeating NSControl _GTMDevAssert(NO, @"Hot key fields don't take numbers."); diff --git a/AppKit/GTMNSBezierPath+CGPath.h b/AppKit/GTMNSBezierPath+CGPath.h index 3349142..a1b022e 100644 --- a/AppKit/GTMNSBezierPath+CGPath.h +++ b/AppKit/GTMNSBezierPath+CGPath.h @@ -26,8 +26,8 @@ // Args: // // Returns: -// Converted CGPathRef. Must be released by client (CGPathRelease). +// Converted autoreleased CGPathRef. // nil if failure. -- (CGPathRef)gtm_createCGPath; +- (CGPathRef)gtm_CGPath; @end diff --git a/AppKit/GTMNSBezierPath+CGPath.m b/AppKit/GTMNSBezierPath+CGPath.m index 656a139..3624d9e 100644 --- a/AppKit/GTMNSBezierPath+CGPath.m +++ b/AppKit/GTMNSBezierPath+CGPath.m @@ -19,6 +19,7 @@ // #import "GTMNSBezierPath+CGPath.h" #import "GTMDefines.h" +#import "GTMGarbageCollection.h" @implementation NSBezierPath (GTMBezierPathCGPathAdditions) @@ -27,9 +28,9 @@ // Args: // // Returns: -// Converted CGPathRef. Must be released by client (CGPathRelease). +// Converted CGPathRef. // nil if failure. -- (CGPathRef)gtm_createCGPath { +- (CGPathRef)gtm_CGPath { CGMutablePathRef thePath = CGPathCreateMutable(); if (!thePath) return nil; @@ -63,7 +64,7 @@ break; // COV_NF_END }; } - return thePath; + return (CGPathRef)GTMCFAutorelease(thePath); } @end diff --git a/AppKit/GTMNSBezierPath+CGPathTest.m b/AppKit/GTMNSBezierPath+CGPathTest.m index eb86353..3c99a19 100644 --- a/AppKit/GTMNSBezierPath+CGPathTest.m +++ b/AppKit/GTMNSBezierPath+CGPathTest.m @@ -28,7 +28,7 @@ @implementation GTMNSBezierPath_CGPathTest -- (void)testCreateCGPath { +- (void)testCGPath { GTMAssertDrawingEqualToImageNamed(self, NSMakeSize(100, 100), @"GTMNSBezierPath+CGPathTest", @@ -62,7 +62,7 @@ // test close [thePath closePath]; - CGPathRef cgPath = [thePath gtm_createCGPath]; + CGPathRef cgPath = [thePath gtm_CGPath]; STAssertNotNULL(cgPath, @"Nil CGPath"); CGContextRef cgContext = [[NSGraphicsContext currentContext] graphicsPort]; @@ -70,7 +70,6 @@ CGContextAddPath(cgContext, cgPath); CGContextStrokePath(cgContext); - CGPathRelease(cgPath); } @end diff --git a/AppKit/GTMNSBezierPath+Shading.m b/AppKit/GTMNSBezierPath+Shading.m index f75876f..d4c1ddd 100644 --- a/AppKit/GTMNSBezierPath+Shading.m +++ b/AppKit/GTMNSBezierPath+Shading.m @@ -154,19 +154,18 @@ @implementation NSBezierPath (GTMBezierPathShadingAdditions) -GTM_METHOD_CHECK(NSBezierPath, gtm_createCGPath); +GTM_METHOD_CHECK(NSBezierPath, gtm_CGPath); - (void)gtm_strokeAxiallyFrom:(NSPoint)fromPoint to:(NSPoint)toPoint extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd shading:(id)shading { - CGPathRef thePath = [self gtm_createCGPath]; + CGPathRef thePath = [self gtm_CGPath]; if (nil != thePath) { [self gtm_fillCGPath:thePath axially:YES asStroke:YES from:fromPoint fromRadius:(CGFloat)0.0 to:toPoint toRadius:(CGFloat)0.0 extendingStart:extendingStart extendingEnd:extendingEnd shading:shading]; - CGPathRelease(thePath); } } @@ -175,14 +174,13 @@ GTM_METHOD_CHECK(NSBezierPath, gtm_createCGPath); to:(NSPoint)toPoint toRadius:(CGFloat)toRadius extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd shading:(id)shading { - CGPathRef thePath = [self gtm_createCGPath]; + CGPathRef thePath = [self gtm_CGPath]; if (nil != thePath) { [self gtm_fillCGPath:thePath axially:NO asStroke:YES from:fromPoint fromRadius:fromRadius to:toPoint toRadius:toRadius extendingStart:extendingStart extendingEnd:extendingEnd shading:shading]; - CGPathRelease(thePath); } } @@ -190,14 +188,13 @@ GTM_METHOD_CHECK(NSBezierPath, gtm_createCGPath); - (void)gtm_fillAxiallyFrom:(NSPoint)fromPoint to:(NSPoint)toPoint extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd shading:(id)shading { - CGPathRef thePath = [self gtm_createCGPath]; + CGPathRef thePath = [self gtm_CGPath]; if (nil != thePath) { [self gtm_fillCGPath:thePath axially:YES asStroke:NO from:fromPoint fromRadius:(CGFloat)0.0 to:toPoint toRadius:(CGFloat)0.0 extendingStart:extendingStart extendingEnd:extendingEnd shading:shading]; - CGPathRelease(thePath); } } @@ -206,14 +203,13 @@ GTM_METHOD_CHECK(NSBezierPath, gtm_createCGPath); to:(NSPoint)toPoint toRadius:(CGFloat)toRadius extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd shading:(id)shading { - CGPathRef thePath = [self gtm_createCGPath]; + CGPathRef thePath = [self gtm_CGPath]; if (nil != thePath) { [self gtm_fillCGPath:thePath axially:NO asStroke:NO from:fromPoint fromRadius:fromRadius to:toPoint toRadius:toRadius extendingStart:extendingStart extendingEnd:extendingEnd shading:shading]; - CGPathRelease(thePath); } } -- cgit v1.2.3