@@ -130,12 +130,13 @@ # ifdef OF_HAVE_BLOCKS if (_block != NULL) return _block(object, _buffer, length, exception); else { # endif - bool (*func)(id, SEL, OFStream*, void*, size_t, OFException*) = - (bool(*)(id, SEL, OFStream*, void*, size_t, OFException*)) + bool (*func)(id, SEL, OFStream *, void *, size_t, + OFException *) = (bool (*)(id, SEL, OFStream *, void *, + size_t, OFException *)) [_target methodForSelector: _selector]; return func(_target, _selector, object, _buffer, length, exception); # ifdef OF_HAVE_BLOCKS @@ -158,11 +159,11 @@ { size_t length; OFException *exception = nil; @try { - length = [object readIntoBuffer: (char*)_buffer + _readLength + length = [object readIntoBuffer: (char *)_buffer + _readLength length: _exactLength - _readLength]; } @catch (OFException *e) { length = 0; exception = e; } @@ -180,12 +181,13 @@ _readLength = 0; return true; } else { # endif - bool (*func)(id, SEL, OFStream*, void*, size_t, OFException*) = - (bool(*)(id, SEL, OFStream*, void*, size_t, OFException*)) + bool (*func)(id, SEL, OFStream *, void *, size_t, + OFException *) = (bool (*)(id, SEL, OFStream *, void *, + size_t, OFException *)) [_target methodForSelector: _selector]; if (!func(_target, _selector, object, _buffer, _readLength, exception)) return false; @@ -226,12 +228,12 @@ # ifdef OF_HAVE_BLOCKS if (_block != NULL) return _block(object, line, exception); else { # endif - bool (*func)(id, SEL, OFStream*, OFString*, OFException*) = - (bool(*)(id, SEL, OFStream*, OFString*, OFException*)) + bool (*func)(id, SEL, OFStream *, OFString *, OFException *) = + (bool (*)(id, SEL, OFStream *, OFString *, OFException *)) [_target methodForSelector: _selector]; return func(_target, _selector, object, line, exception); # ifdef OF_HAVE_BLOCKS } @@ -264,13 +266,13 @@ # ifdef OF_HAVE_BLOCKS if (_block != NULL) return _block(object, newSocket, exception); else { # endif - bool (*func)(id, SEL, OFTCPSocket*, OFTCPSocket*, - OFException*) = - (bool(*)(id, SEL, OFTCPSocket*, OFTCPSocket*, OFException*)) + bool (*func)(id, SEL, OFTCPSocket *, OFTCPSocket *, + OFException *) = (bool (*)(id, SEL, OFTCPSocket *, + OFTCPSocket *, OFException *)) [_target methodForSelector: _selector]; return func(_target, _selector, object, newSocket, exception); # ifdef OF_HAVE_BLOCKS } @@ -306,14 +308,14 @@ # ifdef OF_HAVE_BLOCKS if (_block != NULL) return _block(object, _buffer, length, address, exception); else { # endif - bool (*func)(id, SEL, OFUDPSocket*, void*, size_t, - of_udp_socket_address_t address, OFException*) = - (bool(*)(id, SEL, OFUDPSocket*, void*, size_t, - of_udp_socket_address_t, OFException*)) + bool (*func)(id, SEL, OFUDPSocket *, void *, size_t, + of_udp_socket_address_t address, OFException *) = + (bool (*)(id, SEL, OFUDPSocket *, void *, size_t, + of_udp_socket_address_t, OFException *)) [_target methodForSelector: _selector]; return func(_target, _selector, object, _buffer, length, address, exception); # ifdef OF_HAVE_BLOCKS @@ -331,25 +333,25 @@ # endif @end #endif @implementation OFRunLoop -+ (OFRunLoop*)mainRunLoop ++ (OFRunLoop *)mainRunLoop { return [[mainRunLoop retain] autorelease]; } -+ (OFRunLoop*)currentRunLoop ++ (OFRunLoop *)currentRunLoop { #ifdef OF_HAVE_THREADS return [[OFThread currentThread] runLoop]; #else return [self mainRunLoop]; #endif } -+ (void)OF_setMainRunLoop: (OFRunLoop*)runLoop ++ (void)OF_setMainRunLoop: (OFRunLoop *)runLoop { mainRunLoop = [runLoop retain]; } #ifdef OF_HAVE_SOCKETS @@ -373,12 +375,12 @@ code \ [queue appendObject: queueItem]; \ \ objc_autoreleasePoolPop(pool); -+ (void)OF_addAsyncReadForStream: (OFStream*)stream - buffer: (void*)buffer ++ (void)OF_addAsyncReadForStream: (OFStream *)stream + buffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector { ADD_READ(OFRunLoop_ReadQueueItem, stream, { @@ -387,12 +389,12 @@ queueItem->_buffer = buffer; queueItem->_length = length; }) } -+ (void)OF_addAsyncReadForStream: (OFStream*)stream - buffer: (void*)buffer ++ (void)OF_addAsyncReadForStream: (OFStream *)stream + buffer: (void *)buffer exactLength: (size_t)exactLength target: (id)target selector: (SEL)selector { ADD_READ(OFRunLoop_ExactReadQueueItem, stream, { @@ -401,11 +403,11 @@ queueItem->_buffer = buffer; queueItem->_exactLength = exactLength; }) } -+ (void)OF_addAsyncReadLineForStream: (OFStream*)stream ++ (void)OF_addAsyncReadLineForStream: (OFStream *)stream encoding: (of_string_encoding_t)encoding target: (id)target selector: (SEL)selector { ADD_READ(OFRunLoop_ReadLineQueueItem, stream, { @@ -413,22 +415,22 @@ queueItem->_selector = selector; queueItem->_encoding = encoding; }) } -+ (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)stream ++ (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket *)stream target: (id)target selector: (SEL)selector { ADD_READ(OFRunLoop_AcceptQueueItem, stream, { queueItem->_target = [target retain]; queueItem->_selector = selector; }) } -+ (void)OF_addAsyncReceiveForUDPSocket: (OFUDPSocket*)socket - buffer: (void*)buffer ++ (void)OF_addAsyncReceiveForUDPSocket: (OFUDPSocket *)socket + buffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector { ADD_READ(OFRunLoop_UDPReceiveQueueItem, socket, { @@ -438,12 +440,12 @@ queueItem->_selector = selector; }) } # ifdef OF_HAVE_BLOCKS -+ (void)OF_addAsyncReadForStream: (OFStream*)stream - buffer: (void*)buffer ++ (void)OF_addAsyncReadForStream: (OFStream *)stream + buffer: (void *)buffer length: (size_t)length block: (of_stream_async_read_block_t)block { ADD_READ(OFRunLoop_ReadQueueItem, stream, { queueItem->_block = [block copy]; @@ -450,12 +452,12 @@ queueItem->_buffer = buffer; queueItem->_length = length; }) } -+ (void)OF_addAsyncReadForStream: (OFStream*)stream - buffer: (void*)buffer ++ (void)OF_addAsyncReadForStream: (OFStream *)stream + buffer: (void *)buffer exactLength: (size_t)exactLength block: (of_stream_async_read_block_t)block { ADD_READ(OFRunLoop_ExactReadQueueItem, stream, { queueItem->_block = [block copy]; @@ -462,30 +464,30 @@ queueItem->_buffer = buffer; queueItem->_exactLength = exactLength; }) } -+ (void)OF_addAsyncReadLineForStream: (OFStream*)stream ++ (void)OF_addAsyncReadLineForStream: (OFStream *)stream encoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block { ADD_READ(OFRunLoop_ReadLineQueueItem, stream, { queueItem->_block = [block copy]; queueItem->_encoding = encoding; }) } -+ (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)stream ++ (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket *)stream block: (of_tcp_socket_async_accept_block_t)block { ADD_READ(OFRunLoop_AcceptQueueItem, stream, { queueItem->_block = [block copy]; }) } -+ (void)OF_addAsyncReceiveForUDPSocket: (OFUDPSocket*)socket - buffer: (void*)buffer ++ (void)OF_addAsyncReceiveForUDPSocket: (OFUDPSocket *)socket + buffer: (void *)buffer length: (size_t)length block: (of_udp_socket_async_receive_block_t) block { ADD_READ(OFRunLoop_UDPReceiveQueueItem, socket, { @@ -560,11 +562,11 @@ #endif [super dealloc]; } -- (void)addTimer: (OFTimer*)timer +- (void)addTimer: (OFTimer *)timer { #ifdef OF_HAVE_THREADS [_timersQueueLock lock]; @try { #endif @@ -582,11 +584,11 @@ #elif defined(OF_HAVE_THREADS) [_condition signal]; #endif } -- (void)OF_removeTimer: (OFTimer*)timer +- (void)OF_removeTimer: (OFTimer *)timer { #ifdef OF_HAVE_THREADS [_timersQueueLock lock]; @try { #endif @@ -611,11 +613,11 @@ { /* * Retain the queue so that it doesn't disappear from us because the * handler called -[cancelAsyncRequests]. */ - OFList OF_GENERIC(OF_KINDOF(OFRunLoop_ReadQueueItem*)) *queue = + OFList OF_GENERIC(OF_KINDOF(OFRunLoop_ReadQueueItem *)) *queue = [[_readQueues objectForKey: object] retain]; assert(queue != nil); @try { @@ -647,11 +649,11 @@ - (void)run { [self runUntilDate: nil]; } -- (void)runUntilDate: (OFDate*)deadline +- (void)runUntilDate: (OFDate *)deadline { _stop = false; for (;;) { void *pool = objc_autoreleasePoolPush();