Index: src/OFDeflateStream.m ================================================================== --- src/OFDeflateStream.m +++ src/OFDeflateStream.m @@ -296,11 +296,11 @@ size_t bytesWritten = 0; uint8_t *slidingWindow; uint_fast16_t slidingWindowIndex; if (_atEndOfStream) - @throw [OFReadFailedException exceptionWithStream: self + @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; start: switch (_state) { case BLOCK_HEADER: Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -865,11 +865,11 @@ { ssize_t ret; if (_fd == -1 || _atEndOfStream || (ret = read(_fd, buffer, length)) < 0) - @throw [OFReadFailedException exceptionWithStream: self + @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; if (ret == 0) _atEndOfStream = true; @@ -878,11 +878,11 @@ - (void)lowlevelWriteBuffer: (const void*)buffer length: (size_t)length { if (_fd == -1 || _atEndOfStream || write(_fd, buffer, length) < length) - @throw [OFWriteFailedException exceptionWithStream: self + @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; } - (off_t)lowlevelSeekToOffset: (off_t)offset whence: (int)whence Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -125,11 +125,11 @@ length: (size_t)length { if (_atEndOfStream) { OFReadFailedException *e; - e = [OFReadFailedException exceptionWithStream: self + e = [OFReadFailedException exceptionWithObject: self requestedLength: length]; e->_errNo = ENOTCONN; @throw e; } Index: src/OFProcess.m ================================================================== --- src/OFProcess.m +++ src/OFProcess.m @@ -404,11 +404,11 @@ _atEndOfStream = true; return 0; } #endif - @throw [OFReadFailedException exceptionWithStream: self + @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; } if (ret == 0) _atEndOfStream = true; @@ -427,11 +427,11 @@ if (_writePipe[1] == NULL || _atEndOfStream || !WriteFile(_writePipe[1], buffer, length, &ret, NULL) || ret < length) #endif - @throw [OFWriteFailedException exceptionWithStream: self + @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; } - (int)fileDescriptorForReading { Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -94,11 +94,11 @@ { ssize_t ret; if (_fd == -1 || _atEndOfStream || (ret = read(_fd, buffer, length)) < 0) - @throw [OFReadFailedException exceptionWithStream: self + @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; if (ret == 0) _atEndOfStream = true; @@ -107,11 +107,11 @@ - (void)lowlevelWriteBuffer: (const void*)buffer length: (size_t)length { if (_fd == -1 || _atEndOfStream || write(_fd, buffer, length) < length) - @throw [OFWriteFailedException exceptionWithStream: self + @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; } - (int)fileDescriptorForReading { Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -93,18 +93,18 @@ @throw [OFNotConnectedException exceptionWithSocket: self]; if (_atEndOfStream) { OFReadFailedException *e; - e = [OFReadFailedException exceptionWithStream: self + e = [OFReadFailedException exceptionWithObject: self requestedLength: length]; e->_errNo = ENOTCONN; @throw e; } if ((ret = recv(_socket, buffer, length, 0)) < 0) - @throw [OFReadFailedException exceptionWithStream: self + @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; if (ret == 0) _atEndOfStream = true; @@ -118,18 +118,18 @@ @throw [OFNotConnectedException exceptionWithSocket: self]; if (_atEndOfStream) { OFWriteFailedException *e; - e = [OFWriteFailedException exceptionWithStream: self + e = [OFWriteFailedException exceptionWithObject: self requestedLength: length]; e->_errNo = ENOTCONN; @throw e; } if (send(_socket, buffer, length, 0) < length) - @throw [OFWriteFailedException exceptionWithStream: self + @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; } #ifdef _WIN32 - (void)setBlocking: (bool)enable Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -544,11 +544,11 @@ length: (size_t)length { size_t min, ret; if (_atEndOfStream) - @throw [OFReadFailedException exceptionWithStream: self + @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; if (_hasDataDescriptor) { if ([_stream isAtEndOfStream]) { uint32_t CRC32; Index: src/exceptions/OFAddressTranslationFailedException.h ================================================================== --- src/exceptions/OFAddressTranslationFailedException.h +++ src/exceptions/OFAddressTranslationFailedException.h @@ -20,35 +20,33 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif -@class OFTCPSocket; - /*! * @brief An exception indicating the translation of an address failed. */ @interface OFAddressTranslationFailedException: OFException { - OFTCPSocket *_socket; - OFString *_host; - int _errNo; + id _socket; + OFString *_host; + int _errNo; } #ifdef OF_HAVE_PROPERTIES @property (readonly, copy) OFString *host; -@property (readonly, retain) OFTCPSocket *socket; +@property (readonly, retain) id socket; @property (readonly) int errNo; #endif /*! * @brief Creates a new, autoreleased address translation failed exception. * * @param socket The socket which could not translate the address * @return A new, autoreleased address translation failed exception */ -+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket; ++ (instancetype)exceptionWithSocket: (id)socket; /*! * @brief Creates a new, autoreleased address translation failed exception. * * @param host The host for which translation was requested @@ -62,19 +60,19 @@ * @param host The host for which translation was requested * @param socket The socket which could not translate the address * @return A new, autoreleased address translation failed exception */ + (instancetype)exceptionWithHost: (OFString*)host - socket: (OFTCPSocket*)socket; + socket: (id)socket; /*! * @brief Initializes an already allocated address translation failed exception. * * @param socket The socket which could not translate the address * @return An initialized address translation failed exception */ -- initWithSocket: (OFTCPSocket*)socket; +- initWithSocket: (id)socket; /*! * @brief Initializes an already allocated address translation failed exception. * * @param host The host for which translation was requested @@ -88,11 +86,11 @@ * @param host The host for which translation was requested * @param socket The socket which could not translate the address * @return An initialized address translation failed exception */ - initWithHost: (OFString*)host - socket: (OFTCPSocket*)socket; + socket: (id)socket; /*! * @brief Returns the host for which the address translation was requested. * * @return The host for which the address translation was requested @@ -102,14 +100,14 @@ /*! * @brief Returns the socket which could not translate the address. * * @return The socket which could not translate the address */ -- (OFTCPSocket*)socket; +- (id)socket; /*! * @brief Returns the errno from when the exception was created. * * @return The errno from when the exception was created */ - (int)errNo; @end Index: src/exceptions/OFAddressTranslationFailedException.m ================================================================== --- src/exceptions/OFAddressTranslationFailedException.m +++ src/exceptions/OFAddressTranslationFailedException.m @@ -16,17 +16,16 @@ #include "config.h" #import "OFAddressTranslationFailedException.h" #import "OFString.h" -#import "OFTCPSocket.h" #import "common.h" #import "macros.h" @implementation OFAddressTranslationFailedException -+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket ++ (instancetype)exceptionWithSocket: (id)socket { return [[[self alloc] initWithSocket: socket] autorelease]; } + (instancetype)exceptionWithHost: (OFString*)host @@ -33,11 +32,11 @@ { return [[[self alloc] initWithHost: host] autorelease]; } + (instancetype)exceptionWithHost: (OFString*)host - socket: (OFTCPSocket*)socket + socket: (id)socket { return [[[self alloc] initWithHost: host socket: socket] autorelease]; } @@ -44,11 +43,11 @@ - init { OF_INVALID_INIT_METHOD } -- initWithSocket: (OFTCPSocket*)socket +- initWithSocket: (id)socket { return [self initWithHost: nil socket: socket]; } @@ -57,11 +56,11 @@ return [self initWithHost: host socket: nil]; } - initWithHost: (OFString*)host - socket: (OFTCPSocket*)socket + socket: (id)socket { self = [super init]; @try { _host = [host copy]; @@ -114,11 +113,11 @@ - (OFString*)host { OF_GETTER(_host, true) } -- (OFTCPSocket*)socket +- (id)socket { OF_GETTER(_socket, true) } - (int)errNo Index: src/exceptions/OFBindFailedException.h ================================================================== --- src/exceptions/OFBindFailedException.h +++ src/exceptions/OFBindFailedException.h @@ -20,27 +20,25 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif -@class OFTCPSocket; - /*! * @brief An exception indicating that binding a socket failed. */ @interface OFBindFailedException: OFException { - OFTCPSocket *_socket; - OFString *_host; - uint16_t _port; - int _errNo; + id _socket; + OFString *_host; + uint16_t _port; + int _errNo; } #ifdef OF_HAVE_PROPERTIES @property (readonly, copy) OFString *host; @property (readonly) uint16_t port; -@property (readonly, retain) OFTCPSocket *socket; +@property (readonly, retain) id socket; @property (readonly) int errNo; #endif /*! * @brief Creates a new, autoreleased bind failed exception. @@ -50,11 +48,11 @@ * @param socket The socket which could not be bound * @return A new, autoreleased bind failed exception */ + (instancetype)exceptionWithHost: (OFString*)host port: (uint16_t)port - socket: (OFTCPSocket*)socket; + socket: (id)socket; /*! * @brief Initializes an already allocated bind failed exception. * * @param host The host on which binding failed @@ -62,11 +60,11 @@ * @param socket The socket which could not be bound * @return An initialized bind failed exception */ - initWithHost: (OFString*)host port: (uint16_t)port - socket: (OFTCPSocket*)socket; + socket: (id)socket; /*! * @brief Returns the host on which binding failed. * * @return The host on which binding failed @@ -83,14 +81,14 @@ /*! * @brief Returns the socket which could not be bound. * * @return The socket which could not be bound */ -- (OFTCPSocket*)socket; +- (id)socket; /*! * @brief Returns the errno from when the exception was created. * * @return The errno from when the exception was created */ - (int)errNo; @end Index: src/exceptions/OFBindFailedException.m ================================================================== --- src/exceptions/OFBindFailedException.m +++ src/exceptions/OFBindFailedException.m @@ -16,19 +16,18 @@ #include "config.h" #import "OFBindFailedException.h" #import "OFString.h" -#import "OFTCPSocket.h" #import "common.h" #import "macros.h" @implementation OFBindFailedException + (instancetype)exceptionWithHost: (OFString*)host port: (uint16_t)port - socket: (OFTCPSocket*)socket + socket: (id)socket { return [[[self alloc] initWithHost: host port: port socket: socket] autorelease]; } @@ -38,11 +37,11 @@ OF_INVALID_INIT_METHOD } - initWithHost: (OFString*)host port: (uint16_t)port - socket: (OFTCPSocket*)socket + socket: (id)socket { self = [super init]; @try { _host = [host copy]; @@ -80,11 +79,11 @@ - (uint16_t)port { return _port; } -- (OFTCPSocket*)socket +- (id)socket { OF_GETTER(_socket, true) } - (int)errNo Index: src/exceptions/OFListenFailedException.h ================================================================== --- src/exceptions/OFListenFailedException.h +++ src/exceptions/OFListenFailedException.h @@ -20,23 +20,21 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif -@class OFTCPSocket; - /*! * @brief An exception indicating that listening on the socket failed. */ @interface OFListenFailedException: OFException { - OFTCPSocket *_socket; + id _socket; int _backLog, _errNo; } #ifdef OF_HAVE_PROPERTIES -@property (readonly, retain) OFTCPSocket *socket; +@property (readonly, retain) id socket; @property (readonly) int backLog, errNo; #endif /*! * @brief Creates a new, autoreleased listen failed exception. @@ -43,29 +41,29 @@ * * @param socket The socket which failed to listen * @param backLog The requested size of the back log * @return A new, autoreleased listen failed exception */ -+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket ++ (instancetype)exceptionWithSocket: (id)socket backLog: (int)backLog; /*! * @brief Initializes an already allocated listen failed exception * * @param socket The socket which failed to listen * @param backLog The requested size of the back log * @return An initialized listen failed exception */ -- initWithSocket: (OFTCPSocket*)socket +- initWithSocket: (id)socket backLog: (int)backLog; /*! * @brief Returns the socket which failed to listen. * * @return The socket which failed to listen */ -- (OFTCPSocket*)socket; +- (id)socket; /*! * @brief Returns the requested back log. * * @return The requested back log Index: src/exceptions/OFListenFailedException.m ================================================================== --- src/exceptions/OFListenFailedException.m +++ src/exceptions/OFListenFailedException.m @@ -16,17 +16,16 @@ #include "config.h" #import "OFListenFailedException.h" #import "OFString.h" -#import "OFTCPSocket.h" #import "common.h" #import "macros.h" @implementation OFListenFailedException -+ (instancetype)exceptionWithSocket: (OFTCPSocket*)socket ++ (instancetype)exceptionWithSocket: (id)socket backLog: (int)backLog { return [[[self alloc] initWithSocket: socket backLog: backLog] autorelease]; } @@ -34,11 +33,11 @@ - init { OF_INVALID_INIT_METHOD } -- initWithSocket: (OFTCPSocket*)socket +- initWithSocket: (id)socket backLog: (int)backLog { self = [super init]; _socket = [socket retain]; @@ -60,11 +59,11 @@ return [OFString stringWithFormat: @"Failed to listen in socket of type %@ with a back log of %d! " ERRFMT, [_socket class], _backLog, ERRPARAM]; } -- (OFTCPSocket*)socket +- (id)socket { OF_GETTER(_socket, true) } - (int)backLog Index: src/exceptions/OFNotConnectedException.h ================================================================== --- src/exceptions/OFNotConnectedException.h +++ src/exceptions/OFNotConnectedException.h @@ -18,42 +18,40 @@ #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif -@class OFStreamSocket; - /*! * @brief An exception indicating a socket is not connected or bound. */ @interface OFNotConnectedException: OFException { - OFStreamSocket *_socket; + id _socket; } #ifdef OF_HAVE_PROPERTIES -@property (readonly, retain) OFStreamSocket *socket; +@property (readonly, retain) id socket; #endif /*! * @brief Creates a new, autoreleased not connected exception. * * @param socket The socket which is not connected * @return A new, autoreleased not connected exception */ -+ (instancetype)exceptionWithSocket: (OFStreamSocket*)socket; ++ (instancetype)exceptionWithSocket: (id)socket; /*! * @brief Initializes an already allocated not connected exception. * * @param socket The socket which is not connected * @return An initialized not connected exception */ -- initWithSocket: (OFStreamSocket*)socket; +- initWithSocket: (id)socket; /*! * @brief Returns the socket which is not connected. * * @return The socket which is not connected */ -- (OFStreamSocket*)socket; +- (id)socket; @end Index: src/exceptions/OFNotConnectedException.m ================================================================== --- src/exceptions/OFNotConnectedException.m +++ src/exceptions/OFNotConnectedException.m @@ -16,27 +16,26 @@ #include "config.h" #import "OFNotConnectedException.h" #import "OFString.h" -#import "OFTCPSocket.h" #import "common.h" #import "macros.h" @implementation OFNotConnectedException -+ (instancetype)exceptionWithSocket: (OFStreamSocket*)socket ++ (instancetype)exceptionWithSocket: (id)socket { return [[[self alloc] initWithSocket: socket] autorelease]; } - init { OF_INVALID_INIT_METHOD } -- initWithSocket: (OFStreamSocket*)socket +- initWithSocket: (id)socket { self = [super init]; _socket = [socket retain]; @@ -55,10 +54,10 @@ return [OFString stringWithFormat: @"The socket of type %@ is not connected or bound!", [_socket class]]; } -- (OFStreamSocket*)socket +- (id)socket { OF_GETTER(_socket, true) } @end Index: src/exceptions/OFReadFailedException.h ================================================================== --- src/exceptions/OFReadFailedException.h +++ src/exceptions/OFReadFailedException.h @@ -15,9 +15,9 @@ */ #import "OFReadOrWriteFailedException.h" /*! - * @brief An exception indicating a read on a stream failed. + * @brief An exception indicating that reading from an object failed. */ @interface OFReadFailedException: OFReadOrWriteFailedException @end Index: src/exceptions/OFReadFailedException.m ================================================================== --- src/exceptions/OFReadFailedException.m +++ src/exceptions/OFReadFailedException.m @@ -16,17 +16,16 @@ #include "config.h" #import "OFReadFailedException.h" #import "OFString.h" -#import "OFStream.h" #import "common.h" @implementation OFReadFailedException - (OFString*)description { return [OFString stringWithFormat: - @"Failed to read %zu bytes in a stream of type %@! " ERRFMT, - _requestedLength, [_stream class], ERRPARAM]; + @"Failed to read %zu bytes from an object of type %@! " ERRFMT, + _requestedLength, [_object class], ERRPARAM]; } @end Index: src/exceptions/OFReadOrWriteFailedException.h ================================================================== --- src/exceptions/OFReadOrWriteFailedException.h +++ src/exceptions/OFReadOrWriteFailedException.h @@ -16,57 +16,56 @@ #include #import "OFException.h" -@class OFStream; - /*! - * @brief An exception indicating a read or write to a stream failed. + * @brief An exception indicating that reading from or writing to an object + * failed. */ @interface OFReadOrWriteFailedException: OFException { - OFStream *_stream; - size_t _requestedLength; + id _object; + size_t _requestedLength; @public - int _errNo; + int _errNo; } #ifdef OF_HAVE_PROPERTIES -@property (readonly, retain) OFStream *stream; +@property (readonly, retain) id object; @property (readonly) size_t requestedLength; @property (readonly) int errNo; #endif /*! * @brief Creates a new, autoreleased read or write failed exception. * - * @param stream The stream which caused the read or write failed exception + * @param object The object from which reading or to which writing failed * @param requestedLength The requested length of the data that couldn't be * read / written * @return A new, autoreleased read or write failed exception */ -+ (instancetype)exceptionWithStream: (OFStream*)stream ++ (instancetype)exceptionWithObject: (id)object requestedLength: (size_t)requestedLength; /*! * @brief Initializes an already allocated read or write failed exception. * - * @param stream The stream which caused the read or write failed exception + * @param object The object from which reading or to which writing failed * @param requestedLength The requested length of the data that couldn't be * read / written * @return A new open file failed exception */ -- initWithStream: (OFStream*)stream +- initWithObject: (id)object requestedLength: (size_t)requestedLength; /*! - * @brief Returns the stream which caused the read or write failed exception. + * @brief Returns the object from which reading or to which writing failed * * @return The stream which caused the read or write failed exception */ -- (OFStream*)stream; +- (id)object; /*! * @brief Returns the requested length of the data that couldn't be read / * written. * Index: src/exceptions/OFReadOrWriteFailedException.m ================================================================== --- src/exceptions/OFReadOrWriteFailedException.m +++ src/exceptions/OFReadOrWriteFailedException.m @@ -16,41 +16,40 @@ #include "config.h" #import "OFReadOrWriteFailedException.h" #import "OFString.h" -#import "OFStream.h" #ifdef OF_HAVE_SOCKETS # import "OFStreamSocket.h" #endif #import "common.h" #import "macros.h" @implementation OFReadOrWriteFailedException -+ (instancetype)exceptionWithStream: (OFStream*)stream ++ (instancetype)exceptionWithObject: (id)object requestedLength: (size_t)requestedLength { - return [[[self alloc] initWithStream: stream + return [[[self alloc] initWithObject: object requestedLength: requestedLength] autorelease]; } - init { OF_INVALID_INIT_METHOD } -- initWithStream: (OFStream*)stream +- initWithObject: (id)object requestedLength: (size_t)requestedLength { self = [super init]; - _stream = [stream retain]; + _object = [object retain]; _requestedLength = requestedLength; #ifdef OF_HAVE_SOCKETS - if ([stream isKindOfClass: [OFStreamSocket class]]) + if ([object isKindOfClass: [OFStreamSocket class]]) _errNo = GET_SOCK_ERRNO; else #endif _errNo = GET_ERRNO; @@ -57,25 +56,25 @@ return self; } - (void)dealloc { - [_stream release]; + [_object release]; [super dealloc]; } - (OFString*)description { return [OFString stringWithFormat: - @"Failed to read or write %zu bytes in a stream of type " - @"%@! " ERRFMT, _requestedLength, [_stream class], ERRPARAM]; + @"Failed to read or write %zu bytes from / to an object of type " + @"%@! " ERRFMT, _requestedLength, [_object class], ERRPARAM]; } -- (OFStream*)stream +- (id)object { - OF_GETTER(_stream, true) + OF_GETTER(_object, true) } - (size_t)requestedLength { return _requestedLength; Index: src/exceptions/OFWriteFailedException.h ================================================================== --- src/exceptions/OFWriteFailedException.h +++ src/exceptions/OFWriteFailedException.h @@ -15,9 +15,9 @@ */ #import "OFReadOrWriteFailedException.h" /*! - * @brief An exception indicating a write to a stream failed. + * @brief An exception indicating that writing to an object failed. */ @interface OFWriteFailedException: OFReadOrWriteFailedException @end Index: src/exceptions/OFWriteFailedException.m ================================================================== --- src/exceptions/OFWriteFailedException.m +++ src/exceptions/OFWriteFailedException.m @@ -16,17 +16,16 @@ #include "config.h" #import "OFWriteFailedException.h" #import "OFString.h" -#import "OFStream.h" #import "common.h" @implementation OFWriteFailedException - (OFString*)description { return [OFString stringWithFormat: - @"Failed to write %zu bytes in a stream of type %@! " ERRFMT, - _requestedLength, [_stream class], ERRPARAM]; + @"Failed to write %zu bytes to an object of type %@! " ERRFMT, + _requestedLength, [_object class], ERRPARAM]; } @end