diff options
author | rowanbeentje <rowan@beent.je> | 2011-03-02 02:25:08 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2011-03-02 02:25:08 +0000 |
commit | 4422810afa93d3cbce76812cc50e45ef8634180b (patch) | |
tree | 0d7cf391cdf495a6bef8c6970407e2e081c9d877 /Source/NSNotificationAdditions.m | |
parent | 64919b03fa59c8d93c81a8e3893934c04a3cac91 (diff) | |
download | sequelpro-4422810afa93d3cbce76812cc50e45ef8634180b.tar.gz sequelpro-4422810afa93d3cbce76812cc50e45ef8634180b.tar.bz2 sequelpro-4422810afa93d3cbce76812cc50e45ef8634180b.zip |
- Fix compiler warnings for MCPKit - largely typecast related
- Fix further compiler warnings, including a couple of bugs
- Disable the -wselector warnings (Multiple definition types for selector) as they're currently unsupported in LLVM
- Disable the -wconversion warnings (Prototype conversion) warnings as we usually can't affect protocol declaration
- Disable the -wstrict-selector-match (Strict selector matching) due to too many false positives
Diffstat (limited to 'Source/NSNotificationAdditions.m')
-rw-r--r-- | Source/NSNotificationAdditions.m | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m index 53917dae..ae949347 100644 --- a/Source/NSNotificationAdditions.m +++ b/Source/NSNotificationAdditions.m @@ -24,7 +24,13 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "NSNotificationAdditions.h" -#import <pthread.h> +#import "pthread.h" + +@interface NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI) ++ (void)_postNotification:(NSNotification *)notification; ++ (void)_postNotificationName:(NSDictionary *)info; ++ (void)_postNotificationForwarder:(NSDictionary *)info; +@end @implementation NSNotificationCenter (NSNotificationCenterAdditions) @@ -35,16 +41,11 @@ [self postNotificationOnMainThread:notification waitUntilDone:NO]; } -- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait +- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone { if (pthread_main_np()) return [self postNotification:notification]; - [[self class] performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:wait]; -} - -+ (void)_postNotification:(NSNotification *)notification -{ - [[self defaultCenter] postNotification:notification]; + [self performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone]; } - (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object @@ -61,21 +62,30 @@ [self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO]; } -- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone { if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo]; - + NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:3]; if (name) [info setObject:name forKey:@"name"]; if (object) [info setObject:object forKey:@"object"]; if (userInfo) [info setObject:userInfo forKey:@"userInfo"]; - - [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:wait]; - + + [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone]; + [info release]; } +@end + +@implementation NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI) + ++ (void)_postNotification:(NSNotification *)notification +{ + [[self defaultCenter] postNotification:notification]; +} + + (void)_postNotificationName:(NSDictionary *)info { NSString *name = [info objectForKey:@"name"]; @@ -83,7 +93,18 @@ id object = [info objectForKey:@"object"]; NSDictionary *userInfo = [info objectForKey:@"userInfo"]; + + [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; +} + ++ (void)_postNotificationForwarder:(NSDictionary *)info +{ + NSString *name = [info objectForKey:@"name"]; + id object = [info objectForKey:@"object"]; + + NSDictionary *userInfo = [info objectForKey:@"userInfo"]; + [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; } |