Index: src/OFDatagramSocket.h ================================================================== --- src/OFDatagramSocket.h +++ src/OFDatagramSocket.h @@ -30,35 +30,32 @@ #ifdef OF_HAVE_BLOCKS /*! * @brief A block which is called when a packet has been received. * - * @param socket The datagram socket which received a packet - * @param buffer The buffer the packet has been written to * @param length The length of the packet * @param sender The address of the sender of the packet * @param exception An exception which occurred while receiving or `nil` on * success * @return A bool whether the same block should be used for the next receive */ typedef bool (^of_datagram_socket_async_receive_block_t)( - OFDatagramSocket *_Nonnull socket, void *_Nonnull buffer, size_t length, - const of_socket_address_t *_Nonnull sender, id _Nullable exception); + size_t length, const of_socket_address_t *_Nonnull sender, + id _Nullable exception); /*! * @brief A block which is called when a packet has been sent. * - * @param socket The datagram socket which sent a packet * @param data The data which was sent * @param receiver The receiver for the packet * @param exception An exception which occurred while reading or `nil` on * success * @return The data to repeat the send with or nil if it should not repeat */ typedef OFData *_Nullable (^of_datagram_socket_async_send_data_block_t)( - OFDatagramSocket *_Nonnull socket, OFData *_Nonnull data, - const of_socket_address_t *_Nonnull receiver, id _Nullable exception); + OFData *_Nonnull data, const of_socket_address_t *_Nonnull receiver, + id _Nullable exception); #endif /*! * @protocol OFDatagramSocketDelegate OFDatagramSocket.h \ * ObjFW/OFDatagramSocket.h Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -440,11 +440,11 @@ exception = e; } # ifdef OF_HAVE_BLOCKS if (_block != NULL) - return _block(object, _buffer, length, exception); + return _block(length, exception); else { # endif if (![_delegate respondsToSelector: @selector(stream:didReadIntoBuffer:length:exception:)]) return false; @@ -488,11 +488,11 @@ exception == nil) return true; # ifdef OF_HAVE_BLOCKS if (_block != NULL) { - if (!_block(object, _buffer, _readLength, exception)) + if (!_block(_readLength, exception)) return false; _readLength = 0; return true; } else { @@ -540,11 +540,11 @@ if (line == nil && ![object isAtEndOfStream] && exception == nil) return true; # ifdef OF_HAVE_BLOCKS if (_block != NULL) - return _block(object, line, exception); + return _block(line, exception); else { # endif if (![_delegate respondsToSelector: @selector(stream:didReadLine:exception:)]) return false; @@ -590,11 +590,11 @@ if (_writtenLength != dataLength && exception == nil) return true; # ifdef OF_HAVE_BLOCKS if (_block != NULL) { - newData = _block(object, _data, _writtenLength, exception); + newData = _block(_data, _writtenLength, exception); if (newData == nil) return false; oldData = _data; @@ -662,12 +662,11 @@ if (_writtenLength != cStringLength && exception == nil) return true; # ifdef OF_HAVE_BLOCKS if (_block != NULL) { - newString = _block(object, _string, _encoding, _writtenLength, - exception); + newString = _block(_string, _writtenLength, exception); if (newString == nil) return false; oldString = _string; @@ -770,16 +769,16 @@ # ifdef OF_HAVE_BLOCKS if (_block != NULL) { if ([object isKindOfClass: [OFStreamSocket class]]) return ((of_stream_socket_async_accept_block_t) - _block)(object, acceptedSocket, exception); + _block)(acceptedSocket, exception); else if ([object isKindOfClass: [OFSequencedPacketSocket class]]) return ((of_sequenced_packet_socket_async_accept_block_t) - _block)(object, acceptedSocket, exception); + _block)(acceptedSocket, exception); else OF_ENSURE(0); } else { # endif if (![_delegate respondsToSelector: @@ -820,11 +819,11 @@ exception = e; } # ifdef OF_HAVE_BLOCKS if (_block != NULL) - return _block(object, _buffer, length, &address, exception); + return _block(length, &address, exception); else { # endif if (![_delegate respondsToSelector: @selector( socket:didReceiveIntoBuffer:length:sender:exception:)]) return false; @@ -863,11 +862,11 @@ exception = e; } # ifdef OF_HAVE_BLOCKS if (_block != NULL) { - newData = _block(object, _data, &_receiver, exception); + newData = _block(_data, &_receiver, exception); if (newData == nil) return false; oldData = _data; @@ -924,11 +923,11 @@ exception = e; } # ifdef OF_HAVE_BLOCKS if (_block != NULL) - return _block(object, _buffer, length, exception); + return _block(length, exception); else { # endif if (![_delegate respondsToSelector: @selector( socket:didReceiveIntoBuffer:length:exception:)]) return false; @@ -965,11 +964,11 @@ exception = e; } # ifdef OF_HAVE_BLOCKS if (_block != NULL) { - newData = _block(object, _data, exception); + newData = _block(_data, exception); if (newData == nil) return false; oldData = _data; Index: src/OFSequencedPacketSocket.h ================================================================== --- src/OFSequencedPacketSocket.h +++ src/OFSequencedPacketSocket.h @@ -30,47 +30,40 @@ #ifdef OF_HAVE_BLOCKS /*! * @brief A block which is called when a packet has been received. * - * @param socket The sequenced packet socket which received a packet - * @param buffer The buffer the packet has been written to * @param length The length of the packet * @param exception An exception which occurred while receiving or `nil` on * success * @return A bool whether the same block should be used for the next receive */ -typedef bool (^of_sequenced_packet_socket_async_receive_block_t)( - OFSequencedPacketSocket *_Nonnull socket, void *_Nonnull buffer, - size_t length, id _Nullable exception); +typedef bool (^of_sequenced_packet_socket_async_receive_block_t)(size_t length, + id _Nullable exception); /*! * @brief A block which is called when a packet has been sent. * - * @param socket The sequenced packet socket which sent a packet * @param data The data which was sent * @param exception An exception which occurred while reading or `nil` on * success * @return The data to repeat the send with or nil if it should not repeat */ typedef OFData *_Nullable (^of_sequenced_packet_socket_async_send_data_block_t)( - OFSequencedPacketSocket *_Nonnull socket, OFData *_Nonnull data, - id _Nullable exception); + OFData *_Nonnull data, id _Nullable exception); /*! * @brief A block which is called when the socket accepted a connection. * - * @param socket The socket which accepted the connection * @param acceptedSocket The socket which has been accepted * @param exception An exception which occurred while accepting the socket or * `nil` on success * @return A bool whether the same block should be used for the next incoming * connection */ typedef bool (^of_sequenced_packet_socket_async_accept_block_t)( - OFSequencedPacketSocket *socket, OFSequencedPacketSocket *acceptedSocket, - id _Nullable exception); + OFSequencedPacketSocket *acceptedSocket, id _Nullable exception); #endif /*! * @protocol OFSequencedPacketSocketDelegate OFSequencedPacketSocket.h \ * ObjFW/OFSequencedPacketSocket.h Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -41,33 +41,30 @@ #if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_BLOCKS) /*! * @brief A block which is called when data was read asynchronously from a * stream. * - * @param stream The stream on which data was read - * @param buffer A buffer with the data that has been read * @param length The length of the data that has been read * @param exception An exception which occurred while reading or `nil` on * success * @return A bool whether the same block should be used for the next read */ -typedef bool (^of_stream_async_read_block_t)(OFStream *_Nonnull stream, - void *_Nonnull buffer, size_t length, id _Nullable exception); +typedef bool (^of_stream_async_read_block_t)(size_t length, + id _Nullable exception); /*! * @brief A block which is called when a line was read asynchronously from a * stream. * - * @param stream The stream on which a line was read * @param line The line which has been read or `nil` when the end of stream * occurred * @param exception An exception which occurred while reading or `nil` on * success * @return A bool whether the same block should be used for the next read */ -typedef bool (^of_stream_async_read_line_block_t)(OFStream *_Nonnull stream, - OFString *_Nullable line, id _Nullable exception); +typedef bool (^of_stream_async_read_line_block_t)(OFString *_Nullable line, + id _Nullable exception); /*! * @brief A block which is called when data was written asynchronously to a * stream. * @@ -78,29 +75,26 @@ * @param exception An exception which occurred while writing or `nil` on * success * @return The data to repeat the write with or nil if it should not repeat */ typedef OFData *_Nullable (^of_stream_async_write_data_block_t)( - OFStream *_Nonnull stream, OFData *_Nonnull data, - size_t bytesWritten, id _Nullable exception); + OFData *_Nonnull data, size_t bytesWritten, id _Nullable exception); /*! * @brief A block which is called when a string was written asynchronously to a * stream. * * @param string The string which was written to the stream * @param bytesWritten The number of bytes which have been written. This * matches the length of the specified data on the * asynchronous write if no exception was encountered. - * @param encoding The encoding in which the string was written * @param exception An exception which occurred while writing or `nil` on * success * @return The string to repeat the write with or nil if it should not repeat */ typedef OFString *_Nullable (^of_stream_async_write_string_block_t)( - OFStream *_Nonnull stream, OFString *_Nonnull string, - of_string_encoding_t encoding, size_t bytesWritten, id _Nullable exception); + OFString *_Nonnull string, size_t bytesWritten, id _Nullable exception); #endif /*! * @protocol OFStreamDelegate OFStream.h ObjFW/OFStream.h * Index: src/OFStreamSocket.h ================================================================== --- src/OFStreamSocket.h +++ src/OFStreamSocket.h @@ -27,18 +27,17 @@ #ifdef OF_HAVE_BLOCKS /*! * @brief A block which is called when the socket accepted a connection. * - * @param socket The socket which accepted the connection * @param acceptedSocket The socket which has been accepted * @param exception An exception which occurred while accepting the socket or * `nil` on success * @return A bool whether the same block should be used for the next incoming * connection */ -typedef bool (^of_stream_socket_async_accept_block_t)(OFStreamSocket *socket, +typedef bool (^of_stream_socket_async_accept_block_t)( OFStreamSocket *acceptedSocket, id _Nullable exception); #endif /*! * @protocol OFStreamSocketDelegate OFStreamSocket.h ObjFW/OFStreamSocket.h Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -29,16 +29,14 @@ #ifdef OF_HAVE_BLOCKS /*! * @brief A block which is called when the socket connected. * - * @param socket The socket which connected * @param exception An exception which occurred while connecting the socket or * `nil` on success */ -typedef void (^of_tcp_socket_async_connect_block_t)(OFTCPSocket *socket, - id _Nullable exception); +typedef void (^of_tcp_socket_async_connect_block_t)(id _Nullable exception); #endif /*! * @protocol OFTCPSocketDelegate OFTCPSocket.h ObjFW/OFTCPSocket.h * Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -206,11 +206,11 @@ if (_exception == nil) _socket.blocking = true; #ifdef OF_HAVE_BLOCKS if (_block != NULL) - _block(_socket, _exception); + _block(_exception); else { #endif _socket.delegate = _delegate; if ([_delegate respondsToSelector: