@@ -86,17 +86,17 @@ - (bool)lowlevelIsAtEndOfStream { OF_UNRECOGNIZED_SELECTOR } -- (size_t)lowlevelReadIntoBuffer: (void*)buffer +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { OF_UNRECOGNIZED_SELECTOR } -- (void)lowlevelWriteBuffer: (const void*)buffer +- (void)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { OF_UNRECOGNIZED_SELECTOR } @@ -111,11 +111,11 @@ return false; return [self lowlevelIsAtEndOfStream]; } -- (size_t)readIntoBuffer: (void*)buffer +- (size_t)readIntoBuffer: (void *)buffer length: (size_t)length { if (_readBufferLength == 0) { /* * For small sizes, it is cheaper to read more and cache the @@ -169,22 +169,22 @@ return length; } } -- (void)readIntoBuffer: (void*)buffer +- (void)readIntoBuffer: (void *)buffer exactLength: (size_t)length { size_t readLength = 0; while (readLength < length) - readLength += [self readIntoBuffer: (char*)buffer + readLength + readLength += [self readIntoBuffer: (char *)buffer + readLength length: length - readLength]; } #ifdef OF_HAVE_SOCKETS -- (void)asyncReadIntoBuffer: (void*)buffer +- (void)asyncReadIntoBuffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadForStream: self @@ -192,11 +192,11 @@ length: length target: target selector: selector]; } -- (void)asyncReadIntoBuffer: (void*)buffer +- (void)asyncReadIntoBuffer: (void *)buffer exactLength: (size_t)length target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadForStream: self @@ -205,21 +205,21 @@ target: target selector: selector]; } # ifdef OF_HAVE_BLOCKS -- (void)asyncReadIntoBuffer: (void*)buffer +- (void)asyncReadIntoBuffer: (void *)buffer length: (size_t)length block: (of_stream_async_read_block_t)block { [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer length: length block: block]; } -- (void)asyncReadIntoBuffer: (void*)buffer +- (void)asyncReadIntoBuffer: (void *)buffer exactLength: (size_t)length block: (of_stream_async_read_block_t)block { [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer @@ -231,67 +231,67 @@ - (uint8_t)readInt8 { uint8_t ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 1]; return ret; } - (uint16_t)readBigEndianInt16 { uint16_t ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 2]; return OF_BSWAP16_IF_LE(ret); } - (uint32_t)readBigEndianInt32 { uint32_t ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 4]; return OF_BSWAP32_IF_LE(ret); } - (uint64_t)readBigEndianInt64 { uint64_t ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 8]; return OF_BSWAP64_IF_LE(ret); } - (float)readBigEndianFloat { float ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 4]; return OF_BSWAP_FLOAT_IF_LE(ret); } - (double)readBigEndianDouble { double ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 8]; return OF_BSWAP_DOUBLE_IF_LE(ret); } -- (size_t)readBigEndianInt16sIntoBuffer: (uint16_t*)buffer +- (size_t)readBigEndianInt16sIntoBuffer: (uint16_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint16_t); [self readIntoBuffer: buffer @@ -303,11 +303,11 @@ #endif return size; } -- (size_t)readBigEndianInt32sIntoBuffer: (uint32_t*)buffer +- (size_t)readBigEndianInt32sIntoBuffer: (uint32_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint32_t); [self readIntoBuffer: buffer @@ -319,11 +319,11 @@ #endif return size; } -- (size_t)readBigEndianInt64sIntoBuffer: (uint64_t*)buffer +- (size_t)readBigEndianInt64sIntoBuffer: (uint64_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint64_t); [self readIntoBuffer: buffer @@ -335,11 +335,11 @@ #endif return size; } -- (size_t)readBigEndianFloatsIntoBuffer: (float*)buffer +- (size_t)readBigEndianFloatsIntoBuffer: (float *)buffer count: (size_t)count { size_t size = count * sizeof(float); [self readIntoBuffer: buffer @@ -351,11 +351,11 @@ #endif return size; } -- (size_t)readBigEndianDoublesIntoBuffer: (double*)buffer +- (size_t)readBigEndianDoublesIntoBuffer: (double *)buffer count: (size_t)count { size_t size = count * sizeof(double); [self readIntoBuffer: buffer @@ -371,57 +371,57 @@ - (uint16_t)readLittleEndianInt16 { uint16_t ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 2]; return OF_BSWAP16_IF_BE(ret); } - (uint32_t)readLittleEndianInt32 { uint32_t ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 4]; return OF_BSWAP32_IF_BE(ret); } - (uint64_t)readLittleEndianInt64 { uint64_t ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 8]; return OF_BSWAP64_IF_BE(ret); } - (float)readLittleEndianFloat { float ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 4]; return OF_BSWAP_FLOAT_IF_BE(ret); } - (double)readLittleEndianDouble { double ret; - [self readIntoBuffer: (char*)&ret + [self readIntoBuffer: (char *)&ret exactLength: 8]; return OF_BSWAP_DOUBLE_IF_BE(ret); } -- (size_t)readLittleEndianInt16sIntoBuffer: (uint16_t*)buffer +- (size_t)readLittleEndianInt16sIntoBuffer: (uint16_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint16_t); [self readIntoBuffer: buffer @@ -433,11 +433,11 @@ #endif return size; } -- (size_t)readLittleEndianInt32sIntoBuffer: (uint32_t*)buffer +- (size_t)readLittleEndianInt32sIntoBuffer: (uint32_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint32_t); [self readIntoBuffer: buffer @@ -449,11 +449,11 @@ #endif return size; } -- (size_t)readLittleEndianInt64sIntoBuffer: (uint64_t*)buffer +- (size_t)readLittleEndianInt64sIntoBuffer: (uint64_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint64_t); [self readIntoBuffer: buffer @@ -465,11 +465,11 @@ #endif return size; } -- (size_t)readLittleEndianFloatsIntoBuffer: (float*)buffer +- (size_t)readLittleEndianFloatsIntoBuffer: (float *)buffer count: (size_t)count { size_t size = count * sizeof(float); [self readIntoBuffer: buffer @@ -481,11 +481,11 @@ #endif return size; } -- (size_t)readLittleEndianDoublesIntoBuffer: (double*)buffer +- (size_t)readLittleEndianDoublesIntoBuffer: (double *)buffer count: (size_t)count { size_t size = count * sizeof(double); [self readIntoBuffer: buffer @@ -497,18 +497,18 @@ #endif return size; } -- (OFDataArray*)readDataArrayWithCount: (size_t)count +- (OFDataArray *)readDataArrayWithCount: (size_t)count { return [self readDataArrayWithItemSize: 1 count: count]; } -- (OFDataArray*)readDataArrayWithItemSize: (size_t)itemSize - count: (size_t)count +- (OFDataArray *)readDataArrayWithItemSize: (size_t)itemSize + count: (size_t)count { OFDataArray *dataArray; char *tmp; dataArray = [OFDataArray dataArrayWithItemSize: itemSize]; @@ -526,11 +526,11 @@ } return dataArray; } -- (OFDataArray*)readDataArrayTillEndOfStream +- (OFDataArray *)readDataArrayTillEndOfStream { OFDataArray *dataArray; size_t pageSize; char *buffer; @@ -552,18 +552,18 @@ } return dataArray; } -- (OFString*)readStringWithLength: (size_t)length +- (OFString *)readStringWithLength: (size_t)length { return [self readStringWithLength: length encoding: OF_STRING_ENCODING_UTF_8]; } -- (OFString*)readStringWithLength: (size_t)length - encoding: (of_string_encoding_t)encoding +- (OFString *)readStringWithLength: (size_t)length + encoding: (of_string_encoding_t)encoding { OFString *ret; char *buffer = [self allocMemoryWithSize: length + 1]; buffer[length] = 0; @@ -578,11 +578,11 @@ } return ret; } -- (OFString*)tryReadLineWithEncoding: (of_string_encoding_t)encoding +- (OFString *)tryReadLineWithEncoding: (of_string_encoding_t)encoding { size_t pageSize, bufferLength, retLength; char *retCString, *buffer, *readBuffer; OFString *ret; @@ -731,16 +731,16 @@ _waitingForDelimiter = true; return nil; } -- (OFString*)readLine +- (OFString *)readLine { return [self readLineWithEncoding: OF_STRING_ENCODING_UTF_8]; } -- (OFString*)readLineWithEncoding: (of_string_encoding_t)encoding +- (OFString *)readLineWithEncoding: (of_string_encoding_t)encoding { OFString *line = nil; while ((line = [self tryReadLineWithEncoding: encoding]) == nil) if ([self isAtEndOfStream]) @@ -783,17 +783,17 @@ block: block]; } # endif #endif -- (OFString*)tryReadLine +- (OFString *)tryReadLine { return [self tryReadLineWithEncoding: OF_STRING_ENCODING_UTF_8]; } -- (OFString*)tryReadTillDelimiter: (OFString*)delimiter - encoding: (of_string_encoding_t)encoding +- (OFString *)tryReadTillDelimiter: (OFString *)delimiter + encoding: (of_string_encoding_t)encoding { const char *delimiterCString; size_t j, delimiterLength, pageSize, bufferLength, retLength; char *retCString, *buffer, *readBuffer; OFString *ret; @@ -927,18 +927,18 @@ _waitingForDelimiter = true; return nil; } -- (OFString*)readTillDelimiter: (OFString*)delimiter +- (OFString *)readTillDelimiter: (OFString *)delimiter { return [self readTillDelimiter: delimiter encoding: OF_STRING_ENCODING_UTF_8]; } -- (OFString*)readTillDelimiter: (OFString*)delimiter - encoding: (of_string_encoding_t)encoding +- (OFString *)readTillDelimiter: (OFString *)delimiter + encoding: (of_string_encoding_t)encoding { OFString *ret = nil; while ((ret = [self tryReadTillDelimiter: delimiter @@ -947,11 +947,11 @@ return nil; return ret; } -- (OFString*)tryReadTillDelimiter: (OFString*)delimiter +- (OFString *)tryReadTillDelimiter: (OFString *)delimiter { return [self tryReadTillDelimiter: delimiter encoding: OF_STRING_ENCODING_UTF_8]; } @@ -976,11 +976,11 @@ [self freeMemory: _writeBuffer]; _writeBuffer = NULL; _writeBufferLength = 0; } -- (void)writeBuffer: (const void*)buffer +- (void)writeBuffer: (const void *)buffer length: (size_t)length { if (!_writeBuffered) [self lowlevelWriteBuffer: buffer length: length]; @@ -992,55 +992,55 @@ } } - (void)writeInt8: (uint8_t)int8 { - [self writeBuffer: (char*)&int8 + [self writeBuffer: (char *)&int8 length: 1]; } - (void)writeBigEndianInt16: (uint16_t)int16 { int16 = OF_BSWAP16_IF_LE(int16); - [self writeBuffer: (char*)&int16 + [self writeBuffer: (char *)&int16 length: 2]; } - (void)writeBigEndianInt32: (uint32_t)int32 { int32 = OF_BSWAP32_IF_LE(int32); - [self writeBuffer: (char*)&int32 + [self writeBuffer: (char *)&int32 length: 4]; } - (void)writeBigEndianInt64: (uint64_t)int64 { int64 = OF_BSWAP64_IF_LE(int64); - [self writeBuffer: (char*)&int64 + [self writeBuffer: (char *)&int64 length: 8]; } - (void)writeBigEndianFloat: (float)float_ { float_ = OF_BSWAP_FLOAT_IF_LE(float_); - [self writeBuffer: (char*)&float_ + [self writeBuffer: (char *)&float_ length: 4]; } - (void)writeBigEndianDouble: (double)double_ { double_ = OF_BSWAP_DOUBLE_IF_LE(double_); - [self writeBuffer: (char*)&double_ + [self writeBuffer: (char *)&double_ length: 8]; } -- (size_t)writeBigEndianInt16s: (const uint16_t*)buffer +- (size_t)writeBigEndianInt16s: (const uint16_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint16_t); #ifdef OF_BIG_ENDIAN @@ -1062,11 +1062,11 @@ #endif return size; } -- (size_t)writeBigEndianInt32s: (const uint32_t*)buffer +- (size_t)writeBigEndianInt32s: (const uint32_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint32_t); #ifdef OF_BIG_ENDIAN @@ -1088,11 +1088,11 @@ #endif return size; } -- (size_t)writeBigEndianInt64s: (const uint64_t*)buffer +- (size_t)writeBigEndianInt64s: (const uint64_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint64_t); #ifdef OF_BIG_ENDIAN @@ -1114,11 +1114,11 @@ #endif return size; } -- (size_t)writeBigEndianFloats: (const float*)buffer +- (size_t)writeBigEndianFloats: (const float *)buffer count: (size_t)count { size_t size = count * sizeof(float); #ifdef OF_FLOAT_BIG_ENDIAN @@ -1140,11 +1140,11 @@ #endif return size; } -- (size_t)writeBigEndianDoubles: (const double*)buffer +- (size_t)writeBigEndianDoubles: (const double *)buffer count: (size_t)count { size_t size = count * sizeof(double); #ifdef OF_FLOAT_BIG_ENDIAN @@ -1170,47 +1170,47 @@ - (void)writeLittleEndianInt16: (uint16_t)int16 { int16 = OF_BSWAP16_IF_BE(int16); - [self writeBuffer: (char*)&int16 + [self writeBuffer: (char *)&int16 length: 2]; } - (void)writeLittleEndianInt32: (uint32_t)int32 { int32 = OF_BSWAP32_IF_BE(int32); - [self writeBuffer: (char*)&int32 + [self writeBuffer: (char *)&int32 length: 4]; } - (void)writeLittleEndianInt64: (uint64_t)int64 { int64 = OF_BSWAP64_IF_BE(int64); - [self writeBuffer: (char*)&int64 + [self writeBuffer: (char *)&int64 length: 8]; } - (void)writeLittleEndianFloat: (float)float_ { float_ = OF_BSWAP_FLOAT_IF_BE(float_); - [self writeBuffer: (char*)&float_ + [self writeBuffer: (char *)&float_ length: 4]; } - (void)writeLittleEndianDouble: (double)double_ { double_ = OF_BSWAP_DOUBLE_IF_BE(double_); - [self writeBuffer: (char*)&double_ + [self writeBuffer: (char *)&double_ length: 8]; } -- (size_t)writeLittleEndianInt16s: (const uint16_t*)buffer +- (size_t)writeLittleEndianInt16s: (const uint16_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint16_t); #ifndef OF_BIG_ENDIAN @@ -1232,11 +1232,11 @@ #endif return size; } -- (size_t)writeLittleEndianInt32s: (const uint32_t*)buffer +- (size_t)writeLittleEndianInt32s: (const uint32_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint32_t); #ifndef OF_BIG_ENDIAN @@ -1258,11 +1258,11 @@ #endif return size; } -- (size_t)writeLittleEndianInt64s: (const uint64_t*)buffer +- (size_t)writeLittleEndianInt64s: (const uint64_t *)buffer count: (size_t)count { size_t size = count * sizeof(uint64_t); #ifndef OF_BIG_ENDIAN @@ -1284,11 +1284,11 @@ #endif return size; } -- (size_t)writeLittleEndianFloats: (const float*)buffer +- (size_t)writeLittleEndianFloats: (const float *)buffer count: (size_t)count { size_t size = count * sizeof(float); #ifndef OF_FLOAT_BIG_ENDIAN @@ -1310,11 +1310,11 @@ #endif return size; } -- (size_t)writeLittleEndianDoubles: (const double*)buffer +- (size_t)writeLittleEndianDoubles: (const double *)buffer count: (size_t)count { size_t size = count * sizeof(double); #ifndef OF_FLOAT_BIG_ENDIAN @@ -1336,27 +1336,27 @@ #endif return size; } -- (size_t)writeDataArray: (OFDataArray*)dataArray +- (size_t)writeDataArray: (OFDataArray *)dataArray { size_t length = [dataArray count] * [dataArray itemSize]; [self writeBuffer: [dataArray items] length: length]; return length; } -- (size_t)writeString: (OFString*)string +- (size_t)writeString: (OFString *)string { return [self writeString: string encoding: OF_STRING_ENCODING_UTF_8]; } -- (size_t)writeString: (OFString*)string +- (size_t)writeString: (OFString *)string encoding: (of_string_encoding_t)encoding { size_t length = [string cStringLengthWithEncoding: encoding]; [self writeBuffer: [string cStringWithEncoding: encoding] @@ -1363,17 +1363,17 @@ length: length]; return length; } -- (size_t)writeLine: (OFString*)string +- (size_t)writeLine: (OFString *)string { return [self writeLine: string encoding: OF_STRING_ENCODING_UTF_8]; } -- (size_t)writeLine: (OFString*)string +- (size_t)writeLine: (OFString *)string encoding: (of_string_encoding_t)encoding { size_t stringLength = [string cStringLengthWithEncoding: encoding]; char *buffer; @@ -1391,11 +1391,11 @@ } return stringLength + 1; } -- (size_t)writeFormat: (OFConstantString*)format, ... +- (size_t)writeFormat: (OFConstantString *)format, ... { va_list arguments; size_t ret; va_start(arguments, format); @@ -1404,11 +1404,11 @@ va_end(arguments); return ret; } -- (size_t)writeFormat: (OFConstantString*)format +- (size_t)writeFormat: (OFConstantString *)format arguments: (va_list)arguments { char *UTF8String; int length; @@ -1519,11 +1519,11 @@ { [OFRunLoop OF_cancelAsyncRequestsForObject: self]; } #endif -- (void)unreadFromBuffer: (const void*)buffer +- (void)unreadFromBuffer: (const void *)buffer length: (size_t)length { char *readBuffer; if (length > SIZE_MAX - _readBufferLength)