@@ -23,11 +23,11 @@ #import "OFOutOfRangeException.h" static OFString * stringFromBuffer(const unsigned char *buffer, size_t length, - of_string_encoding_t encoding) + OFStringEncoding encoding) { for (size_t i = 0; i < length; i++) if (buffer[i] == '\0') length = i; @@ -36,11 +36,11 @@ length: length]; } static void stringToBuffer(unsigned char *buffer, OFString *string, size_t length, - of_string_encoding_t encoding) + OFStringEncoding encoding) { size_t cStringLength = [string cStringLengthWithEncoding: encoding]; if (cStringLength > length) @throw [OFOutOfRangeException exception]; @@ -63,11 +63,11 @@ if (buffer[0] == 0x80) { for (size_t i = 1; i < length; i++) value = (value << 8) | buffer[i]; } else value = [stringFromBuffer(buffer, length, - OF_STRING_ENCODING_ASCII) unsignedLongLongValueWithBase: 8]; + OFStringEncodingASCII) unsignedLongLongValueWithBase: 8]; if (value > max) @throw [OFOutOfRangeException exception]; return value; @@ -83,11 +83,11 @@ { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithHeader: (unsigned char [512])header - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -288,33 +288,33 @@ return [ret autorelease]; } - (void)of_writeToStream: (OFStream *)stream - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { unsigned char buffer[512]; unsigned long long modificationDate; uint16_t checksum = 0; stringToBuffer(buffer, _fileName, 100, encoding); stringToBuffer(buffer + 100, [OFString stringWithFormat: @"%06" PRIo16 " ", _mode], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); stringToBuffer(buffer + 108, [OFString stringWithFormat: @"%06" PRIo16 " ", _UID], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); stringToBuffer(buffer + 116, [OFString stringWithFormat: @"%06" PRIo16 " ", _GID], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); stringToBuffer(buffer + 124, [OFString stringWithFormat: @"%011" PRIo64 " ", _size], 12, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); modificationDate = _modificationDate.timeIntervalSince1970; stringToBuffer(buffer + 136, [OFString stringWithFormat: @"%011llo", modificationDate], - 12, OF_STRING_ENCODING_ASCII); + 12, OFStringEncodingASCII); /* * During checksumming, the checksum field is expected to be set to 8 * spaces. */ @@ -327,21 +327,21 @@ memcpy(buffer + 257, "ustar\0" "00", 8); stringToBuffer(buffer + 265, _owner, 32, encoding); stringToBuffer(buffer + 297, _group, 32, encoding); stringToBuffer(buffer + 329, [OFString stringWithFormat: @"%06" PRIo32 " ", _deviceMajor], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); stringToBuffer(buffer + 337, [OFString stringWithFormat: @"%06" PRIo32 " ", _deviceMinor], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); memset(buffer + 345, '\0', 155 + 12); /* Fill in the checksum */ for (size_t i = 0; i < 500; i++) checksum += buffer[i]; stringToBuffer(buffer + 148, [OFString stringWithFormat: @"%06" PRIo16, checksum], 7, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); [stream writeBuffer: buffer length: sizeof(buffer)]; } @end