aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AppKit/GTMLargeTypeWindow.m10
-rw-r--r--AppKit/GTMLinearRGBShading.m2
-rw-r--r--AppKit/GTMLoginItems.m4
-rw-r--r--Foundation/GTMBase64.m2
-rw-r--r--Foundation/GTMGarbageCollection.h19
-rw-r--r--Foundation/GTMHTTPServer.m6
-rw-r--r--GTMDefines.h18
-rw-r--r--UnitTesting/GTMNSObject+UnitTesting.m2
8 files changed, 30 insertions, 33 deletions
diff --git a/AppKit/GTMLargeTypeWindow.m b/AppKit/GTMLargeTypeWindow.m
index 0c07f87..97847aa 100644
--- a/AppKit/GTMLargeTypeWindow.m
+++ b/AppKit/GTMLargeTypeWindow.m
@@ -151,7 +151,7 @@ static const CGFloat kTwoThirdsAlpha = 0.66;
if (view) {
bounds = [view bounds];
}
- if (bounds.size.height <= 0 || bounds.size.width <= 0) {
+ if (!view || bounds.size.height <= 0 || bounds.size.width <= 0) {
_GTMDevLog(@"GTMLargeTypeWindow got an empty view");
[self release];
return nil;
@@ -271,6 +271,14 @@ static const CGFloat kTwoThirdsAlpha = 0.66;
@implementation GTMLargeTypeBackgroundView
GTM_METHOD_CHECK(NSBezierPath, gtm_appendBezierPathWithRoundRect:cornerRadius:);
+- (void)dealloc {
+ // If we get released while animating, we'd better clean up.
+ [animation_ stopAnimation];
+ [animation_ release];
+ [transition_ release];
+ [super dealloc];
+}
+
- (BOOL)isOpaque {
return NO;
}
diff --git a/AppKit/GTMLinearRGBShading.m b/AppKit/GTMLinearRGBShading.m
index af70086..9434186 100644
--- a/AppKit/GTMLinearRGBShading.m
+++ b/AppKit/GTMLinearRGBShading.m
@@ -98,7 +98,6 @@ static void cShadeFunction(void *info, const CGFloat *inPos, CGFloat *outVals);
positionIndex += 1;
CGFloat stop2Position = 0.0;
NSColor *stop2Color = nil;
- NSColor *theColor = nil;
if (colorCount > 1) {
stop2Color = [self stopAtIndex:positionIndex position:&stop2Position];
positionIndex += 1;
@@ -117,7 +116,6 @@ static void cShadeFunction(void *info, const CGFloat *inPos, CGFloat *outVals);
if (position <= stop1Position) {
// if we are less than our lowest position, return our first color
- theColor = stop1Color;
[stop1Color getRed:&colorValue_[0] green:&colorValue_[1]
blue:&colorValue_[2] alpha:&colorValue_[3]];
} else if (position >= stop2Position) {
diff --git a/AppKit/GTMLoginItems.m b/AppKit/GTMLoginItems.m
index c3dedfe..f124ef5 100644
--- a/AppKit/GTMLoginItems.m
+++ b/AppKit/GTMLoginItems.m
@@ -74,7 +74,7 @@ NSString * const kGTMLoginItemsHiddenKey = @"Hide";
NSAppleEventDescriptor *scriptResult = [query executeAndReturnError:&errDict];
if (!scriptResult) {
// COV_NF_START - no real way to test this
- if (*errorInfo)
+ if (errorInfo)
*errorInfo = [NSError errorWithDomain:@"GTMLoginItems" code:-92 userInfo:errDict];
return NO;
// COV_NF_END
@@ -108,7 +108,7 @@ NSString * const kGTMLoginItemsHiddenKey = @"Hide";
NSAppleEventDescriptor *scriptResult = [query executeAndReturnError:&errDict];
if (!scriptResult) {
// COV_NF_START - no real way to test this
- if (*errorInfo)
+ if (errorInfo)
*errorInfo = [NSError errorWithDomain:@"GTMLoginItems" code:-2 userInfo:errDict];
return nil;
// COV_NF_END
diff --git a/Foundation/GTMBase64.m b/Foundation/GTMBase64.m
index 5cbcfa7..9f9ffbf 100644
--- a/Foundation/GTMBase64.m
+++ b/Foundation/GTMBase64.m
@@ -532,7 +532,6 @@ GTM_INLINE NSUInteger GuessDecodedLength(NSUInteger srcLen) {
curDest[0] = kBase64PaddingChar;
curDest[1] = kBase64PaddingChar;
curDest += 2;
- destLen -= 2;
}
break;
case 2:
@@ -548,7 +547,6 @@ GTM_INLINE NSUInteger GuessDecodedLength(NSUInteger srcLen) {
_GTMDevAssert(destLen >= 1, @"our calc for encoded length was wrong");
curDest[0] = kBase64PaddingChar;
curDest += 1;
- destLen -= 1;
}
break;
}
diff --git a/Foundation/GTMGarbageCollection.h b/Foundation/GTMGarbageCollection.h
index 58c8140..93d4efa 100644
--- a/Foundation/GTMGarbageCollection.h
+++ b/Foundation/GTMGarbageCollection.h
@@ -32,10 +32,9 @@
// General use would be to call this through GTMCFAutorelease
// but there may be a reason the you want to make something collectable
// but not autoreleased, especially in pure GC code where you don't
-// want to bother with the nop autorelease.
-GTM_INLINE id GTMNSMakeCollectable(CFTypeRef cf) {
- return NSMakeCollectable(cf);
-}
+// want to bother with the nop autorelease. Done as a define instead of an
+// inline so that tools like Clang's scan-build don't report code as leaking.
+#define GTMNSMakeCollectable(cf) ((id)NSMakeCollectable(cf))
// GTMNSMakeUncollectable is for global maps, etc. that we don't
// want released ever. You should still retain these in non-gc code.
@@ -54,10 +53,7 @@ GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) {
#else
-GTM_INLINE id GTMNSMakeCollectable(CFTypeRef cf) {
- // NSMakeCollectable handles NULLs just fine and returns nil as expected.
- return (id)cf;
-}
+#define GTMNSMakeCollectable(cf) ((id)(cf))
GTM_INLINE void GTMNSMakeUncollectable(id object) {
}
@@ -70,8 +66,7 @@ GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) {
// GTMCFAutorelease makes a CF object collectable in GC mode, or adds it
// to the autorelease pool in non-GC mode. Either way it is taken care
-// of.
-GTM_INLINE id GTMCFAutorelease(CFTypeRef cf) {
- return [GTMNSMakeCollectable(cf) autorelease];
-}
+// of. Done as a define instead of an inline so that tools like Clang's
+// scan-build don't report code as leaking.
+#define GTMCFAutorelease(cf) ([GTMNSMakeCollectable(cf) autorelease])
diff --git a/Foundation/GTMHTTPServer.m b/Foundation/GTMHTTPServer.m
index 4ecc9f7..4a7a859 100644
--- a/Foundation/GTMHTTPServer.m
+++ b/Foundation/GTMHTTPServer.m
@@ -31,7 +31,7 @@
@interface GTMHTTPServer (PrivateMethods)
- (void)acceptedConnectionNotification:(NSNotification *)notification;
-- (NSMutableDictionary *)newConnectionWithFileHandle:(NSFileHandle *)fileHandle;
+- (NSMutableDictionary *)connectionWithFileHandle:(NSFileHandle *)fileHandle;
- (void)dataAvailableNotification:(NSNotification *)notification;
- (NSMutableDictionary *)lookupConnection:(NSFileHandle *)fileHandle;
- (void)closeConnection:(NSMutableDictionary *)connDict;
@@ -258,11 +258,11 @@ startFailed:
// on it.
NSMutableDictionary *connDict =
- [self newConnectionWithFileHandle:newConnection];
+ [self connectionWithFileHandle:newConnection];
[connections_ addObject:connDict];
}
-- (NSMutableDictionary *)newConnectionWithFileHandle:(NSFileHandle *)fileHandle {
+- (NSMutableDictionary *)connectionWithFileHandle:(NSFileHandle *)fileHandle {
NSMutableDictionary *result = [NSMutableDictionary dictionary];
[result setObject:fileHandle forKey:kFileHandle];
diff --git a/GTMDefines.h b/GTMDefines.h
index b41a6c8..5fbd773 100644
--- a/GTMDefines.h
+++ b/GTMDefines.h
@@ -119,15 +119,15 @@ GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...);
// we directly invoke the NSAssert handler so we can pass on the varargs
// (NSAssert doesn't have a macro we can use that takes varargs)
#if !defined(NS_BLOCK_ASSERTIONS)
- #define _GTMDevAssert(condition, ...) \
- do { \
- if (!(condition)) { \
- [[NSAssertionHandler currentHandler] \
- handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__] \
- file:[NSString stringWithCString:__FILE__] \
- lineNumber:__LINE__ \
- description:__VA_ARGS__]; \
- } \
+ #define _GTMDevAssert(condition, ...) \
+ do { \
+ if (!(condition)) { \
+ [[NSAssertionHandler currentHandler] \
+ handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \
+ file:[NSString stringWithUTF8String:__FILE__] \
+ lineNumber:__LINE__ \
+ description:__VA_ARGS__]; \
+ } \
} while(0)
#else // !defined(NS_BLOCK_ASSERTIONS)
#define _GTMDevAssert(condition, ...) do { } while (0)
diff --git a/UnitTesting/GTMNSObject+UnitTesting.m b/UnitTesting/GTMNSObject+UnitTesting.m
index f3bfbb1..b30d4d8 100644
--- a/UnitTesting/GTMNSObject+UnitTesting.m
+++ b/UnitTesting/GTMNSObject+UnitTesting.m
@@ -417,11 +417,9 @@ static NSString *gGTMUnitTestSaveToDirectory = nil;
// we're on an automated build system, so use the build products dir as an
// override instead of writing on the desktop.
NSDictionary *env = [[NSProcessInfo processInfo] environment];
- BOOL foundBuildNumber = NO;
NSString *key;
GTM_FOREACH_KEY(key, env) {
if ([key hasSuffix:@"BUILD_NUMBER"]) {
- foundBuildNumber = YES;
break;
}
}