diff --git a/ChangeLog b/ChangeLog index 80e059e20..28eaaac1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-05-10 Richard Frith-Macdonald + + * Source/NSConnection.m: Use respondsToSelector rather than respondsTo + * Source/NSRunLoop.m: ditto ... and tidy up categories to avoid + compiler warnings. + 2001-05-08 Richard Frith-Macdonald * Tools/gdomap.c: Fixes to last modifications - provided by diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 7460c8dad..82359122a 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -837,7 +837,7 @@ static BOOL multi_threaded = NO; /* Preferred MacOS-X version, which just allows the returning of BOOL */ del = [parent delegate]; - if ([del respondsTo: @selector(connection:shouldMakeNewConnection:)]) + if ([del respondsToSelector: @selector(connection:shouldMakeNewConnection:)]) { if ([del connection: parent shouldMakeNewConnection: self] == NO) { @@ -847,7 +847,7 @@ static BOOL multi_threaded = NO; } } /* Deprecated OpenStep version, which just allows the returning of BOOL */ - if ([del respondsTo: @selector(makeNewConnection:sender:)]) + if ([del respondsToSelector: @selector(makeNewConnection:sender:)]) { if (![del makeNewConnection: self sender: parent]) { @@ -859,7 +859,7 @@ static BOOL multi_threaded = NO; /* Here is the GNUstep version, which allows the delegate to specify a substitute. Note: The delegate is responsible for freeing newConn if it returns something different. */ - if ([del respondsTo: @selector(connection:didConnect:)]) + if ([del respondsToSelector: @selector(connection:didConnect:)]) self = [del connection: parent didConnect: self]; /* Register ourselves for invalidation notification when the diff --git a/Source/NSRunLoop.m b/Source/NSRunLoop.m index 8c2bba365..614d67399 100644 --- a/Source/NSRunLoop.m +++ b/Source/NSRunLoop.m @@ -391,7 +391,6 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) - (GSRunLoopWatcher*) _getWatcher: (void*)data type: (RunLoopEventType)type forMode: (NSString*)mode; -- (NSMutableArray*) _performers; - (void) _removeWatcher: (void*)data type: (RunLoopEventType)type forMode: (NSString*)mode; @@ -501,6 +500,68 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) } } +- (GSRunLoopWatcher*) _getWatcher: (void*)data + type: (RunLoopEventType)type + forMode: (NSString*)mode +{ + GSIArray watchers; + + if (mode == nil) + { + mode = _current_mode; + } + + watchers = NSMapGet(_mode_2_watchers, mode); + if (watchers) + { + unsigned i = GSIArrayCount(watchers); + + while (i-- > 0) + { + GSRunLoopWatcher *info; + + info = GSIArrayItemAtIndex(watchers, i).obj; + if (info->type == type && info->data == data) + { + return info; + } + } + } + return nil; +} + +- (void) _removeWatcher: (void*)data + type: (RunLoopEventType)type + forMode: (NSString*)mode +{ + GSIArray watchers; + + if (mode == nil) + { + mode = _current_mode; + } + + watchers = NSMapGet(_mode_2_watchers, mode); + if (watchers) + { + unsigned i = GSIArrayCount(watchers); + + while (i-- > 0) + { + GSRunLoopWatcher *info; + + info = GSIArrayItemAtIndex(watchers, i).obj; + if (info->type == type && info->data == data) + { + info->_invalidated = YES; + GSIArrayRemoveItemAtIndex(watchers, i); + } + } + } +} + +@end + @implementation NSRunLoop(GNUstepExtensions) @@ -949,69 +1010,6 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = return when; } -- (GSRunLoopWatcher*) _getWatcher: (void*)data - type: (RunLoopEventType)type - forMode: (NSString*)mode -{ - GSIArray watchers; - - if (mode == nil) - { - mode = _current_mode; - } - - watchers = NSMapGet(_mode_2_watchers, mode); - if (watchers) - { - unsigned i = GSIArrayCount(watchers); - - while (i-- > 0) - { - GSRunLoopWatcher *info; - - info = GSIArrayItemAtIndex(watchers, i).obj; - if (info->type == type && info->data == data) - { - return info; - } - } - } - return nil; -} - -- (void) _removeWatcher: (void*)data - type: (RunLoopEventType)type - forMode: (NSString*)mode -{ - GSIArray watchers; - - if (mode == nil) - { - mode = _current_mode; - } - - watchers = NSMapGet(_mode_2_watchers, mode); - if (watchers) - { - unsigned i = GSIArrayCount(watchers); - - while (i-- > 0) - { - GSRunLoopWatcher *info; - - info = GSIArrayItemAtIndex(watchers, i).obj; - if (info->type == type && info->data == data) - { - info->_invalidated = YES; - GSIArrayRemoveItemAtIndex(watchers, i); - } - } - } -} - - - - /* Listen to input sources. If LIMIT_DATE is nil, then don't wait; i.e. call select() with 0 timeout */ @@ -1158,7 +1156,7 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = int port_fd_count = 128; // xxx #define this constant int port_fd_array[port_fd_count]; - if ([port respondsTo: @selector(getFds:count:)]) + if ([port respondsToSelector: @selector(getFds:count:)]) [port getFds: port_fd_array count: &port_fd_count]; if (debug_run_loop) printf("\tNSRunLoop listening to %d sockets\n",