diff options
Diffstat (limited to 'Foundation')
-rw-r--r-- | Foundation/GTMBase64.m | 2 | ||||
-rw-r--r-- | Foundation/GTMGarbageCollection.h | 19 | ||||
-rw-r--r-- | Foundation/GTMHTTPServer.m | 6 |
3 files changed, 10 insertions, 17 deletions
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]; |