@@ -74,19 +74,19 @@ { @throw [OFNotImplementedException exceptionWithClass: isa selector: _cmd]; } -- (size_t)_readNBytes: (size_t)length - intoBuffer: (void*)buffer +- (size_t)_readIntoBuffer: (void*)buffer + length: (size_t)length { @throw [OFNotImplementedException exceptionWithClass: isa selector: _cmd]; } -- (void)_writeNBytes: (size_t)length - fromBuffer: (const void*)buffer +- (void)_writeBuffer: (const void*)buffer + length: (size_t)length { @throw [OFNotImplementedException exceptionWithClass: isa selector: _cmd]; } @@ -101,16 +101,16 @@ return NO; return [self _isAtEndOfStream]; } -- (size_t)readNBytes: (size_t)length - intoBuffer: (void*)buffer +- (size_t)readIntoBuffer: (void*)buffer + length: (size_t)length { if (cache == NULL) - return [self _readNBytes: length - intoBuffer: buffer]; + return [self _readIntoBuffer: buffer + length: length]; if (length >= cacheLength) { size_t ret = cacheLength; memcpy(buffer, cache, cacheLength); @@ -131,87 +131,87 @@ return length; } } -- (void)readExactlyNBytes: (size_t)length - intoBuffer: (void*)buffer +- (void)readIntoBuffer: (void*)buffer + exactLength: (size_t)length { size_t readLength = 0; while (readLength < length) - readLength += [self readNBytes: length - readLength - intoBuffer: (char*)buffer + readLength]; + readLength += [self readIntoBuffer: (char*)buffer + readLength + length: length - readLength]; } - (uint8_t)readInt8 { uint8_t ret; - [self readExactlyNBytes: 1 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 1]; return ret; } - (uint16_t)readBigEndianInt16 { uint16_t ret; - [self readExactlyNBytes: 2 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 2]; return of_bswap16_if_le(ret); } - (uint32_t)readBigEndianInt32 { uint32_t ret; - [self readExactlyNBytes: 4 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 4]; return of_bswap32_if_le(ret); } - (uint64_t)readBigEndianInt64 { uint64_t ret; - [self readExactlyNBytes: 8 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 8]; return of_bswap64_if_le(ret); } - (float)readBigEndianFloat { float ret; - [self readExactlyNBytes: 4 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 4]; return of_bswap_float_if_le(ret); } - (double)readBigEndianDouble { double ret; - [self readExactlyNBytes: 8 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 8]; return of_bswap_double_if_le(ret); } -- (size_t)readNBigEndianInt16s: (size_t)nInt16s - intoBuffer: (uint16_t*)buffer +- (size_t)readBigEndianInt16sIntoBuffer: (uint16_t*)buffer + count: (size_t)nInt16s { size_t size = nInt16s * sizeof(uint16_t); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifndef OF_BIG_ENDIAN size_t i; for (i = 0; i < nInt16s; i++) @@ -219,17 +219,17 @@ #endif return size; } -- (size_t)readNBigEndianInt32s: (size_t)nInt32s - intoBuffer: (uint32_t*)buffer +- (size_t)readBigEndianInt32sIntoBuffer: (uint32_t*)buffer + count: (size_t)nInt32s { size_t size = nInt32s * sizeof(uint32_t); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifndef OF_BIG_ENDIAN size_t i; for (i = 0; i < nInt32s; i++) @@ -237,17 +237,17 @@ #endif return size; } -- (size_t)readNBigEndianInt64s: (size_t)nInt64s - intoBuffer: (uint64_t*)buffer +- (size_t)readBigEndianInt64sIntoBuffer: (uint64_t*)buffer + count: (size_t)nInt64s { size_t size = nInt64s * sizeof(uint64_t); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifndef OF_BIG_ENDIAN size_t i; for (i = 0; i < nInt64s; i++) @@ -255,17 +255,17 @@ #endif return size; } -- (size_t)readNBigEndianFloats: (size_t)nFloats - intoBuffer: (float*)buffer +- (size_t)readBigEndianFloatsIntoBuffer: (float*)buffer + count: (size_t)nFloats { size_t size = nFloats * sizeof(float); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifndef OF_FLOAT_BIG_ENDIAN size_t i; for (i = 0; i < nFloats; i++) @@ -273,17 +273,17 @@ #endif return size; } -- (size_t)readNBigEndianDoubles: (size_t)nDoubles - intoBuffer: (double*)buffer +- (size_t)readBigEndianDoublesIntoBuffer: (double*)buffer + count: (size_t)nDoubles { size_t size = nDoubles * sizeof(double); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifndef OF_FLOAT_BIG_ENDIAN size_t i; for (i = 0; i < nDoubles; i++) @@ -295,63 +295,63 @@ - (uint16_t)readLittleEndianInt16 { uint16_t ret; - [self readExactlyNBytes: 2 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 2]; return of_bswap16_if_be(ret); } - (uint32_t)readLittleEndianInt32 { uint32_t ret; - [self readExactlyNBytes: 4 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 4]; return of_bswap32_if_be(ret); } - (uint64_t)readLittleEndianInt64 { uint64_t ret; - [self readExactlyNBytes: 8 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 8]; return of_bswap64_if_be(ret); } - (float)readLittleEndianFloat { float ret; - [self readExactlyNBytes: 4 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 4]; return of_bswap_float_if_be(ret); } - (double)readLittleEndianDouble { double ret; - [self readExactlyNBytes: 8 - intoBuffer: (char*)&ret]; + [self readIntoBuffer: (char*)&ret + exactLength: 8]; return of_bswap_double_if_be(ret); } -- (size_t)readNLittleEndianInt16s: (size_t)nInt16s - intoBuffer: (uint16_t*)buffer +- (size_t)readLittleEndianInt16sIntoBuffer: (uint16_t*)buffer + count: (size_t)nInt16s { size_t size = nInt16s * sizeof(uint16_t); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifdef OF_BIG_ENDIAN size_t i; for (i = 0; i < nInt16s; i++) @@ -359,17 +359,17 @@ #endif return size; } -- (size_t)readNLittleEndianInt32s: (size_t)nInt32s - intoBuffer: (uint32_t*)buffer +- (size_t)readLittleEndianInt32sIntoBuffer: (uint32_t*)buffer + count: (size_t)nInt32s { size_t size = nInt32s * sizeof(uint32_t); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifdef OF_BIG_ENDIAN size_t i; for (i = 0; i < nInt32s; i++) @@ -377,17 +377,17 @@ #endif return size; } -- (size_t)readNLittleEndianInt64s: (size_t)nInt64s - intoBuffer: (uint64_t*)buffer +- (size_t)readLittleEndianInt64sIntoBuffer: (uint64_t*)buffer + count: (size_t)nInt64s { size_t size = nInt64s * sizeof(uint64_t); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifdef OF_BIG_ENDIAN size_t i; for (i = 0; i < nInt64s; i++) @@ -395,17 +395,17 @@ #endif return size; } -- (size_t)readNLittleEndianFloats: (size_t)nFloats - intoBuffer: (float*)buffer +- (size_t)readLittleEndianFloatsIntoBuffer: (float*)buffer + count: (size_t)nFloats { size_t size = nFloats * sizeof(float); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifdef OF_FLOAT_BIG_ENDIAN size_t i; for (i = 0; i < nFloats; i++) @@ -413,17 +413,17 @@ #endif return size; } -- (size_t)readNLittleEndianDoubles: (size_t)nDoubles - intoBuffer: (double*)buffer +- (size_t)readLittleEndianDoublesIntoBuffer: (double*)buffer + count: (size_t)nDoubles { size_t size = nDoubles * sizeof(double); - [self readExactlyNBytes: size - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: size]; #ifdef OF_FLOAT_BIG_ENDIAN size_t i; for (i = 0; i < nDoubles; i++) @@ -431,29 +431,29 @@ #endif return size; } -- (OFDataArray*)readDataArrayWithNItems: (size_t)nItems +- (OFDataArray*)readDataArrayWithSize: (size_t)nItems { return [self readDataArrayWithItemSize: 1 - andNItems: nItems]; + count: nItems]; } - (OFDataArray*)readDataArrayWithItemSize: (size_t)itemSize - andNItems: (size_t)nItems + count: (size_t)nItems { OFDataArray *dataArray; char *tmp; dataArray = [OFDataArray dataArrayWithItemSize: itemSize]; tmp = [self allocMemoryWithItemSize: itemSize count: nItems]; @try { - [self readExactlyNBytes: nItems * itemSize - intoBuffer: tmp]; + [self readIntoBuffer: tmp + exactLength: nItems * itemSize]; [dataArray addItemsFromCArray: tmp count: nItems]; } @finally { [self freeMemory: tmp]; @@ -472,12 +472,12 @@ @try { while (![self isAtEndOfStream]) { size_t length; - length = [self readNBytes: of_pagesize - intoBuffer: buffer]; + length = [self readIntoBuffer: buffer + length: of_pagesize]; [dataArray addItemsFromCArray: buffer count: length]; } } @finally { [self freeMemory: buffer]; @@ -486,24 +486,24 @@ return dataArray; } - (OFString*)readStringWithLength: (size_t)length { - return [self readStringWithEncoding: OF_STRING_ENCODING_UTF_8 - length: length]; + return [self readStringWithLength: length + encoding: OF_STRING_ENCODING_UTF_8]; } -- (OFString*)readStringWithEncoding: (of_string_encoding_t)encoding - length: (size_t)length +- (OFString*)readStringWithLength: (size_t)length + encoding: (of_string_encoding_t)encoding { OFString *ret; char *buffer = [self allocMemoryWithSize: length + 1]; buffer[length] = 0; @try { - [self readExactlyNBytes: length - intoBuffer: buffer]; + [self readIntoBuffer: buffer + exactLength: length]; ret = [OFString stringWithCString: buffer encoding: encoding]; } @finally { [self freeMemory: buffer]; @@ -573,12 +573,12 @@ waitingForDelimiter = NO; return ret; } - bufferLength = [self _readNBytes: of_pagesize - intoBuffer: buffer]; + bufferLength = [self _readIntoBuffer: buffer + length: of_pagesize]; /* Look if there's a newline or \0 */ for (i = 0; i < bufferLength; i++) { if (OF_UNLIKELY(buffer[i] == '\n' || buffer[i] == '\0')) { @@ -678,11 +678,11 @@ { return [self tryReadLineWithEncoding: OF_STRING_ENCODING_UTF_8]; } - (OFString*)tryReadTillDelimiter: (OFString*)delimiter - withEncoding: (of_string_encoding_t)encoding + encoding: (of_string_encoding_t)encoding { const char *delimiterUTF8String; size_t i, j, delimiterLength, bufferLength, retLength; char *retCString, *buffer, *newCache; OFString *ret; @@ -747,12 +747,12 @@ waitingForDelimiter = NO; return ret; } - bufferLength = [self _readNBytes: of_pagesize - intoBuffer: buffer]; + bufferLength = [self _readIntoBuffer: buffer + length: of_pagesize]; /* Look if there's a delimiter or \0 */ for (i = 0; i < bufferLength; i++) { if (buffer[i] != delimiterUTF8String[j++]) j = 0; @@ -824,62 +824,62 @@ - (OFString*)readTillDelimiter: (OFString*)delimiter { return [self readTillDelimiter: delimiter - withEncoding: OF_STRING_ENCODING_UTF_8]; + encoding: OF_STRING_ENCODING_UTF_8]; } - (OFString*)readTillDelimiter: (OFString*)delimiter - withEncoding: (of_string_encoding_t)encoding + encoding: (of_string_encoding_t)encoding { OFString *ret = nil; while ((ret = [self tryReadTillDelimiter: delimiter - withEncoding: encoding]) == nil) + encoding: encoding]) == nil) if ([self isAtEndOfStream]) return nil; return ret; } - (OFString*)tryReadTillDelimiter: (OFString*)delimiter { return [self tryReadTillDelimiter: delimiter - withEncoding: OF_STRING_ENCODING_UTF_8]; + encoding: OF_STRING_ENCODING_UTF_8]; } -- (BOOL)buffersWrites +- (BOOL)writeBufferEnabled { - return buffersWrites; + return writeBufferEnabled; } -- (void)setBuffersWrites: (BOOL)enable +- (void)setWriteBufferEnabled: (BOOL)enable { - buffersWrites = enable; + writeBufferEnabled = enable; } - (void)flushWriteBuffer { if (writeBuffer == NULL) return; - [self _writeNBytes: writeBufferLength - fromBuffer: writeBuffer]; + [self _writeBuffer: writeBuffer + length: writeBufferLength]; [self freeMemory: writeBuffer]; writeBuffer = NULL; writeBufferLength = 0; } -- (void)writeNBytes: (size_t)length - fromBuffer: (const void*)buffer +- (void)writeBuffer: (const void*)buffer + length: (size_t)length { - if (!buffersWrites) - [self _writeNBytes: length - fromBuffer: buffer]; + if (!writeBufferEnabled) + [self _writeBuffer: buffer + length: length]; else { writeBuffer = [self resizeMemory: writeBuffer toSize: writeBufferLength + length]; memcpy(writeBuffer + writeBufferLength, buffer, length); writeBufferLength += length; @@ -886,62 +886,62 @@ } } - (void)writeInt8: (uint8_t)int8 { - [self writeNBytes: 1 - fromBuffer: (char*)&int8]; + [self writeBuffer: (char*)&int8 + length: 1]; } - (void)writeBigEndianInt16: (uint16_t)int16 { int16 = of_bswap16_if_le(int16); - [self writeNBytes: 2 - fromBuffer: (char*)&int16]; + [self writeBuffer: (char*)&int16 + length: 2]; } - (void)writeBigEndianInt32: (uint32_t)int32 { int32 = of_bswap32_if_le(int32); - [self writeNBytes: 4 - fromBuffer: (char*)&int32]; + [self writeBuffer: (char*)&int32 + length: 4]; } - (void)writeBigEndianInt64: (uint64_t)int64 { int64 = of_bswap64_if_le(int64); - [self writeNBytes: 8 - fromBuffer: (char*)&int64]; + [self writeBuffer: (char*)&int64 + length: 8]; } - (void)writeBigEndianFloat: (float)float_ { float_ = of_bswap_float_if_le(float_); - [self writeNBytes: 4 - fromBuffer: (char*)&float_]; + [self writeBuffer: (char*)&float_ + length: 4]; } - (void)writeBigEndianDouble: (double)double_ { double_ = of_bswap_double_if_le(double_); - [self writeNBytes: 8 - fromBuffer: (char*)&double_]; + [self writeBuffer: (char*)&double_ + length: 8]; } -- (size_t)writeNBigEndianInt16s: (size_t)nInt16s - fromBuffer: (const uint16_t*)buffer +- (size_t)writeBigEndianInt16s: (const uint16_t*)buffer + count: (size_t)nInt16s { size_t size = nInt16s * sizeof(uint16_t); #ifdef OF_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else uint16_t *tmp; tmp = [self allocMemoryWithItemSize: sizeof(uint16_t) count: nInt16s]; @@ -950,28 +950,28 @@ size_t i; for (i = 0; i < nInt16s; i++) tmp[i] = of_bswap16(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif return size; } -- (size_t)writeNBigEndianInt32s: (size_t)nInt32s - fromBuffer: (const uint32_t*)buffer +- (size_t)writeBigEndianInt32s: (const uint32_t*)buffer + count: (size_t)nInt32s { size_t size = nInt32s * sizeof(uint32_t); #ifdef OF_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else uint32_t *tmp; tmp = [self allocMemoryWithItemSize: sizeof(uint32_t) count: nInt32s]; @@ -980,28 +980,28 @@ size_t i; for (i = 0; i < nInt32s; i++) tmp[i] = of_bswap32(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif return size; } -- (size_t)writeNBigEndianInt64s: (size_t)nInt64s - fromBuffer: (const uint64_t*)buffer +- (size_t)writeBigEndianInt64s: (const uint64_t*)buffer + count: (size_t)nInt64s { size_t size = nInt64s * sizeof(uint64_t); #ifdef OF_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else uint64_t *tmp; tmp = [self allocMemoryWithItemSize: sizeof(uint64_t) count: nInt64s]; @@ -1010,28 +1010,28 @@ size_t i; for (i = 0; i < nInt64s; i++) tmp[i] = of_bswap64(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif return size; } -- (size_t)writeNBigEndianFloats: (size_t)nFloats - fromBuffer: (const float*)buffer +- (size_t)writeBigEndianFloats: (const float*)buffer + count: (size_t)nFloats { size_t size = nFloats * sizeof(float); #ifdef OF_FLOAT_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else float *tmp; tmp = [self allocMemoryWithItemSize: sizeof(float) count: nFloats]; @@ -1040,28 +1040,28 @@ size_t i; for (i = 0; i < nFloats; i++) tmp[i] = of_bswap_float(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif return size; } -- (size_t)writeNBigEndianDoubles: (size_t)nDoubles - fromBuffer: (const double*)buffer +- (size_t)writeBigEndianDoubles: (const double*)buffer + count: (size_t)nDoubles { size_t size = nDoubles * sizeof(double); #ifdef OF_FLOAT_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else double *tmp; tmp = [self allocMemoryWithItemSize: sizeof(double) count: nDoubles]; @@ -1070,12 +1070,12 @@ size_t i; for (i = 0; i < nDoubles; i++) tmp[i] = of_bswap_double(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif @@ -1084,54 +1084,54 @@ - (void)writeLittleEndianInt16: (uint16_t)int16 { int16 = of_bswap16_if_be(int16); - [self writeNBytes: 2 - fromBuffer: (char*)&int16]; + [self writeBuffer: (char*)&int16 + length: 2]; } - (void)writeLittleEndianInt32: (uint32_t)int32 { int32 = of_bswap32_if_be(int32); - [self writeNBytes: 4 - fromBuffer: (char*)&int32]; + [self writeBuffer: (char*)&int32 + length: 4]; } - (void)writeLittleEndianInt64: (uint64_t)int64 { int64 = of_bswap64_if_be(int64); - [self writeNBytes: 8 - fromBuffer: (char*)&int64]; + [self writeBuffer: (char*)&int64 + length: 8]; } - (void)writeLittleEndianFloat: (float)float_ { float_ = of_bswap_float_if_be(float_); - [self writeNBytes: 4 - fromBuffer: (char*)&float_]; + [self writeBuffer: (char*)&float_ + length: 4]; } - (void)writeLittleEndianDouble: (double)double_ { double_ = of_bswap_double_if_be(double_); - [self writeNBytes: 8 - fromBuffer: (char*)&double_]; + [self writeBuffer: (char*)&double_ + length: 8]; } -- (size_t)writeNLittleEndianInt16s: (size_t)nInt16s - fromBuffer: (const uint16_t*)buffer +- (size_t)writeLittleEndianInt16s: (const uint16_t*)buffer + count: (size_t)nInt16s { size_t size = nInt16s * sizeof(uint16_t); #ifndef OF_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else uint16_t *tmp; tmp = [self allocMemoryWithItemSize: sizeof(uint16_t) count: nInt16s]; @@ -1140,28 +1140,28 @@ size_t i; for (i = 0; i < nInt16s; i++) tmp[i] = of_bswap16(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif return size; } -- (size_t)writeNLittleEndianInt32s: (size_t)nInt32s - fromBuffer: (const uint32_t*)buffer +- (size_t)writeLittleEndianInt32s: (const uint32_t*)buffer + count: (size_t)nInt32s { size_t size = nInt32s * sizeof(uint32_t); #ifndef OF_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else uint32_t *tmp; tmp = [self allocMemoryWithItemSize: sizeof(uint32_t) count: nInt32s]; @@ -1170,28 +1170,28 @@ size_t i; for (i = 0; i < nInt32s; i++) tmp[i] = of_bswap32(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif return size; } -- (size_t)writeNLittleEndianInt64s: (size_t)nInt64s - fromBuffer: (const uint64_t*)buffer +- (size_t)writeLittleEndianInt64s: (const uint64_t*)buffer + count: (size_t)nInt64s { size_t size = nInt64s * sizeof(uint64_t); #ifndef OF_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else uint64_t *tmp; tmp = [self allocMemoryWithItemSize: sizeof(uint64_t) count: nInt64s]; @@ -1200,28 +1200,28 @@ size_t i; for (i = 0; i < nInt64s; i++) tmp[i] = of_bswap64(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif return size; } -- (size_t)writeNLittleEndianFloats: (size_t)nFloats - fromBuffer: (const float*)buffer +- (size_t)writeLittleEndianFloats: (const float*)buffer + count: (size_t)nFloats { size_t size = nFloats * sizeof(float); #ifndef OF_FLOAT_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else float *tmp; tmp = [self allocMemoryWithItemSize: sizeof(float) count: nFloats]; @@ -1230,28 +1230,28 @@ size_t i; for (i = 0; i < nFloats; i++) tmp[i] = of_bswap_float(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif return size; } -- (size_t)writeNLittleEndianDoubles: (size_t)nDoubles - fromBuffer: (const double*)buffer +- (size_t)writeLittleEndianDoubles: (const double*)buffer + count: (size_t)nDoubles { size_t size = nDoubles * sizeof(double); #ifndef OF_FLOAT_BIG_ENDIAN - [self writeNBytes: size - fromBuffer: buffer]; + [self writeBuffer: buffer + length: size]; #else double *tmp; tmp = [self allocMemoryWithItemSize: sizeof(double) count: nDoubles]; @@ -1260,12 +1260,12 @@ size_t i; for (i = 0; i < nDoubles; i++) tmp[i] = of_bswap_double(buffer[i]); - [self writeNBytes: size - fromBuffer: tmp]; + [self writeBuffer: tmp + length: size]; } @finally { [self freeMemory: tmp]; } #endif @@ -1274,22 +1274,22 @@ - (size_t)writeDataArray: (OFDataArray*)dataArray { size_t length = [dataArray count] * [dataArray itemSize]; - [self writeNBytes: length - fromBuffer: [dataArray cArray]]; + [self writeBuffer: [dataArray cArray] + length: length]; return [dataArray count] * [dataArray itemSize]; } - (size_t)writeString: (OFString*)string { size_t length = [string UTF8StringLength]; - [self writeNBytes: length - fromBuffer: [string UTF8String]]; + [self writeBuffer: [string UTF8String] + length: length]; return length; } - (size_t)writeLine: (OFString*)string @@ -1301,12 +1301,12 @@ @try { memcpy(buffer, [string UTF8String], stringLength); buffer[stringLength] = '\n'; - [self writeNBytes: stringLength + 1 - fromBuffer: buffer]; + [self writeBuffer: buffer + length: stringLength + 1]; } @finally { [self freeMemory: buffer]; } return stringLength + 1; @@ -1317,18 +1317,18 @@ va_list arguments; size_t ret; va_start(arguments, format); ret = [self writeFormat: format - withArguments: arguments]; + arguments: arguments]; va_end(arguments); return ret; } - (size_t)writeFormat: (OFConstantString*)format - withArguments: (va_list)arguments + arguments: (va_list)arguments { char *UTF8String; int length; if (format == nil) @@ -1338,12 +1338,12 @@ if ((length = of_vasprintf(&UTF8String, [format UTF8String], arguments)) == -1) @throw [OFInvalidFormatException exceptionWithClass: isa]; @try { - [self writeNBytes: length - fromBuffer: UTF8String]; + [self writeBuffer: UTF8String + length: length]; } @finally { free(UTF8String); } return length;