Index: src/OFDNSResolver.h ================================================================== --- src/OFDNSResolver.h +++ src/OFDNSResolver.h @@ -216,11 +216,11 @@ * @param query The query to perform * @param runLoopMode The run loop mode in which to resolve * @param delegate The delegate to use for callbacks */ - (void)asyncPerformQuery: (OFDNSQuery *)query - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode delegate: (id )delegate; /** * @brief Asynchronously resolves the specified host to socket addresses. * @@ -249,11 +249,11 @@ * @param runLoopMode The run loop mode in which to resolve * @param delegate The delegate to use for callbacks */ - (void)asyncResolveAddressesForHost: (OFString *)host addressFamily: (of_socket_address_family_t)addressFamily - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode delegate: (id )delegate; /** * @brief Synchronously resolves the specified host to socket addresses. * Index: src/OFDNSResolver.m ================================================================== --- src/OFDNSResolver.m +++ src/OFDNSResolver.m @@ -698,11 +698,11 @@ { _settings->_configReloadInterval = configReloadInterval; } - (void)of_sendQueryForContext: (OFDNSResolverContext *)context - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { OFUDPSocket *sock; OFString *nameServer; [_queries setObject: context forKey: context->_ID]; @@ -784,16 +784,16 @@ - (void)asyncPerformQuery: (OFDNSQuery *)query delegate: (id )delegate { [self asyncPerformQuery: query - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode delegate: delegate]; } - (void)asyncPerformQuery: (OFDNSQuery *)query - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode delegate: (id )delegate { void *pool = objc_autoreleasePoolPush(); OFNumber *ID; OFDNSResolverContext *context; @@ -827,11 +827,11 @@ objc_autoreleasePoolPop(pool); } - (void)of_contextTimedOut: (OFDNSResolverContext *)context { - of_run_loop_mode_t runLoopMode = [OFRunLoop currentRunLoop].currentMode; + OFRunLoopMode runLoopMode = [OFRunLoop currentRunLoop].currentMode; OFDNSQueryFailedException *exception; if (context->_TCPSocket != nil) { context->_TCPSocket.delegate = nil; [context->_TCPSocket cancelAsyncRequests]; @@ -936,11 +936,11 @@ if ((buffer[2] & 0x78) != (queryDataBuffer[2] & 0x78)) @throw [OFInvalidServerReplyException exception]; /* TC */ if (buffer[2] & 0x02) { - of_run_loop_mode_t runLoopMode; + OFRunLoopMode runLoopMode; if (context->_settings->_usesTCP) @throw [OFTruncatedDataException exception]; context->_settings->_usesTCP = true; @@ -979,11 +979,11 @@ } if (tryNextNameServer) { if (context->_nameServersIndex + 1 < context->_settings->_nameServers.count) { - of_run_loop_mode_t runLoopMode = + OFRunLoopMode runLoopMode = [OFRunLoop currentRunLoop].currentMode; context->_nameServersIndex++; [self of_sendQueryForContext: context @@ -1180,27 +1180,27 @@ - (void)asyncResolveAddressesForHost: (OFString *)host delegate: (id )delegate { [self asyncResolveAddressesForHost: host addressFamily: OF_SOCKET_ADDRESS_FAMILY_ANY - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode delegate: delegate]; } - (void)asyncResolveAddressesForHost: (OFString *)host addressFamily: (of_socket_address_family_t)addressFamily delegate: (id )delegate { [self asyncResolveAddressesForHost: host addressFamily: addressFamily - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode delegate: delegate]; } - (void)asyncResolveAddressesForHost: (OFString *)host addressFamily: (of_socket_address_family_t)addressFamily - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode delegate: (id )delegate { void *pool = objc_autoreleasePoolPush(); OFHostAddressResolver *resolver = [[[OFHostAddressResolver alloc] initWithHost: host Index: src/OFDatagramSocket.h ================================================================== --- src/OFDatagramSocket.h +++ src/OFDatagramSocket.h @@ -181,11 +181,11 @@ * @param length The length of the buffer * @param runLoopMode The run loop mode in which to perform the async receive */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously receives a datagram and stores it into the specified * buffer. @@ -221,11 +221,11 @@ * the datagram received next, you need to return false from the * method. */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFDatagramSocketAsyncReceiveBlock)block; #endif /** * @brief Sends the specified datagram to the specified address. @@ -257,11 +257,11 @@ * datagram should be sent. The receiver is copied. * @param runLoopMode The run loop mode in which to perform the async send */ - (void)asyncSendData: (OFData *)data receiver: (const of_socket_address_t *)receiver - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously sends the specified datagram to the specified address. * @@ -287,11 +287,11 @@ * return the data for the next send with the same callback or nil * if it should not repeat. */ - (void)asyncSendData: (OFData *)data receiver: (const of_socket_address_t *)receiver - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFDatagramSocketAsyncSendDataBlock)block; #endif /** * @brief Cancels all pending asynchronous requests on the socket. Index: src/OFDatagramSocket.m ================================================================== --- src/OFDatagramSocket.m +++ src/OFDatagramSocket.m @@ -219,16 +219,16 @@ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length { [self asyncReceiveIntoBuffer: buffer length: length - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncReceiveForDatagramSocket: self buffer: buffer length: length mode: runLoopMode @@ -243,17 +243,17 @@ length: (size_t)length block: (OFDatagramSocketAsyncReceiveBlock)block { [self asyncReceiveIntoBuffer: buffer length: length - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFDatagramSocketAsyncReceiveBlock)block { [OFRunLoop of_addAsyncReceiveForDatagramSocket: self buffer: buffer length: length @@ -309,16 +309,16 @@ - (void)asyncSendData: (OFData *)data receiver: (const of_socket_address_t *)receiver { [self asyncSendData: data receiver: receiver - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncSendData: (OFData *)data receiver: (const of_socket_address_t *)receiver - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncSendForDatagramSocket: self data: data receiver: receiver mode: runLoopMode @@ -333,17 +333,17 @@ receiver: (const of_socket_address_t *)receiver block: (OFDatagramSocketAsyncSendDataBlock)block { [self asyncSendData: data receiver: receiver - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncSendData: (OFData *)data receiver: (const of_socket_address_t *)receiver - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFDatagramSocketAsyncSendDataBlock)block { [OFRunLoop of_addAsyncSendForDatagramSocket: self data: data receiver: receiver @@ -354,11 +354,11 @@ #endif - (void)cancelAsyncRequests { [OFRunLoop of_cancelAsyncRequestsForObject: self - mode: of_run_loop_mode_default]; + mode: OFDefaultRunLoopMode]; } - (int)fileDescriptorForReading { #ifndef OF_WINDOWS Index: src/OFHostAddressResolver.h ================================================================== --- src/OFHostAddressResolver.h +++ src/OFHostAddressResolver.h @@ -31,11 +31,11 @@ { OFString *_host; of_socket_address_family_t _addressFamily; OFDNSResolver *_resolver; OFDNSResolverSettings *_settings; - of_run_loop_mode_t _Nullable _runLoopMode; + OFRunLoopMode _Nullable _runLoopMode; id _Nullable _delegate; bool _isFQDN; size_t _searchDomainIndex; unsigned int _numExpectedResponses; OFMutableData *_addresses; @@ -43,12 +43,12 @@ - (instancetype)initWithHost: (OFString *)host addressFamily: (of_socket_address_family_t)addressFamily resolver: (OFDNSResolver *)resolver settings: (OFDNSResolverSettings *)settings - runLoopMode: (nullable of_run_loop_mode_t)runLoopMode + runLoopMode: (nullable OFRunLoopMode)runLoopMode delegate: (nullable id )delegate; - (void)asyncResolve; - (OFData *)resolve; @end OF_ASSUME_NONNULL_END Index: src/OFHostAddressResolver.m ================================================================== --- src/OFHostAddressResolver.m +++ src/OFHostAddressResolver.m @@ -38,12 +38,12 @@ OFData *_addresses; id _exception; } @end -static const of_run_loop_mode_t resolveRunLoopMode = - @"of_host_address_resolver_resolve_mode"; +static const OFRunLoopMode resolveRunLoopMode = + @"OFHostAddressResolverResolveRunLoopMode"; static bool isFQDN(OFString *host, unsigned int minNumberOfDotsInAbsoluteName) { const char *UTF8String; @@ -89,11 +89,11 @@ *address = [record address]; return true; } static void -callDelegateInMode(of_run_loop_mode_t runLoopMode, +callDelegateInMode(OFRunLoopMode runLoopMode, id delegate, OFDNSResolver *resolver, OFString *host, OFData *addresses, id exception) { SEL selector = @selector(resolver:didResolveHost:addresses:exception:); @@ -115,11 +115,11 @@ @implementation OFHostAddressResolver: OFObject - (instancetype)initWithHost: (OFString *)host addressFamily: (of_socket_address_family_t)addressFamily resolver: (OFDNSResolver *)resolver settings: (OFDNSResolverSettings *)settings - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode delegate: (id )delegate { self = [super init]; @try { Index: src/OFIPSocketAsyncConnector.h ================================================================== --- src/OFIPSocketAsyncConnector.h +++ src/OFIPSocketAsyncConnector.h @@ -44,10 +44,10 @@ host: (OFString *)host port: (uint16_t)port delegate: (nullable id)delegate block: (nullable id)block; - (void)didConnect; -- (void)tryNextAddressWithRunLoopMode: (of_run_loop_mode_t)runLoopMode; -- (void)startWithRunLoopMode: (of_run_loop_mode_t)runLoopMode; +- (void)tryNextAddressWithRunLoopMode: (OFRunLoopMode)runLoopMode; +- (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode; @end OF_ASSUME_NONNULL_END Index: src/OFIPSocketAsyncConnector.m ================================================================== --- src/OFIPSocketAsyncConnector.m +++ src/OFIPSocketAsyncConnector.m @@ -130,11 +130,11 @@ port: _port socket: _socket errNo: errNo]; } -- (void)tryNextAddressWithRunLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)tryNextAddressWithRunLoopMode: (OFRunLoopMode)runLoopMode { of_socket_address_t address = *(const of_socket_address_t *) [_socketAddresses itemAtIndex: _socketAddressesIndex++]; int errNo; @@ -221,11 +221,11 @@ [self tryNextAddressWithRunLoopMode: [OFRunLoop currentRunLoop].currentMode]; } -- (void)startWithRunLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode { @try { of_socket_address_t address = of_socket_address_parse_ip(_host, _port); Index: src/OFRunLoop+Private.h ================================================================== --- src/OFRunLoop+Private.h +++ src/OFRunLoop+Private.h @@ -37,93 +37,92 @@ #ifdef OF_HAVE_SOCKETS + (void)of_addAsyncReadForStream: (OFStream *) stream buffer: (void *)buffer length: (size_t)length - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFStreamAsyncReadBlock)block # endif delegate: (nullable id )delegate; + (void)of_addAsyncReadForStream: (OFStream *) stream buffer: (void *)buffer exactLength: (size_t)length - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFStreamAsyncReadBlock)block # endif delegate: (nullable id )delegate; + (void)of_addAsyncReadLineForStream: (OFStream *) stream encoding: (OFStringEncoding)encoding - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFStreamAsyncReadLineBlock)block # endif delegate: (nullable id )delegate; + (void)of_addAsyncWriteForStream: (OFStream *) stream data: (OFData *)data - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFStreamAsyncWriteDataBlock)block # endif delegate: (nullable id )delegate; + (void)of_addAsyncWriteForStream: (OFStream *) stream string: (OFString *)string encoding: (OFStringEncoding)encoding - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFStreamAsyncWriteStringBlock)block # endif delegate: (nullable id )delegate; # if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) + (void)of_addAsyncConnectForSocket: (id)socket - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode delegate: (id )delegate; # endif + (void)of_addAsyncAcceptForSocket: (id)socket - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode block: (nullable id)block delegate: (nullable id)delegate; + (void)of_addAsyncReceiveForDatagramSocket: (OFDatagramSocket *)socket buffer: (void *)buffer length: (size_t)length - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFDatagramSocketAsyncReceiveBlock)block # endif delegate: (nullable id ) delegate; + (void)of_addAsyncSendForDatagramSocket: (OFDatagramSocket *)socket data: (OFData *)data receiver: (const of_socket_address_t *)receiver - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFDatagramSocketAsyncSendDataBlock)block # endif delegate: (nullable id )delegate; + (void)of_addAsyncReceiveForSequencedPacketSocket: (OFSequencedPacketSocket *)socket buffer: (void *)buffer length: (size_t)length - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFSequencedPacketSocketAsyncReceiveBlock)block # endif delegate: (nullable id ) delegate; + (void)of_addAsyncSendForSequencedPacketSocket: (OFSequencedPacketSocket *)socket data: (OFData *)data - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (nullable OFSequencedPacketSocketAsyncSendDataBlock)block # endif delegate: (nullable id )delegate; -+ (void)of_cancelAsyncRequestsForObject: (id)object - mode: (of_run_loop_mode_t)mode; ++ (void)of_cancelAsyncRequestsForObject: (id)object mode: (OFRunLoopMode)mode; #endif -- (void)of_removeTimer: (OFTimer *)timer forMode: (of_run_loop_mode_t)mode; +- (void)of_removeTimer: (OFTimer *)timer forMode: (OFRunLoopMode)mode; @end OF_ASSUME_NONNULL_END Index: src/OFRunLoop.h ================================================================== --- src/OFRunLoop.h +++ src/OFRunLoop.h @@ -37,19 +37,19 @@ @class OFDate; /** * @brief A mode for an OFRunLoop. */ -typedef OFConstantString *of_run_loop_mode_t; +typedef OFConstantString *OFRunLoopMode; #ifdef __cplusplus extern "C" { #endif /** * @brief The default mode for an OFRunLoop. */ -extern const of_run_loop_mode_t of_run_loop_mode_default; +extern const OFRunLoopMode OFDefaultRunLoopMode; #ifdef __cplusplus } #endif /** @@ -62,20 +62,19 @@ { OFMutableDictionary *_states; #ifdef OF_HAVE_THREADS OFMutex *_statesMutex; #endif - of_run_loop_mode_t _Nullable _currentMode; + OFRunLoopMode _Nullable _currentMode; volatile bool _stop; } #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nullable, nonatomic) OFRunLoop *mainRunLoop; @property (class, readonly, nullable, nonatomic) OFRunLoop *currentRunLoop; #endif -@property OF_NULLABLE_PROPERTY (readonly, nonatomic) - of_run_loop_mode_t currentMode; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFRunLoopMode currentMode; /** * @brief Returns the run loop for the main thread. * * @return The run loop for the main thread @@ -100,11 +99,11 @@ * @brief Adds an OFTimer to the run loop for the specified mode. * * @param timer The timer to add * @param mode The run loop mode in which to run the timer */ -- (void)addTimer: (OFTimer *)timer forMode: (of_run_loop_mode_t)mode; +- (void)addTimer: (OFTimer *)timer forMode: (OFRunLoopMode)mode; #ifdef OF_AMIGAOS /** * @brief Adds an Exec Signal to the run loop. * @@ -135,11 +134,11 @@ * @param selector The selector to call on the target when the signal was * received. The selector must have one parameter for the ULONG * of the signal that was received. */ - (void)addExecSignal: (ULONG)signal - forMode: (of_run_loop_mode_t)mode + forMode: (OFRunLoopMode)mode target: (id)target selector: (SEL)selector; /** * @brief Removes the specified Exec Signal with the specified target and @@ -161,11 +160,11 @@ * @param mode The run loop mode to which the signal was added * @param target The target which was specified when adding the signal * @param selector The selector which was specified when adding the signal */ - (void)removeExecSignal: (ULONG)signal - forMode: (of_run_loop_mode_t)mode + forMode: (OFRunLoopMode)mode target: (id)target selector: (SEL)selector; #endif /** @@ -185,16 +184,15 @@ * deadline is reached. * * @param mode The mode in which to run the run loop * @param deadline The date until which the run loop should run at the longest */ -- (void)runMode: (of_run_loop_mode_t)mode - beforeDate: (nullable OFDate *)deadline; +- (void)runMode: (OFRunLoopMode)mode beforeDate: (nullable OFDate *)deadline; /** * @brief Stops the run loop. If there is still an operation being executed, it * is finished before the run loop stops. */ - (void)stop; @end OF_ASSUME_NONNULL_END Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -41,11 +41,11 @@ #import "OFTimer+Private.h" #import "OFDate.h" #import "OFObserveFailedException.h" -const of_run_loop_mode_t of_run_loop_mode_default = @"of_run_loop_mode_default"; +const OFRunLoopMode OFDefaultRunLoopMode = @"OFDefaultRunLoopMode"; static OFRunLoop *mainRunLoop = nil; @interface OFRunLoopState: OFObject #ifdef OF_HAVE_SOCKETS @@ -1014,11 +1014,11 @@ { mainRunLoop = [runLoop retain]; } static OFRunLoopState * -stateForMode(OFRunLoop *self, of_run_loop_mode_t mode, bool create) +stateForMode(OFRunLoop *self, OFRunLoopMode mode, bool create) { OFRunLoopState *state; #ifdef OF_HAVE_THREADS [self->_statesMutex lock]; @@ -1085,11 +1085,11 @@ + (void)of_addAsyncReadForStream: (OFStream *) stream buffer: (void *)buffer length: (size_t)length - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (OFStreamAsyncReadBlock)block # endif delegate: (id )delegate { @@ -1107,11 +1107,11 @@ + (void)of_addAsyncReadForStream: (OFStream *) stream buffer: (void *)buffer exactLength: (size_t)exactLength - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (OFStreamAsyncReadBlock)block # endif delegate: (id )delegate { @@ -1128,11 +1128,11 @@ } + (void)of_addAsyncReadLineForStream: (OFStream *) stream encoding: (OFStringEncoding)encoding - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (OFStreamAsyncReadLineBlock)block # endif delegate: (id )delegate { @@ -1148,11 +1148,11 @@ } + (void)of_addAsyncWriteForStream: (OFStream *) stream data: (OFData *)data - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (OFStreamAsyncWriteDataBlock)block # endif delegate: (id )delegate { @@ -1169,11 +1169,11 @@ + (void)of_addAsyncWriteForStream: (OFStream *) stream string: (OFString *)string encoding: (OFStringEncoding)encoding - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (OFStreamAsyncWriteStringBlock)block # endif delegate: (id )delegate { @@ -1189,11 +1189,11 @@ QUEUE_ITEM } # if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) + (void)of_addAsyncConnectForSocket: (id)sock - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode delegate: (id )delegate { NEW_WRITE(OFRunLoopConnectQueueItem, sock, mode) queueItem->_delegate = [delegate retain]; @@ -1201,11 +1201,11 @@ QUEUE_ITEM } # endif + (void)of_addAsyncAcceptForSocket: (id)sock - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode block: (id)block delegate: (id)delegate { NEW_READ(OFRunLoopAcceptQueueItem, sock, mode) @@ -1218,11 +1218,11 @@ } + (void)of_addAsyncReceiveForDatagramSocket: (OFDatagramSocket *)sock buffer: (void *)buffer length: (size_t)length - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (OFDatagramSocketAsyncReceiveBlock)block # endif delegate: (id )delegate { @@ -1239,11 +1239,11 @@ } + (void)of_addAsyncSendForDatagramSocket: (OFDatagramSocket *)sock data: (OFData *)data receiver: (const of_socket_address_t *)receiver - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (OFDatagramSocketAsyncSendDataBlock)block # endif delegate: (id )delegate { @@ -1261,11 +1261,11 @@ + (void)of_addAsyncReceiveForSequencedPacketSocket: (OFSequencedPacketSocket *) sock buffer: (void *)buffer length: (size_t)length - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (OFSequencedPacketSocketAsyncReceiveBlock)block # endif delegate: (id )delegate { @@ -1281,11 +1281,11 @@ QUEUE_ITEM } + (void)of_addAsyncSendForSequencedPacketSocket: (OFSequencedPacketSocket *)sock data: (OFData *)data - mode: (of_run_loop_mode_t)mode + mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS block: (OFSequencedPacketSocketAsyncSendDataBlock)block # endif delegate: (id )delegate { @@ -1301,12 +1301,11 @@ } # undef NEW_READ # undef NEW_WRITE # undef QUEUE_ITEM -+ (void)of_cancelAsyncRequestsForObject: (id)object - mode: (of_run_loop_mode_t)mode ++ (void)of_cancelAsyncRequestsForObject: (id)object mode: (OFRunLoopMode)mode { void *pool = objc_autoreleasePoolPush(); OFRunLoop *runLoop = [self currentRunLoop]; OFRunLoopState *state = stateForMode(runLoop, mode, false); OFList *queue; @@ -1353,12 +1352,11 @@ _states = [[OFMutableDictionary alloc] init]; state = [[OFRunLoopState alloc] init]; @try { - [_states setObject: state - forKey: of_run_loop_mode_default]; + [_states setObject: state forKey: OFDefaultRunLoopMode]; } @finally { [state release]; } #ifdef OF_HAVE_THREADS @@ -1382,14 +1380,14 @@ [super dealloc]; } - (void)addTimer: (OFTimer *)timer { - [self addTimer: timer forMode: of_run_loop_mode_default]; + [self addTimer: timer forMode: OFDefaultRunLoopMode]; } -- (void)addTimer: (OFTimer *)timer forMode: (of_run_loop_mode_t)mode +- (void)addTimer: (OFTimer *)timer forMode: (OFRunLoopMode)mode { OFRunLoopState *state = stateForMode(self, mode, true); #ifdef OF_HAVE_THREADS [state->_timersQueueMutex lock]; @@ -1409,11 +1407,11 @@ #elif defined(OF_HAVE_THREADS) [state->_condition signal]; #endif } -- (void)of_removeTimer: (OFTimer *)timer forMode: (of_run_loop_mode_t)mode +- (void)of_removeTimer: (OFTimer *)timer forMode: (OFRunLoopMode)mode { OFRunLoopState *state = stateForMode(self, mode, false); if (state == nil) return; @@ -1440,17 +1438,17 @@ #ifdef OF_AMIGAOS - (void)addExecSignal: (ULONG)signal target: (id)target selector: (SEL)selector { [self addExecSignal: signal - forMode: of_run_loop_mode_default + forMode: OFDefaultRunLoopMode target: target selector: selector]; } - (void)addExecSignal: (ULONG)signal - forMode: (of_run_loop_mode_t)mode + forMode: (OFRunLoopMode)mode target: (id)target selector: (SEL)selector { OFRunLoopState *state = stateForMode(self, mode, true); @@ -1483,17 +1481,17 @@ - (void)removeExecSignal: (ULONG)signal target: (id)target selector: (SEL)selector { [self removeExecSignal: signal - forMode: of_run_loop_mode_default + forMode: OFDefaultRunLoopMode target: target selector: selector]; } - (void)removeExecSignal: (ULONG)signal - forMode: (of_run_loop_mode_t)mode + forMode: (OFRunLoopMode)mode target: (id)target selector: (SEL)selector { OFRunLoopState *state = stateForMode(self, mode, false); @@ -1553,17 +1551,17 @@ { _stop = false; while (!_stop && (deadline == nil || deadline.timeIntervalSinceNow >= 0)) - [self runMode: of_run_loop_mode_default beforeDate: deadline]; + [self runMode: OFDefaultRunLoopMode beforeDate: deadline]; } -- (void)runMode: (of_run_loop_mode_t)mode beforeDate: (OFDate *)deadline +- (void)runMode: (OFRunLoopMode)mode beforeDate: (OFDate *)deadline { void *pool = objc_autoreleasePoolPush(); - of_run_loop_mode_t previousMode = _currentMode; + OFRunLoopMode previousMode = _currentMode; OFRunLoopState *state = stateForMode(self, mode, false); if (state == nil) return; @@ -1693,12 +1691,11 @@ } } - (void)stop { - OFRunLoopState *state = - stateForMode(self, of_run_loop_mode_default, false); + OFRunLoopState *state = stateForMode(self, OFDefaultRunLoopMode, false); _stop = true; if (state == nil) return; Index: src/OFSPXSocket.h ================================================================== --- src/OFSPXSocket.h +++ src/OFSPXSocket.h @@ -116,11 +116,11 @@ * @param runLoopMode The run loop mode in which to perform the async connect */ - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously connect the OFSPXSocket to the specified destination. * @@ -146,11 +146,11 @@ * @param block The block to execute once the connection has been established */ - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFSPXSocketAsyncConnectBlock)block; #endif /** * @brief Bind the socket to the specified network, node and port. Index: src/OFSPXSocket.m ================================================================== --- src/OFSPXSocket.m +++ src/OFSPXSocket.m @@ -61,11 +61,11 @@ port: (uint16_t)port #ifdef OF_HAVE_BLOCKS block: (OFSPXSocketAsyncConnectBlock)block #endif ; -- (void)startWithRunLoopMode: (of_run_loop_mode_t)runLoopMode; +- (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode; @end @implementation OFSPXSocketAsyncConnectDelegate - (instancetype)initWithSocket: (OFSPXSocket *)sock node: (unsigned char [IPX_NODE_LEN])node @@ -101,11 +101,11 @@ #endif [super dealloc]; } -- (void)startWithRunLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode { of_socket_address_t address = of_socket_address_ipx(_node, _network, _port); id exception = nil; int errNo; @@ -252,17 +252,17 @@ port: (uint16_t)port { [self asyncConnectToNode: node network: network port: port - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { void *pool = objc_autoreleasePoolPush(); [[[[OFSPXSocketAsyncConnectDelegate alloc] initWithSocket: self @@ -284,18 +284,18 @@ block: (OFSPXSocketAsyncConnectBlock)block { [self asyncConnectToNode: node network: network port: port - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFSPXSocketAsyncConnectBlock)block { void *pool = objc_autoreleasePoolPush(); [[[[OFSPXSocketAsyncConnectDelegate alloc] Index: src/OFSPXStreamSocket.h ================================================================== --- src/OFSPXStreamSocket.h +++ src/OFSPXStreamSocket.h @@ -119,11 +119,11 @@ * @param runLoopMode The run loop mode in which to perform the async connect */ - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously connect the OFSPXStreamSocket to the specified * destination. @@ -151,11 +151,11 @@ * @param block The block to execute once the connection has been established */ - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFSPXStreamSocketAsyncConnectBlock)block; #endif /** * @brief Bind the socket to the specified network, node and port. Index: src/OFSPXStreamSocket.m ================================================================== --- src/OFSPXStreamSocket.m +++ src/OFSPXStreamSocket.m @@ -62,11 +62,11 @@ port: (uint16_t)port #ifdef OF_HAVE_BLOCKS block: (OFSPXStreamSocketAsyncConnectBlock)block #endif ; -- (void)startWithRunLoopMode: (of_run_loop_mode_t)runLoopMode; +- (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode; @end @implementation OFSPXStreamSocketAsyncConnectDelegate - (instancetype)initWithSocket: (OFSPXStreamSocket *)sock node: (unsigned char [IPX_NODE_LEN])node @@ -102,11 +102,11 @@ #endif [super dealloc]; } -- (void)startWithRunLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode { of_socket_address_t address = of_socket_address_ipx(_node, _network, _port); id exception = nil; int errNo; @@ -254,17 +254,17 @@ port: (uint16_t)port { [self asyncConnectToNode: node network: network port: port - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { void *pool = objc_autoreleasePoolPush(); [[[[OFSPXStreamSocketAsyncConnectDelegate alloc] initWithSocket: self @@ -286,18 +286,18 @@ block: (OFSPXStreamSocketAsyncConnectBlock)block { [self asyncConnectToNode: node network: network port: port - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFSPXStreamSocketAsyncConnectBlock)block { void *pool = objc_autoreleasePoolPush(); [[[[OFSPXStreamSocketAsyncConnectDelegate alloc] Index: src/OFSequencedPacketSocket.h ================================================================== --- src/OFSequencedPacketSocket.h +++ src/OFSequencedPacketSocket.h @@ -201,11 +201,11 @@ * @param length The length of the buffer * @param runLoopMode The run loop mode in which to perform the async receive */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously receives a packet and stores it into the specified * buffer. @@ -239,11 +239,11 @@ * If you want the next method in the queue to handle the packet * received next, you need to return false from the method. */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFSequencedPacketSocketAsyncReceiveBlock)block; #endif /** * @brief Sends the specified packet. @@ -264,12 +264,11 @@ * @brief Asynchronously sends the specified packet. * * @param data The data to send as a packet * @param runLoopMode The run loop mode in which to perform the async send */ -- (void)asyncSendData: (OFData *)data - runLoopMode: (of_run_loop_mode_t)runLoopMode; +- (void)asyncSendData: (OFData *)data runLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously sends the specified packet. * @@ -289,11 +288,11 @@ * @param block The block to call when the packet has been sent. It should * return the data for the next send with the same callback or nil * if it should not repeat. */ - (void)asyncSendData: (OFData *)data - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFSequencedPacketSocketAsyncSendDataBlock)block; #endif /** * @brief Listen on the socket. @@ -322,11 +321,11 @@ /** * @brief Asynchronously accept an incoming connection. * * @param runLoopMode The run loop mode in which to perform the async accept */ -- (void)asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode; +- (void)asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously accept an incoming connection. * @@ -343,11 +342,11 @@ * @param block The block to execute when a new connection has been accepted. * Returns whether the next incoming connection should be accepted * by the specified block as well. */ - (void) - asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode + asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode block: (OFSequencedPacketSocketAsyncAcceptBlock)block; #endif /** * @brief Cancels all pending asynchronous requests on the socket. Index: src/OFSequencedPacketSocket.m ================================================================== --- src/OFSequencedPacketSocket.m +++ src/OFSequencedPacketSocket.m @@ -178,16 +178,16 @@ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length { [self asyncReceiveIntoBuffer: buffer length: length - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncReceiveForSequencedPacketSocket: self buffer: buffer length: length mode: runLoopMode @@ -202,18 +202,18 @@ length: (size_t)length block: (OFSequencedPacketSocketAsyncReceiveBlock)block { [self asyncReceiveIntoBuffer: buffer length: length - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void) asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFSequencedPacketSocketAsyncReceiveBlock)block { [OFRunLoop of_addAsyncReceiveForSequencedPacketSocket: self buffer: buffer length: length @@ -261,15 +261,14 @@ errNo: 0]; } - (void)asyncSendData: (OFData *)data { - [self asyncSendData: data runLoopMode: of_run_loop_mode_default]; + [self asyncSendData: data runLoopMode: OFDefaultRunLoopMode]; } -- (void)asyncSendData: (OFData *)data - runLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)asyncSendData: (OFData *)data runLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncSendForSequencedPacketSocket: self data: data mode: runLoopMode # ifdef OF_HAVE_BLOCKS @@ -281,16 +280,16 @@ #ifdef OF_HAVE_BLOCKS - (void)asyncSendData: (OFData *)data block: (OFSequencedPacketSocketAsyncSendDataBlock)block { [self asyncSendData: data - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncSendData: (OFData *)data - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFSequencedPacketSocketAsyncSendDataBlock)block { [OFRunLoop of_addAsyncSendForSequencedPacketSocket: self data: data mode: runLoopMode @@ -386,14 +385,14 @@ return client; } - (void)asyncAccept { - [self asyncAcceptWithRunLoopMode: of_run_loop_mode_default]; + [self asyncAcceptWithRunLoopMode: OFDefaultRunLoopMode]; } -- (void)asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncAcceptForSocket: self mode: runLoopMode block: NULL delegate: _delegate]; @@ -400,16 +399,15 @@ } #ifdef OF_HAVE_BLOCKS - (void)asyncAcceptWithBlock: (OFSequencedPacketSocketAsyncAcceptBlock)block { - [self asyncAcceptWithRunLoopMode: of_run_loop_mode_default - block: block]; + [self asyncAcceptWithRunLoopMode: OFDefaultRunLoopMode block: block]; } - (void) - asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode + asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode block: (OFSequencedPacketSocketAsyncAcceptBlock)block { [OFRunLoop of_addAsyncAcceptForSocket: self mode: runLoopMode block: block @@ -432,11 +430,11 @@ } - (void)cancelAsyncRequests { [OFRunLoop of_cancelAsyncRequestsForObject: self - mode: of_run_loop_mode_default]; + mode: OFDefaultRunLoopMode]; } - (int)fileDescriptorForReading { #ifndef OF_WINDOWS Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -310,11 +310,11 @@ * The buffer *must* be *at least* this big! * @param runLoopMode The run loop mode in which to perform the async read */ - (void)asyncReadIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; /** * @brief Asynchronously reads exactly the specified length bytes from the * stream into a buffer. * @@ -349,11 +349,11 @@ * The buffer *must* be *at least* this big! * @param runLoopMode The run loop mode in which to perform the async read */ - (void)asyncReadIntoBuffer: (void *)buffer exactLength: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; # ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously reads *at most* ref size bytes from the stream into a * buffer. @@ -409,11 +409,11 @@ * you want the next block in the queue to handle the data * received next, you need to return false from the block. */ - (void)asyncReadIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncReadBlock)block; /** * @brief Asynchronously reads exactly the specified length bytes from the * stream into a buffer. @@ -461,11 +461,11 @@ * you want the next block in the queue to handle the data * received next, you need to return false from the block. */ - (void)asyncReadIntoBuffer: (void *)buffer exactLength: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncReadBlock)block; # endif #endif /** @@ -841,11 +841,11 @@ * * @param encoding The encoding used by the stream * @param runLoopMode The run loop mode in which to perform the async read */ - (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; # ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously reads until a newline, `\0`, end of stream or an * exception occurs. @@ -892,11 +892,11 @@ * line has been received. If you want the next block in the queue * to handle the next line, you need to return false from the * block. */ - (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncReadLineBlock)block; # endif #endif /** @@ -999,11 +999,11 @@ * * @param data The data which is written into the stream * @param runLoopMode The run loop mode in which to perform the async write */ - (void)asyncWriteData: (OFData *)data - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; /** * @brief Asynchronously writes a string in UTF-8 encoding into the stream. * * @note The stream must conform to @ref OFReadyForWritingObserving in order @@ -1039,11 +1039,11 @@ * stream * @param runLoopMode The run loop mode in which to perform the async write */ - (void)asyncWriteString: (OFString *)string encoding: (OFStringEncoding)encoding - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; # ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously writes data into the stream. * @@ -1069,11 +1069,11 @@ * @param block The block to call when the data has been written. It should * return the data for the next write with the same callback or * nil if it should not repeat. */ - (void)asyncWriteData: (OFData *)data - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncWriteDataBlock)block; /** * @brief Asynchronously writes a string into the stream. * @@ -1121,11 +1121,11 @@ * return the string for the next write with the same callback or * nil if it should not repeat. */ - (void)asyncWriteString: (OFString *)string encoding: (OFStringEncoding)encoding - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncWriteStringBlock)block; # endif #endif /** Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -198,16 +198,16 @@ #ifdef OF_HAVE_SOCKETS - (void)asyncReadIntoBuffer: (void *)buffer length: (size_t)length { [self asyncReadIntoBuffer: buffer length: length - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncReadIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { OFStream *stream = (OFStream *)self; [OFRunLoop of_addAsyncReadForStream: stream @@ -222,16 +222,16 @@ - (void)asyncReadIntoBuffer: (void *)buffer exactLength: (size_t)length { [self asyncReadIntoBuffer: buffer exactLength: length - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncReadIntoBuffer: (void *)buffer exactLength: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { OFStream *stream = (OFStream *)self; [OFRunLoop of_addAsyncReadForStream: stream @@ -249,17 +249,17 @@ length: (size_t)length block: (OFStreamAsyncReadBlock)block { [self asyncReadIntoBuffer: buffer length: length - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncReadIntoBuffer: (void *)buffer length: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncReadBlock)block { OFStream *stream = (OFStream *)self; @@ -275,17 +275,17 @@ exactLength: (size_t)length block: (OFStreamAsyncReadBlock)block { [self asyncReadIntoBuffer: buffer exactLength: length - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncReadIntoBuffer: (void *)buffer exactLength: (size_t)length - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncReadBlock)block { OFStream *stream = (OFStream *)self; @@ -807,21 +807,21 @@ #ifdef OF_HAVE_SOCKETS - (void)asyncReadLine { [self asyncReadLineWithEncoding: OFStringEncodingUTF8 - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding { [self asyncReadLineWithEncoding: encoding - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { OFStream *stream = (OFStream *)self; [OFRunLoop of_addAsyncReadLineForStream: stream @@ -835,24 +835,24 @@ # ifdef OF_HAVE_BLOCKS - (void)asyncReadLineWithBlock: (OFStreamAsyncReadLineBlock)block { [self asyncReadLineWithEncoding: OFStringEncodingUTF8 - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding block: (OFStreamAsyncReadLineBlock)block { [self asyncReadLineWithEncoding: encoding - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncReadLineBlock)block { OFStream *stream = (OFStream *)self; @@ -1094,15 +1094,14 @@ } #ifdef OF_HAVE_SOCKETS - (void)asyncWriteData: (OFData *)data { - [self asyncWriteData: data runLoopMode: of_run_loop_mode_default]; + [self asyncWriteData: data runLoopMode: OFDefaultRunLoopMode]; } -- (void)asyncWriteData: (OFData *)data - runLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)asyncWriteData: (OFData *)data runLoopMode: (OFRunLoopMode)runLoopMode { OFStream *stream = (OFStream *)self; [OFRunLoop of_addAsyncWriteForStream: stream @@ -1116,24 +1115,24 @@ - (void)asyncWriteString: (OFString *)string { [self asyncWriteString: string encoding: OFStringEncodingUTF8 - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncWriteString: (OFString *)string encoding: (OFStringEncoding)encoding { [self asyncWriteString: string encoding: encoding - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncWriteString: (OFString *)string encoding: (OFStringEncoding)encoding - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { OFStream *stream = (OFStream *)self; [OFRunLoop of_addAsyncWriteForStream: stream @@ -1148,16 +1147,16 @@ # ifdef OF_HAVE_BLOCKS - (void)asyncWriteData: (OFData *)data block: (OFStreamAsyncWriteDataBlock)block { [self asyncWriteData: data - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncWriteData: (OFData *)data - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncWriteDataBlock)block { OFStream *stream = (OFStream *)self; @@ -1171,27 +1170,27 @@ - (void)asyncWriteString: (OFString *)string block: (OFStreamAsyncWriteStringBlock)block { [self asyncWriteString: string encoding: OFStringEncodingUTF8 - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncWriteString: (OFString *)string encoding: (OFStringEncoding)encoding block: (OFStreamAsyncWriteStringBlock)block { [self asyncWriteString: string encoding: encoding - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncWriteString: (OFString *)string encoding: (OFStringEncoding)encoding - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamAsyncWriteStringBlock)block { OFStream *stream = (OFStream *)self; @@ -1729,11 +1728,11 @@ #ifdef OF_HAVE_SOCKETS - (void)cancelAsyncRequests { [OFRunLoop of_cancelAsyncRequestsForObject: self - mode: of_run_loop_mode_default]; + mode: OFDefaultRunLoopMode]; } #endif - (void)unreadFromBuffer: (const void *)buffer length: (size_t)length { Index: src/OFStreamSocket.h ================================================================== --- src/OFStreamSocket.h +++ src/OFStreamSocket.h @@ -127,11 +127,11 @@ /** * @brief Asynchronously accept an incoming connection. * * @param runLoopMode The run loop mode in which to perform the async accept */ -- (void)asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode; +- (void)asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously accept an incoming connection. * @@ -147,11 +147,11 @@ * @param runLoopMode The run loop mode in which to perform the async accept * @param block The block to execute when a new connection has been accepted. * Returns whether the next incoming connection should be accepted * by the specified block as well. */ -- (void)asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamSocketAsyncAcceptBlock)block; #endif @end OF_ASSUME_NONNULL_END Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -309,14 +309,14 @@ return client; } - (void)asyncAccept { - [self asyncAcceptWithRunLoopMode: of_run_loop_mode_default]; + [self asyncAcceptWithRunLoopMode: OFDefaultRunLoopMode]; } -- (void)asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncAcceptForSocket: self mode: runLoopMode block: NULL delegate: _delegate]; @@ -323,15 +323,14 @@ } #ifdef OF_HAVE_BLOCKS - (void)asyncAcceptWithBlock: (OFStreamSocketAsyncAcceptBlock)block { - [self asyncAcceptWithRunLoopMode: of_run_loop_mode_default - block: block]; + [self asyncAcceptWithRunLoopMode: OFDefaultRunLoopMode block: block]; } -- (void)asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode +- (void)asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode block: (OFStreamSocketAsyncAcceptBlock)block { [OFRunLoop of_addAsyncAcceptForSocket: self mode: runLoopMode block: block Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -168,11 +168,11 @@ * @param port The port on the host to connect to * @param runLoopMode The run loop mode in which to perform the async connect */ - (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode; + runLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously connect the OFTCPSocket to the specified destination. * @@ -192,11 +192,11 @@ * @param runLoopMode The run loop mode in which to perform the async connect * @param block The block to execute once the connection has been established */ - (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFTCPSocketAsyncConnectBlock)block; #endif /** * @brief Bind the socket to the specified host and port. Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -49,12 +49,12 @@ #import "OFSetOptionFailedException.h" #import "socket.h" #import "socket_helpers.h" -static const of_run_loop_mode_t connectRunLoopMode = - @"of_tcp_socket_connect_mode"; +static const OFRunLoopMode connectRunLoopMode = + @"OFTCPSocketConnectRunLoopMode"; Class of_tls_socket_class = Nil; static OFString *defaultSOCKS5Host = nil; static uint16_t defaultSOCKS5Port = 1080; @@ -211,16 +211,16 @@ - (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port { [self asyncConnectToHost: host port: port - runLoopMode: of_run_loop_mode_default]; + runLoopMode: OFDefaultRunLoopMode]; } - (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode { void *pool = objc_autoreleasePoolPush(); id delegate; if (_socket != INVALID_SOCKET) @@ -257,17 +257,17 @@ port: (uint16_t)port block: (OFTCPSocketAsyncConnectBlock)block { [self asyncConnectToHost: host port: port - runLoopMode: of_run_loop_mode_default + runLoopMode: OFDefaultRunLoopMode block: block]; } - (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port - runLoopMode: (of_run_loop_mode_t)runLoopMode + runLoopMode: (OFRunLoopMode)runLoopMode block: (OFTCPSocketAsyncConnectBlock)block { void *pool = objc_autoreleasePoolPush(); id delegate = nil; Index: src/OFTCPSocketSOCKS5Connector.m ================================================================== --- src/OFTCPSocketSOCKS5Connector.m +++ src/OFTCPSocketSOCKS5Connector.m @@ -114,11 +114,11 @@ - (bool)stream: (OFStream *)sock didReadIntoBuffer: (void *)buffer length: (size_t)length exception: (id)exception { - of_run_loop_mode_t runLoopMode; + OFRunLoopMode runLoopMode; unsigned char *SOCKSVersion; uint8_t hostLength; unsigned char port[2]; unsigned char *response, *addressLength; @@ -267,11 +267,11 @@ - (OFData *)stream: (OFStream *)sock didWriteData: (OFData *)data bytesWritten: (size_t)bytesWritten exception: (id)exception { - of_run_loop_mode_t runLoopMode; + OFRunLoopMode runLoopMode; if (exception != nil) { _exception = [exception retain]; [self didConnect]; return nil; Index: src/OFTimer+Private.h ================================================================== --- src/OFTimer+Private.h +++ src/OFTimer+Private.h @@ -18,9 +18,9 @@ OF_ASSUME_NONNULL_BEGIN OF_DIRECT_MEMBERS @interface OFTimer () - (void)of_setInRunLoop: (nullable OFRunLoop *)runLoop - mode: (nullable of_run_loop_mode_t)mode; + mode: (nullable OFRunLoopMode)mode; @end OF_ASSUME_NONNULL_END Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -57,11 +57,11 @@ #ifdef OF_HAVE_THREADS OFCondition *_condition; bool _done; #endif OFRunLoop *_Nullable _inRunLoop; - of_run_loop_mode_t _Nullable _inRunLoopMode; + OFRunLoopMode _Nullable _inRunLoopMode; } /** * @brief The time interval in which the timer will repeat, if it is a * repeating timer. Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -512,14 +512,14 @@ @throw [OFInvalidArgumentException exception]; return [_fireDate compare: timer->_fireDate]; } -- (void)of_setInRunLoop: (OFRunLoop *)runLoop mode: (of_run_loop_mode_t)mode +- (void)of_setInRunLoop: (OFRunLoop *)runLoop mode: (OFRunLoopMode)mode { OFRunLoop *oldInRunLoop = _inRunLoop; - of_run_loop_mode_t oldInRunLoopMode = _inRunLoopMode; + OFRunLoopMode oldInRunLoopMode = _inRunLoopMode; _inRunLoop = [runLoop retain]; [oldInRunLoop release]; _inRunLoopMode = [mode copy];