@@ -176,11 +176,11 @@ forKey: stream]; \ } \ \ if ([queue count] == 0) \ [runLoop->_kernelEventObserver \ - addStreamForReading: stream]; \ + addObjectForReading: stream]; \ \ queueItem = [[[type alloc] init] autorelease]; \ code \ [queue appendObject: queueItem]; \ \ @@ -288,11 +288,11 @@ OFList *queue; if ((queue = [runLoop->_readQueues objectForKey: stream]) != nil) { assert([queue count] > 0); - [runLoop->_kernelEventObserver removeStreamForReading: stream]; + [runLoop->_kernelEventObserver removeObjectForReading: stream]; [runLoop->_readQueues removeObjectForKey: stream]; } objc_autoreleasePoolPop(pool); } @@ -385,13 +385,13 @@ } #endif } #ifdef OF_HAVE_SOCKETS -- (void)streamIsReadyForReading: (OFStream*)stream +- (void)objectIsReadyForReading: (id)object { - OFList *queue = [_readQueues objectForKey: stream]; + OFList *queue = [_readQueues objectForKey: object]; of_list_object_t *listObject; assert(queue != nil); listObject = [queue firstListObject]; @@ -401,28 +401,28 @@ OFRunLoop_ReadQueueItem *queueItem = listObject->object; size_t length; OFException *exception = nil; @try { - length = [stream readIntoBuffer: queueItem->_buffer + length = [object readIntoBuffer: queueItem->_buffer length: queueItem->_length]; } @catch (OFException *e) { length = 0; exception = e; } # ifdef OF_HAVE_BLOCKS if (queueItem->_block != NULL) { - if (!queueItem->_block(stream, queueItem->_buffer, + if (!queueItem->_block(object, queueItem->_buffer, length, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_kernelEventObserver - removeStreamForReading: stream]; + removeObjectForReading: object]; [_readQueues - removeObjectForKey: stream]; + removeObjectForKey: object]; } } } else { # endif bool (*func)(id, SEL, OFStream*, void*, size_t, @@ -430,18 +430,18 @@ size_t, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (!func(queueItem->_target, queueItem->_selector, - stream, queueItem->_buffer, length, exception)) { + object, queueItem->_buffer, length, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_kernelEventObserver - removeStreamForReading: stream]; + removeObjectForReading: object]; [_readQueues - removeObjectForKey: stream]; + removeObjectForKey: object]; } } # ifdef OF_HAVE_BLOCKS } # endif @@ -450,11 +450,11 @@ OFRunLoop_ExactReadQueueItem *queueItem = listObject->object; size_t length; OFException *exception = nil; @try { - length = [stream + length = [object readIntoBuffer: (char*)queueItem->_buffer + queueItem->_readLength length: queueItem->_exactLength - queueItem->_readLength]; } @catch (OFException *e) { @@ -462,26 +462,26 @@ exception = e; } queueItem->_readLength += length; if (queueItem->_readLength == queueItem->_exactLength || - [stream isAtEndOfStream] || exception != nil) { + [object isAtEndOfStream] || exception != nil) { # ifdef OF_HAVE_BLOCKS if (queueItem->_block != NULL) { - if (queueItem->_block(stream, + if (queueItem->_block(object, queueItem->_buffer, queueItem->_readLength, exception)) queueItem->_readLength = 0; else { [queue removeListObject: listObject]; if ([queue count] == 0) { [_kernelEventObserver - removeStreamForReading: - stream]; + removeObjectForReading: + object]; [_readQueues - removeObjectForKey: stream]; + removeObjectForKey: object]; } } } else { # endif bool (*func)(id, SEL, OFStream*, void*, @@ -489,23 +489,23 @@ OFStream*, void*, size_t, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (func(queueItem->_target, - queueItem->_selector, stream, + queueItem->_selector, object, queueItem->_buffer, queueItem->_readLength, exception)) queueItem->_readLength = 0; else { [queue removeListObject: listObject]; if ([queue count] == 0) { [_kernelEventObserver - removeStreamForReading: - stream]; + removeObjectForReading: + object]; [_readQueues - removeObjectForKey: stream]; + removeObjectForKey: object]; } } # ifdef OF_HAVE_BLOCKS } # endif @@ -515,31 +515,31 @@ OFRunLoop_ReadLineQueueItem *queueItem = listObject->object; OFString *line; OFException *exception = nil; @try { - line = [stream + line = [object tryReadLineWithEncoding: queueItem->_encoding]; } @catch (OFException *e) { line = nil; exception = e; } - if (line != nil || [stream isAtEndOfStream] || + if (line != nil || [object isAtEndOfStream] || exception != nil) { # ifdef OF_HAVE_BLOCKS if (queueItem->_block != NULL) { - if (!queueItem->_block(stream, line, + if (!queueItem->_block(object, line, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_kernelEventObserver - removeStreamForReading: - stream]; + removeObjectForReading: + object]; [_readQueues - removeObjectForKey: stream]; + removeObjectForKey: object]; } } } else { # endif bool (*func)(id, SEL, OFStream*, OFString*, @@ -547,20 +547,20 @@ OFString*, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (!func(queueItem->_target, - queueItem->_selector, stream, line, + queueItem->_selector, object, line, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_kernelEventObserver - removeStreamForReading: - stream]; + removeObjectForReading: + object]; [_readQueues - removeObjectForKey: stream]; + removeObjectForKey: object]; } } # ifdef OF_HAVE_BLOCKS } # endif @@ -570,27 +570,26 @@ OFRunLoop_AcceptQueueItem *queueItem = listObject->object; OFTCPSocket *newSocket; OFException *exception = nil; @try { - newSocket = [(OFTCPSocket*)stream accept]; + newSocket = [object accept]; } @catch (OFException *e) { newSocket = nil; exception = e; } # ifdef OF_HAVE_BLOCKS if (queueItem->_block != NULL) { - if (!queueItem->_block((OFTCPSocket*)stream, - newSocket, exception)) { + if (!queueItem->_block(object, newSocket, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_kernelEventObserver - removeStreamForReading: stream]; + removeObjectForReading: object]; [_readQueues - removeObjectForKey: stream]; + removeObjectForKey: object]; } } } else { # endif bool (*func)(id, SEL, OFTCPSocket*, OFTCPSocket*, @@ -599,18 +598,18 @@ OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (!func(queueItem->_target, queueItem->_selector, - (OFTCPSocket*)stream, newSocket, exception)) { + object, newSocket, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_kernelEventObserver - removeStreamForReading: stream]; + removeObjectForReading: object]; [_readQueues - removeObjectForKey: stream]; + removeObjectForKey: object]; } } # ifdef OF_HAVE_BLOCKS } # endif @@ -671,11 +670,11 @@ } @finally { [_timersQueueLock unlock]; } #endif - /* Watch for stream events until the next timer is due */ + /* Watch for I/O events until the next timer is due */ if (nextTimer != nil) { of_time_interval_t timeout = [nextTimer timeIntervalSinceNow]; if (timeout > 0) { @@ -690,11 +689,11 @@ [OFThread sleepForTimeInterval: timeout]; #endif } } else { /* - * No more timers: Just watch for streams until we get + * No more timers: Just watch for I/O until we get * an event. If a timer is added by another thread, it * cancels the observe. */ #if defined(OF_HAVE_SOCKETS) [_kernelEventObserver observe];