@@ -54,26 +54,26 @@ # endif of_udp_socket_address_t _address; OFException *_exception; } -- initWithSourceThread: (OFThread*)sourceThread - host: (OFString*)host +- initWithSourceThread: (OFThread *)sourceThread + host: (OFString *)host port: (uint16_t)port target: (id)target selector: (SEL)selector; # ifdef OF_HAVE_BLOCKS -- initWithSourceThread: (OFThread*)sourceThread - host: (OFString*)host +- initWithSourceThread: (OFThread *)sourceThread + host: (OFString *)host port: (uint16_t)port block: (of_udp_socket_async_resolve_block_t)block; # endif @end @implementation OFUDPSocket_ResolveThread -- initWithSourceThread: (OFThread*)sourceThread - host: (OFString*)host +- initWithSourceThread: (OFThread *)sourceThread + host: (OFString *)host port: (uint16_t)port target: (id)target selector: (SEL)selector { self = [super init]; @@ -91,12 +91,12 @@ return self; } # ifdef OF_HAVE_BLOCKS -- initWithSourceThread: (OFThread*)sourceThread - host: (OFString*)host +- initWithSourceThread: (OFThread *)sourceThread + host: (OFString *)host port: (uint16_t)port block: (of_udp_socket_async_resolve_block_t)block { self = [super init]; @@ -134,14 +134,14 @@ # ifdef OF_HAVE_BLOCKS if (_block != NULL) _block(_host, _port, _address, _exception); else { # endif - void (*func)(id, SEL, OFString*, uint16_t, - of_udp_socket_address_t, OFException*) = - (void(*)(id, SEL, OFString*, uint16_t, - of_udp_socket_address_t, OFException*))[_target + void (*func)(id, SEL, OFString *, uint16_t, + of_udp_socket_address_t, OFException *) = + (void (*)(id, SEL, OFString *, uint16_t, + of_udp_socket_address_t, OFException *))[_target methodForSelector: _selector]; func(_target, _selector, _host, _port, _address, _exception); # ifdef OF_HAVE_BLOCKS } @@ -192,12 +192,12 @@ #else if (address1->length < 8 || address2->length < 8) @throw [OFInvalidArgumentException exception]; #endif - sin_1 = (struct sockaddr_in*)&address1->address; - sin_2 = (struct sockaddr_in*)&address2->address; + sin_1 = (struct sockaddr_in *)&address1->address; + sin_2 = (struct sockaddr_in *)&address2->address; if (sin_1->sin_port != sin_2->sin_port) return false; if (sin_1->sin_addr.s_addr != sin_2->sin_addr.s_addr) return false; @@ -207,12 +207,12 @@ case AF_INET6: if (address1->length < sizeof(struct sockaddr_in6) || address2->length < sizeof(struct sockaddr_in6)) @throw [OFInvalidArgumentException exception]; - sin6_1 = (struct sockaddr_in6*)&address1->address; - sin6_2 = (struct sockaddr_in6*)&address2->address; + sin6_1 = (struct sockaddr_in6 *)&address1->address; + sin6_2 = (struct sockaddr_in6 *)&address2->address; if (sin6_1->sin6_port != sin6_2->sin6_port) return false; if (memcmp(sin6_1->sin6_addr.s6_addr, sin6_2->sin6_addr.s6_addr, @@ -248,11 +248,11 @@ #else if (address->length < 8) @throw [OFInvalidArgumentException exception]; #endif - sin = (struct sockaddr_in*)&address->address; + sin = (struct sockaddr_in *)&address->address; hash += (sin->sin_port << 1); hash ^= sin->sin_addr.s_addr; break; @@ -259,11 +259,11 @@ #ifdef HAVE_IPV6 case AF_INET6: if (address->length < sizeof(struct sockaddr_in6)) @throw [OFInvalidArgumentException exception]; - sin6 = (struct sockaddr_in6*)&address->address; + sin6 = (struct sockaddr_in6 *)&address->address; hash += (sin6->sin6_port << 1); OF_HASH_INIT(subhash); @@ -297,13 +297,13 @@ + (instancetype)socket { return [[[self alloc] init] autorelease]; } -+ (void)resolveAddressForHost: (OFString*)host ++ (void)resolveAddressForHost: (OFString *)host port: (uint16_t)port - address: (of_udp_socket_address_t*)address + address: (of_udp_socket_address_t *)address { of_resolver_result_t **results = of_resolve_host(host, port, SOCK_DGRAM); assert(results[0]->addressLength <= @@ -315,11 +315,11 @@ of_resolver_free(results); } #ifdef OF_HAVE_THREADS -+ (void)asyncResolveAddressForHost: (OFString*)host ++ (void)asyncResolveAddressForHost: (OFString *)host port: (uint16_t)port target: (id)target selector: (SEL)selector { void *pool = objc_autoreleasePoolPush(); @@ -333,11 +333,11 @@ objc_autoreleasePoolPop(pool); } # ifdef OF_HAVE_BLOCKS -+ (void)asyncResolveAddressForHost: (OFString*)host ++ (void)asyncResolveAddressForHost: (OFString *)host port: (uint16_t)port block: (of_udp_socket_async_resolve_block_t)block { void *pool = objc_autoreleasePoolPush(); @@ -350,16 +350,16 @@ objc_autoreleasePoolPop(pool); } # endif #endif -+ (void)getHost: (OFString *__autoreleasing*)host - andPort: (uint16_t*)port - forAddress: (of_udp_socket_address_t*)address ++ (void)getHost: (OFString *__autoreleasing *)host + andPort: (uint16_t *)port + forAddress: (of_udp_socket_address_t *)address { of_address_to_string_and_port( - (struct sockaddr*)&address->address, address->length, host, port); + (struct sockaddr *)&address->address, address->length, host, port); } - init { self = [super init]; @@ -380,11 +380,11 @@ - copy { return [self retain]; } -- (uint16_t)bindToHost: (OFString*)host +- (uint16_t)bindToHost: (OFString *)host port: (uint16_t)port { of_resolver_result_t **results; #if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) union { @@ -442,17 +442,17 @@ while (rnd < 1024) rnd = (uint16_t)rand(); switch (results[0]->family) { case AF_INET: - ((struct sockaddr_in*) + ((struct sockaddr_in *) results[0]->address)->sin_port = OF_BSWAP16_IF_LE(rnd); break; # ifdef HAVE_IPV6 case AF_INET6: - ((struct sockaddr_in6*) + ((struct sockaddr_in6 *) results[0]->address)->sin6_port = OF_BSWAP16_IF_LE(rnd); break; # endif default: @@ -490,11 +490,11 @@ if (port > 0) return port; #if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) addrLen = (socklen_t)sizeof(addr.storage); - if (of_getsockname(_socket, (struct sockaddr*)&addr.storage, + if (of_getsockname(_socket, (struct sockaddr *)&addr.storage, &addrLen) != 0) { int errNo = of_socket_errno(); close(_socket); _socket = INVALID_SOCKET; @@ -519,13 +519,13 @@ port: port socket: self errNo: EAFNOSUPPORT]; } -- (size_t)receiveIntoBuffer: (void*)buffer +- (size_t)receiveIntoBuffer: (void *)buffer length: (size_t)length - sender: (of_udp_socket_address_t*)sender + sender: (of_udp_socket_address_t *)sender { ssize_t ret; if (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; @@ -532,31 +532,31 @@ sender->length = (socklen_t)sizeof(sender->address); #ifndef OF_WINDOWS if ((ret = recvfrom(_socket, buffer, length, 0, - (struct sockaddr*)&sender->address, &sender->length)) < 0) + (struct sockaddr *)&sender->address, &sender->length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: of_socket_errno()]; #else if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((ret = recvfrom(_socket, buffer, (int)length, 0, - (struct sockaddr*)&sender->address, &sender->length)) < 0) + (struct sockaddr *)&sender->address, &sender->length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: of_socket_errno()]; #endif return ret; } -- (void)asyncReceiveIntoBuffer: (void*)buffer +- (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReceiveForUDPSocket: self @@ -565,11 +565,11 @@ target: target selector: selector]; } #ifdef OF_HAVE_BLOCKS -- (void)asyncReceiveIntoBuffer: (void*)buffer +- (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length block: (of_udp_socket_async_receive_block_t)block { [OFRunLoop OF_addAsyncReceiveForUDPSocket: self buffer: buffer @@ -576,23 +576,23 @@ length: length block: block]; } #endif -- (void)sendBuffer: (const void*)buffer +- (void)sendBuffer: (const void *)buffer length: (size_t)length - receiver: (const of_udp_socket_address_t*)receiver + receiver: (const of_udp_socket_address_t *)receiver { if (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; #ifndef OF_WINDOWS if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; if (sendto(_socket, buffer, length, 0, - (struct sockaddr*)&receiver->address, + (struct sockaddr *)&receiver->address, receiver->length) != (ssize_t)length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length errNo: of_socket_errno()]; @@ -599,11 +599,11 @@ #else if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if (sendto(_socket, buffer, (int)length, 0, - (struct sockaddr*)&receiver->address, + (struct sockaddr *)&receiver->address, receiver->length) != (int)length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length errNo: of_socket_errno()];