diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2013-12-19 21:30:10 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2013-12-19 21:30:10 +0000 |
commit | 9b8635767148b3f95942593bfeefa86f147d2c53 (patch) | |
tree | 357cf2390edbb1d150830133228cda393203ee48 /AppKit | |
parent | ca3d74790bcf2d42bc6a9c3dc653c7e8a485705c (diff) |
Fix build of Mac GTM project with static analyzer. Remove GTMGarbageCollection. Remove GC build configs. Remove internal dependence on GTMObjectSingleton.
DELTA=447 (49 added, 296 deleted, 102 changed)
Diffstat (limited to 'AppKit')
-rw-r--r-- | AppKit/GTMCarbonEvent.m | 28 | ||||
-rw-r--r-- | AppKit/GTMGetURLHandler.m | 2 | ||||
-rw-r--r-- | AppKit/GTMGoogleSearch.m | 23 | ||||
-rw-r--r-- | AppKit/GTMHotKeyTextField.m | 9 | ||||
-rw-r--r-- | AppKit/GTMLargeTypeWindowTest.m | 18 | ||||
-rw-r--r-- | AppKit/GTMLoginItems.m | 1 | ||||
-rw-r--r-- | AppKit/GTMNSBezierPath+CGPath.m | 1 | ||||
-rw-r--r-- | AppKit/GTMNSImage+SearchCache.m | 2 | ||||
-rw-r--r-- | AppKit/GTMNSWorkspace+Running.m | 13 | ||||
-rw-r--r-- | AppKit/GTMUILocalizerAndLayoutTweaker.m | 11 |
10 files changed, 61 insertions, 47 deletions
diff --git a/AppKit/GTMCarbonEvent.m b/AppKit/GTMCarbonEvent.m index 515a1e1..235306e 100644 --- a/AppKit/GTMCarbonEvent.m +++ b/AppKit/GTMCarbonEvent.m @@ -18,7 +18,6 @@ #import "GTMCarbonEvent.h" #import <AppKit/AppKit.h> -#import "GTMObjectSingleton.h" #import "GTMDebugSelectorValidation.h" #import "GTMTypeCasting.h" @@ -477,8 +476,13 @@ static OSStatus EventHandler(EventHandlerCallRef inHandler, @implementation GTMCarbonEventMonitorHandler -GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventMonitorHandler, - sharedEventMonitorHandler); ++ (GTMCarbonEventMonitorHandler *)sharedEventMonitorHandler { + static GTMCarbonEventMonitorHandler *obj = nil; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} - (EventTargetRef)eventTarget { return GetEventMonitorTarget(); @@ -494,8 +498,13 @@ extern EventTargetRef GetApplicationEventTarget(void); @implementation GTMCarbonEventApplicationEventHandler -GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventApplicationEventHandler, - sharedApplicationEventHandler); ++ (GTMCarbonEventApplicationEventHandler *)sharedApplicationEventHandler { + static GTMCarbonEventApplicationEventHandler *obj = nil; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} - (EventTargetRef)eventTarget { return GetApplicationEventTarget(); @@ -505,8 +514,13 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventApplicationEventHandler, @implementation GTMCarbonEventDispatcherHandler -GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventDispatcherHandler, - sharedEventDispatcherHandler); ++ (GTMCarbonEventDispatcherHandler *)sharedEventDispatcherHandler { + static GTMCarbonEventDispatcherHandler *obj = nil; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} // Register for the events we handle, and set up the dictionaries we need // to keep track of the hotkeys and commands that we handle. diff --git a/AppKit/GTMGetURLHandler.m b/AppKit/GTMGetURLHandler.m index e038530..a5f7c5d 100644 --- a/AppKit/GTMGetURLHandler.m +++ b/AppKit/GTMGetURLHandler.m @@ -56,7 +56,6 @@ // @end #import <AppKit/AppKit.h> -#import "GTMGarbageCollection.h" #import "GTMNSAppleEventDescriptor+Foundation.h" #import "GTMMethodCheck.h" @@ -119,7 +118,6 @@ withReplyEvent:(NSAppleEventDescriptor *)replyEvent { sHandler = [GTMGetURLHandler handlerForBundle:bundle]; if (sHandler) { [sHandler retain]; - GTMNSMakeUncollectable(sHandler); } } [sHandler getUrl:event withReplyEvent:replyEvent]; diff --git a/AppKit/GTMGoogleSearch.m b/AppKit/GTMGoogleSearch.m index 9eb095f..320c71d 100644 --- a/AppKit/GTMGoogleSearch.m +++ b/AppKit/GTMGoogleSearch.m @@ -17,8 +17,7 @@ // #import "GTMGoogleSearch.h" -#import "GTMObjectSingleton.h" -#import "GTMGarbageCollection.h" +#import "GTMDefines.h" #if GTM_IPHONE_SDK #import <UIKit/UIKit.h> @@ -128,7 +127,13 @@ static NSString *const kDefaultLanguage = @"en"; @implementation GTMGoogleSearch -GTMOBJECT_SINGLETON_BOILERPLATE(GTMGoogleSearch, sharedInstance); ++ (GTMGoogleSearch *)sharedInstance { + static GTMGoogleSearch *obj; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} - (id)init { self = [super init]; @@ -166,8 +171,8 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMGoogleSearch, sharedInstance); } } - curAppCachedDomain_ = GTMNSMakeCollectable(domain); - curAppCachedLanguage_ = GTMNSMakeCollectable(lang); + curAppCachedDomain_ = (NSString *)domain; + curAppCachedLanguage_ = (NSString *)lang; NSBundle *bundle = [NSBundle mainBundle]; @@ -180,14 +185,14 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMGoogleSearch, sharedInstance); #if GTM_GOOGLE_SEARCH_SUPPORTS_DISTRIBUTED_NOTIFICATIONS - (void)finalize { - [[NSDistributedNotificationCenter defaultCenter] removeObject:self]; + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; [super finalize]; } #endif // GTM_GOOGLE_SEARCH_SUPPORTS_DISTRIBUTED_NOTIFICATIONS - (void)dealloc { #if GTM_GOOGLE_SEARCH_SUPPORTS_DISTRIBUTED_NOTIFICATIONS - [[NSDistributedNotificationCenter defaultCenter] removeObject:self]; + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; #endif // GTM_GOOGLE_SEARCH_SUPPORTS_DISTRIBUTED_NOTIFICATIONS [allAppsCachedDomain_ release]; [allAppsCachedLanguage_ release]; @@ -484,8 +489,8 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMGoogleSearch, sharedInstance); } } - allAppsCachedDomain_ = GTMNSMakeCollectable(domain); - allAppsCachedLanguage_ = GTMNSMakeCollectable(lang); + allAppsCachedDomain_ = (NSString *)domain; + allAppsCachedLanguage_ = (NSString *)lang; } // -updateAllAppsDomain:language: diff --git a/AppKit/GTMHotKeyTextField.m b/AppKit/GTMHotKeyTextField.m index 5ef59b4..a33277a 100644 --- a/AppKit/GTMHotKeyTextField.m +++ b/AppKit/GTMHotKeyTextField.m @@ -18,7 +18,6 @@ #import "GTMHotKeyTextField.h" #import <Carbon/Carbon.h> -#import "GTMObjectSingleton.h" #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 #import "GTMSystemVersion.h" @@ -570,7 +569,13 @@ static CFStringRef kGTM_TISPropertyUnicodeKeyLayoutData = NULL; @implementation GTMHotKeyFieldEditor -GTMOBJECT_SINGLETON_BOILERPLATE(GTMHotKeyFieldEditor, sharedHotKeyFieldEditor) ++ (GTMHotKeyFieldEditor *)sharedHotKeyFieldEditor { + static GTMHotKeyFieldEditor *obj; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} - (id)init { if ((self = [super init])) { diff --git a/AppKit/GTMLargeTypeWindowTest.m b/AppKit/GTMLargeTypeWindowTest.m index 442fbac..a60c791 100644 --- a/AppKit/GTMLargeTypeWindowTest.m +++ b/AppKit/GTMLargeTypeWindowTest.m @@ -20,7 +20,6 @@ #import "GTMLargeTypeWindow.h" #import "GTMNSObject+UnitTesting.h" #import "GTMUnitTestDevLog.h" -#import "GTMGarbageCollection.h" #import "GTMSystemVersion.h" NSString *const kLongTextBlock = @@ -58,21 +57,8 @@ NSString *const kShortTextBlock = @"Short"; @implementation GTMLargeTypeWindowTest - (BOOL)shouldDoAnimateCopy { - // NOTE: Animated copy tests are disabled when GC is on. - // See the comment/warning in the GTMLargeTypeWindow.h for more details, - // but we disable them to avoid the tests failing (crashing) when it's Apple's - // bug. Please bump the system check as appropriate when new systems are - // tested. Currently broken on 10.5.6 and below. - // Radar 6137322 CIFilter crashing when run with GC enabled - SInt32 major, minor, bugfix; - [GTMSystemVersion getMajor:&major minor:&minor bugFix:&bugfix]; - if (!(GTMIsGarbageCollectionEnabled() - && major <= 10 && minor <= 5 && bugfix <= 6)) { - return YES; - } else { - NSLog(@"--- animated copy not run because of GC incompatibilites ---"); - return NO; - } + // This method previously checked for incompatibilities with garbage collection. + return YES; } - (void)setUp { diff --git a/AppKit/GTMLoginItems.m b/AppKit/GTMLoginItems.m index 1d2c56a..fc0029b 100644 --- a/AppKit/GTMLoginItems.m +++ b/AppKit/GTMLoginItems.m @@ -19,7 +19,6 @@ #import "GTMLoginItems.h" #import "GTMDefines.h" -#import "GTMGarbageCollection.h" #include <Carbon/Carbon.h> diff --git a/AppKit/GTMNSBezierPath+CGPath.m b/AppKit/GTMNSBezierPath+CGPath.m index 3624d9e..dd5c5f2 100644 --- a/AppKit/GTMNSBezierPath+CGPath.m +++ b/AppKit/GTMNSBezierPath+CGPath.m @@ -19,7 +19,6 @@ // #import "GTMNSBezierPath+CGPath.h" #import "GTMDefines.h" -#import "GTMGarbageCollection.h" @implementation NSBezierPath (GTMBezierPathCGPathAdditions) diff --git a/AppKit/GTMNSImage+SearchCache.m b/AppKit/GTMNSImage+SearchCache.m index 037e0c8..21f2ce8 100644 --- a/AppKit/GTMNSImage+SearchCache.m +++ b/AppKit/GTMNSImage+SearchCache.m @@ -19,7 +19,7 @@ // #import "GTMNSImage+SearchCache.h" -#import "GTMGarbageCollection.h" +#import "GTMDefines.h" @implementation NSImage (GTMNSImageSearchCache) + (NSImage *)gtm_imageWithPath:(NSString *)path { diff --git a/AppKit/GTMNSWorkspace+Running.m b/AppKit/GTMNSWorkspace+Running.m index a3a1b6d..7d6efff 100644 --- a/AppKit/GTMNSWorkspace+Running.m +++ b/AppKit/GTMNSWorkspace+Running.m @@ -19,9 +19,8 @@ #import "GTMNSWorkspace+Running.h" #import <Carbon/Carbon.h> #import <unistd.h> -#import "GTMGarbageCollection.h" #import "GTMSystemVersion.h" -#import "GTMObjectSingleton.h" + NSString *const kGTMWorkspaceRunningPSN = @"PSN"; NSString *const kGTMWorkspaceRunningFlavor = @"Flavor"; @@ -190,8 +189,14 @@ NSString *const kGTMWorkspaceRunningBundleVersion = @"CFBundleVersion"; @implementation GTMWorkspaceRunningApplicationList -GTMOBJECT_SINGLETON_BOILERPLATE(GTMWorkspaceRunningApplicationList, - sharedApplicationList) ++ (GTMWorkspaceRunningApplicationList *)sharedApplicationList { + static GTMWorkspaceRunningApplicationList *obj; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} + - (id)init { if ((self = [super init])) { [self didLaunchOrTerminateApp:nil]; diff --git a/AppKit/GTMUILocalizerAndLayoutTweaker.m b/AppKit/GTMUILocalizerAndLayoutTweaker.m index d2ff80c..14876dc 100644 --- a/AppKit/GTMUILocalizerAndLayoutTweaker.m +++ b/AppKit/GTMUILocalizerAndLayoutTweaker.m @@ -18,7 +18,6 @@ #import "GTMUILocalizerAndLayoutTweaker.h" #import "GTMUILocalizer.h" -#import "GTMNSNumber+64Bit.h" // Controls if +wrapString:width:font: uses a subclassed TypeSetter to do // its work in one pass. @@ -69,7 +68,7 @@ static const CGFloat kWrapperStringSlop = 0.9; } - (BOOL)shouldBreakLineByWordBeforeCharacterAtIndex:(NSUInteger)charIndex { - [array_ addObject:[NSNumber gtm_numberWithUnsignedInteger:charIndex]]; + [array_ addObject:[NSNumber numberWithUnsignedInteger:charIndex]]; return YES; } @@ -207,7 +206,7 @@ static const CGFloat kWrapperStringSlop = 0.9; NSNumber *number; while ((number = [reverseEnumerator nextObject]) != nil) { [workerStr insertString:kForcedWrapString - atIndex:[number gtm_unsignedIntegerValue]]; + atIndex:[number unsignedIntegerValue]]; } #else // Find out how tall lines would be for the layout loop. @@ -454,7 +453,11 @@ static const CGFloat kWrapperStringSlop = 0.9; // once we know this view's size. if (IsRightAnchored(subView)) { [rightAlignedSubViews addObject:subView]; - NSNumber *nsDelta = [NSNumber gtm_numberWithCGFloat:delta]; +#if CGFLOAT_IS_DOUBLE + NSNumber *nsDelta = [NSNumber numberWithDouble:delta]; +#else + NSNumber *nsDelta = [NSNumber numberWithFloat:delta]; +#endif [rightAlignedSubViewDeltas addObject:nsDelta]; } } |