Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -602,26 +602,27 @@ return isAtEndOfStream; } - (size_t)_readNBytes: (size_t)length - intoBuffer: (char*)buffer + intoBuffer: (void*)buffer { size_t ret; if (fileDescriptor == -1 || isAtEndOfStream) @throw [OFReadFailedException newWithClass: isa stream: self requestedLength: length]; + if ((ret = read(fileDescriptor, buffer, length)) == 0) isAtEndOfStream = YES; return ret; } - (size_t)_writeNBytes: (size_t)length - fromBuffer: (const char*)buffer + fromBuffer: (const void*)buffer { size_t ret; if (fileDescriptor == -1 || isAtEndOfStream || (ret = write(fileDescriptor, buffer, length)) < length) Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -57,11 +57,11 @@ * \param length The length of the data that should be read at most. * The buffer MUST be at least this big! * \return The number of bytes read */ - (size_t)readNBytes: (size_t)size - intoBuffer: (char*)buffer; + intoBuffer: (void*)buffer; /** * Reads exactly length bytes from the stream into a buffer. Unlike * readNBytes:intoBuffer:, this method does not return when less than the * specified length has been read - instead, it waits until it got exactly length @@ -73,11 +73,11 @@ * \param buffer The buffer into which the data is read * \param length The length of the data that should be read. * The buffer MUST be EXACTLY this big! */ - (void)readExactlyNBytes: (size_t)length - intoBuffer: (char*)buffer; + intoBuffer: (void*)buffer; /** * Reads a uint8_t from the stream. * * WARNING: Only call this when you know that enough data is available! @@ -280,11 +280,11 @@ * \param buffer The buffer from which the data is written to the stream * \param length The length of the data that should be written * \return The number of bytes written */ - (size_t)writeNBytes: (size_t)length - fromBuffer: (const char*)buffer; + fromBuffer: (const void*)buffer; /** * Writes a uint8_t into the stream. * * \param int8 A uint8_t Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -72,18 +72,18 @@ @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } - (size_t)_readNBytes: (size_t)length - intoBuffer: (char*)buffer + intoBuffer: (void*)buffer { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } - (size_t)_writeNBytes: (size_t)length - fromBuffer: (const char*)buffer + fromBuffer: (const void*)buffer { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } @@ -94,11 +94,11 @@ return [self _isAtEndOfStream]; } - (size_t)readNBytes: (size_t)length - intoBuffer: (char*)buffer + intoBuffer: (void*)buffer { if (cache == NULL) return [self _readNBytes: length intoBuffer: buffer]; @@ -124,17 +124,17 @@ return length; } } - (void)readExactlyNBytes: (size_t)length - intoBuffer: (char*)buffer + intoBuffer: (void*)buffer { size_t readLength = 0; while (readLength < length) readLength += [self readNBytes: length - readLength - intoBuffer: buffer + readLength]; + intoBuffer: (char*)buffer + readLength]; } - (uint8_t)readInt8 { uint8_t ret; @@ -624,11 +624,11 @@ writeBuffer = NULL; writeBufferLength = 0; } - (size_t)writeNBytes: (size_t)length - fromBuffer: (const char*)buffer + fromBuffer: (const void*)buffer { if (!buffersWrites) return [self _writeNBytes: length fromBuffer: buffer]; else { Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -64,11 +64,11 @@ { return isAtEndOfStream; } - (size_t)_readNBytes: (size_t)length - intoBuffer: (char*)buffer + intoBuffer: (void*)buffer { ssize_t ret; if (sock == INVALID_SOCKET) @throw [OFNotConnectedException newWithClass: isa @@ -99,11 +99,11 @@ return ret; } - (size_t)_writeNBytes: (size_t)length - fromBuffer: (const char*)buffer + fromBuffer: (const void*)buffer { ssize_t ret; if (sock == INVALID_SOCKET) @throw [OFNotConnectedException newWithClass: isa