From 0104b79cb62669adbb4649042c8d8125ba3eb53c Mon Sep 17 00:00:00 2001 From: CaS Date: Thu, 21 Jun 2001 13:36:13 +0000 Subject: [PATCH] Tidied for gcc-3 warnings etc git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10226 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 2 + Headers/gnustep/base/NSRunLoop.h | 6 +++ Source/GSFormat.m | 1 + Source/NSConnection.m | 9 +++-- Source/NSRunLoop.m | 64 ++++++++++++++++---------------- Source/NSTask.m | 3 +- 6 files changed, 48 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d70f745b..d5efc9516 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2001-06-21 Richard Frith-Macdonald + * Source/NSConnection.m: Change some deprecated runloop methods for + standard ones. * Source/NSRunLoop.m: ([runMode:beforeDate:]) Check for task completion and send out notifications if required. * Source/NSTask.m: ([waitUntilExit]) schedule a timer so that the diff --git a/Headers/gnustep/base/NSRunLoop.h b/Headers/gnustep/base/NSRunLoop.h index ef4dcec48..c453ae9c2 100644 --- a/Headers/gnustep/base/NSRunLoop.h +++ b/Headers/gnustep/base/NSRunLoop.h @@ -125,6 +125,11 @@ typedef enum { @interface NSRunLoop(GNUstepExtensions) +#if 0 +/* + * The following ten methods are DEPRECATED + * They will be removed in later releases of GNUstep + */ + currentInstance; + (NSString*) currentMode; + (void) run; @@ -139,6 +144,7 @@ typedef enum { forMode: (NSString*)mode; - (void) runUntilDate: (NSDate*)limit_date forMode: (NSString*)mode; +#endif /* * These next two are general purpose methods for letting objects * ask the runloop to watch for events for them. Only one object diff --git a/Source/GSFormat.m b/Source/GSFormat.m index bd4e163c2..e734ead5a 100644 --- a/Source/GSFormat.m +++ b/Source/GSFormat.m @@ -1886,6 +1886,7 @@ NSDictionary *locale) all_done: /* Unlock the stream. */ + return; } /* Handle an unknown format specifier. This prints out a canonicalized diff --git a/Source/NSConnection.m b/Source/NSConnection.m index e8020c9b5..f108bac1c 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -2326,6 +2326,7 @@ static BOOL multi_threaded = NO; NSDate *timeout_date = nil; NSTimeInterval delay_interval = 0.001; NSDate *delay_date = nil; + NSRunLoop *runLoop = [runLoopClass currentRunLoop]; if (debug_connection > 5) NSLog(@"Waiting for reply sequence %d on %x:%x", @@ -2377,8 +2378,8 @@ static BOOL multi_threaded = NO; * were waiting for the final timeout, then we must break out * of the loop. */ - if ([runLoopClass runOnceBeforeDate: limit_date - forMode: NSConnectionReplyMode] == NO) + if ([runLoop runMode: NSConnectionReplyMode + beforeDate: limit_date] == NO) { if (limit_date == timeout_date) { @@ -2393,8 +2394,8 @@ static BOOL multi_threaded = NO; /* * Normal operation - wait for data to be recieved or for a timeout. */ - if ([runLoopClass runOnceBeforeDate: timeout_date - forMode: NSConnectionReplyMode] == NO) + if ([runLoop runMode: NSConnectionReplyMode + beforeDate: timeout_date] == NO) { M_LOCK(_queueGate); node = GSIMapNodeForKey(_replyMap, (GSIMapKey)sn); diff --git a/Source/NSRunLoop.m b/Source/NSRunLoop.m index 264bc1f8d..401c56aeb 100644 --- a/Source/NSRunLoop.m +++ b/Source/NSRunLoop.m @@ -274,7 +274,7 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) { timer = nil; [target performSelector: selector withObject: argument]; - [[[NSRunLoop currentInstance] _timedPerformers] + [[[NSRunLoop currentRunLoop] _timedPerformers] removeObjectIdenticalTo: self]; } @@ -311,7 +311,7 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) selector: (SEL)aSelector object: (id)arg { - NSMutableArray *perf = [[NSRunLoop currentInstance] _timedPerformers]; + NSMutableArray *perf = [[NSRunLoop currentRunLoop] _timedPerformers]; unsigned count = [perf count]; if (count > 0) @@ -340,7 +340,7 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) withObject: (id)argument afterDelay: (NSTimeInterval)seconds { - NSRunLoop *loop = [NSRunLoop currentInstance]; + NSRunLoop *loop = [NSRunLoop currentRunLoop]; GSTimedPerformer *item; item = [[GSTimedPerformer alloc] initWithSelector: aSelector @@ -361,7 +361,7 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) if (count > 0) { - NSRunLoop *loop = [NSRunLoop currentInstance]; + NSRunLoop *loop = [NSRunLoop currentRunLoop]; NSString *marray[count]; GSTimedPerformer *item; unsigned i; @@ -581,26 +581,6 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) [[self currentRunLoop] run]; } -+ (void) runUntilDate: date -{ - [[self currentRunLoop] runUntilDate: date]; -} - -+ (void) runUntilDate: date forMode: (NSString*)mode -{ - [[self currentRunLoop] runUntilDate: date forMode: mode]; -} - -+ (BOOL) runOnceBeforeDate: date -{ - return [[self currentRunLoop] runOnceBeforeDate: date]; -} - -+ (BOOL) runOnceBeforeDate: date forMode: (NSString*)mode -{ - return [[self currentRunLoop] runOnceBeforeDate: date forMode: mode]; -} - - (void) addEvent: (void*)data type: (RunLoopEventType)type watcher: (id)watcher @@ -668,11 +648,6 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) } } -- (BOOL) runOnceBeforeDate: date -{ - return [self runOnceBeforeDate: date forMode: _current_mode]; -} - /* Running the run loop once through for timers and input listening. */ - (BOOL) runOnceBeforeDate: date forMode: (NSString*)mode @@ -680,7 +655,12 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) return [self runMode: mode beforeDate: date]; } -- (void) runUntilDate: date forMode: (NSString*)mode +- (BOOL) runOnceBeforeDate: date +{ + return [self runOnceBeforeDate: date forMode: _current_mode]; +} + +- (void) runUntilDate: (NSDate*)date forMode: (NSString*)mode { double ti = [date timeIntervalSinceNow]; BOOL mayDoMore = YES; @@ -695,6 +675,26 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1) } } ++ (void) runUntilDate: (NSDate*)date forMode: (NSString*)mode +{ + [[self currentRunLoop] runUntilDate: date forMode: mode]; +} + ++ (void) runUntilDate: (NSDate*)date +{ + [[self currentRunLoop] runUntilDate: date]; +} + ++ (BOOL) runOnceBeforeDate: date forMode: (NSString*)mode +{ + return [[self currentRunLoop] runOnceBeforeDate: date forMode: mode]; +} + ++ (BOOL) runOnceBeforeDate: (NSDate*)date +{ + return [[self currentRunLoop] runOnceBeforeDate: date]; +} + @end @@ -1341,7 +1341,7 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = RELEASE(arp); } -- (BOOL) runMode: (NSString*)mode beforeDate: date +- (BOOL) runMode: (NSString*)mode beforeDate: (NSDate*)date { id d; @@ -1402,7 +1402,7 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks = [self runUntilDate: theFuture]; } -- (void) runUntilDate: date +- (void) runUntilDate: (NSDate*)date { [self runUntilDate: date forMode: _current_mode]; } diff --git a/Source/NSTask.m b/Source/NSTask.m index 1419421f3..966a235d6 100644 --- a/Source/NSTask.m +++ b/Source/NSTask.m @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -525,7 +526,7 @@ pty_slave(const char* name) * Poll at 0.1 second intervals. */ limit = [[NSDate alloc] initWithTimeIntervalSinceNow: 0.1]; - if (timer = nil) + if (timer == nil) { timer = [NSTimer scheduledTimerWithTimeInterval: 0.1 target: nil