@@ -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(); @@ -102,20 +102,20 @@ header + 116, 8, ULONG_MAX); _size = (unsigned long long)octalValueFromBuffer( header + 124, 12, ULLONG_MAX); _modificationDate = [[OFDate alloc] initWithTimeIntervalSince1970: - (of_time_interval_t)octalValueFromBuffer( + (OFTimeInterval)octalValueFromBuffer( header + 136, 12, ULLONG_MAX)]; _type = header[156]; targetFileName = stringFromBuffer(header + 157, 100, encoding); if (targetFileName.length > 0) _targetFileName = [targetFileName copy]; if (_type == '\0') - _type = OF_TAR_ARCHIVE_ENTRY_TYPE_FILE; + _type = OFTarArchiveEntryTypeFile; if (memcmp(header + 257, "ustar\0" "00", 8) == 0) { OFString *prefix; _owner = [stringFromBuffer(header + 265, 32, encoding) @@ -151,11 +151,11 @@ { self = [super init]; @try { _fileName = [fileName copy]; - _type = OF_TAR_ARCHIVE_ENTRY_TYPE_FILE; + _type = OFTarArchiveEntryTypeFile; _mode = 0644; } @catch (id e) { [self release]; @throw e; } @@ -230,11 +230,11 @@ - (OFDate *)modificationDate { return _modificationDate; } -- (of_tar_archive_entry_type_t)type +- (OFTarArchiveEntryType)type { return _type; } - (OFString *)targetFileName @@ -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,22 +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)]; + [stream writeBuffer: buffer length: sizeof(buffer)]; } @end