Index: src/OFLHAArchiveEntry.h ================================================================== --- src/OFLHAArchiveEntry.h +++ src/OFLHAArchiveEntry.h @@ -31,18 +31,17 @@ */ @interface OFLHAArchiveEntry: OFObject { OFString *_fileName, *_Nullable _directoryName, *_compressionMethod; uint32_t _compressedSize, _uncompressedSize; - OFDate *_date; + OFDate *_modificationDate; uint8_t _headerLevel; uint16_t _CRC16; uint8_t _operatingSystemIdentifier; OFString *_Nullable _fileComment; OFNumber *_Nullable _mode, *_Nullable _UID, *_Nullable _GID; OFString *_Nullable _owner, *_Nullable _group; - OFDate *_Nullable _modificationDate; OFMutableArray OF_GENERIC(OFData *) *_extensions; OF_RESERVE_IVARS(OFLHAArchiveEntry, 4) } /** @@ -64,13 +63,13 @@ * @brief The uncompressed size of the entry's file. */ @property (readonly, nonatomic) uint32_t uncompressedSize; /** - * @brief The date of the file. + * @brief The modification date of the file. */ -@property (readonly, retain, nonatomic) OFDate *date; +@property (readonly, retain, nonatomic) OFDate *modificationDate; /** * @brief The LHA level of the file. */ @property (readonly, nonatomic) uint8_t headerLevel; @@ -114,16 +113,10 @@ /** * @brief The group of the file. */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *group; -/** - * @brief The date of the last modification of the file. - */ -@property OF_NULLABLE_PROPERTY (readonly, retain, nonatomic) - OFDate *modificationDate; - /** * @brief The LHA extensions of the file. */ @property (readonly, copy, nonatomic) OFArray OF_GENERIC(OFData *) *extensions; Index: src/OFLHAArchiveEntry.m ================================================================== --- src/OFLHAArchiveEntry.m +++ src/OFLHAArchiveEntry.m @@ -312,11 +312,11 @@ { self = [super init]; @try { _compressionMethod = @"-lh0-"; - _date = [[OFDate alloc] initWithTimeIntervalSince1970: 0]; + _modificationDate = [[OFDate alloc] init]; } @catch (id e) { [self release]; @throw e; } @@ -354,11 +354,11 @@ case 1:; void *pool = objc_autoreleasePoolPush(); uint8_t fileNameLength; OFString *tmp; - _date = [parseMSDOSDate(date) retain]; + _modificationDate = [parseMSDOSDate(date) retain]; fileNameLength = [stream readInt8]; tmp = [stream readStringWithLength: fileNameLength encoding: encoding]; tmp = [tmp stringByReplacingOccurrencesOfString: @"\\" @@ -374,11 +374,11 @@ } objc_autoreleasePoolPop(pool); break; case 2: - _date = [[OFDate alloc] + _modificationDate = [[OFDate alloc] initWithTimeIntervalSince1970: date]; _CRC16 = [stream readLittleEndianInt16]; _operatingSystemIdentifier = [stream readInt8]; @@ -408,11 +408,11 @@ - (void)dealloc { [_compressionMethod release]; [_fileName release]; [_directoryName release]; - [_date release]; + [_modificationDate release]; [_fileComment release]; [_mode release]; [_UID release]; [_GID release]; [_owner release]; @@ -434,28 +434,27 @@ @try { [copy->_compressionMethod release]; copy->_compressionMethod = nil; - [copy->_date release]; - copy->_date = nil; + [copy->_modificationDate release]; + copy->_modificationDate = nil; copy->_directoryName = [_directoryName copy]; copy->_compressionMethod = [_compressionMethod copy]; copy->_compressedSize = _compressedSize; copy->_uncompressedSize = _uncompressedSize; - copy->_date = [_date copy]; + copy->_modificationDate = [_modificationDate copy]; copy->_headerLevel = _headerLevel; copy->_CRC16 = _CRC16; copy->_operatingSystemIdentifier = _operatingSystemIdentifier; copy->_fileComment = [_fileComment copy]; copy->_mode = [_mode retain]; copy->_UID = [_UID retain]; copy->_GID = [_GID retain]; copy->_owner = [_owner copy]; copy->_group = [_group copy]; - copy->_modificationDate = [_modificationDate retain]; copy->_extensions = [_extensions copy]; } @catch (id e) { [copy release]; @throw e; } @@ -484,13 +483,13 @@ - (uint32_t)uncompressedSize { return _uncompressedSize; } -- (OFDate *)date +- (OFDate *)modificationDate { - return _date; + return _modificationDate; } - (uint8_t)headerLevel { return _headerLevel; @@ -534,15 +533,10 @@ - (OFString *)group { return _group; } -- (OFDate *)modificationDate -{ - return _modificationDate; -} - - (OFArray OF_GENERIC(OFData *) *)extensions { return _extensions; } @@ -579,11 +573,12 @@ [data addItems: &tmp32 count: sizeof(tmp32)]; tmp32 = OFToLittleEndian32(_uncompressedSize); [data addItems: &tmp32 count: sizeof(tmp32)]; - tmp32 = OFToLittleEndian32((uint32_t)_date.timeIntervalSince1970); + tmp32 = OFToLittleEndian32( + (uint32_t)_modificationDate.timeIntervalSince1970); [data addItems: &tmp32 count: sizeof(tmp32)]; /* Reserved */ [data increaseCountBy: 1]; @@ -679,20 +674,10 @@ [data addItem: "\x53"]; [data addItems: [_owner cStringWithEncoding: encoding] count: ownerLength]; } - if (_modificationDate != nil) { - tmp16 = OFToLittleEndian16(7); - [data addItems: &tmp16 count: sizeof(tmp16)]; - [data addItem: "\x54"]; - - tmp32 = OFToLittleEndian32( - (uint32_t)_modificationDate.timeIntervalSince1970); - [data addItems: &tmp32 count: sizeof(tmp32)]; - } - for (OFData *extension in _extensions) { size_t extensionLength = extension.count; if (extension.itemSize != 1) @throw [OFInvalidArgumentException exception]; @@ -738,30 +723,29 @@ @"<%@:\n" @"\tFile name = %@\n" @"\tCompression method = %@\n" @"\tCompressed size = %" @PRIu32 "\n" @"\tUncompressed size = %" @PRIu32 "\n" - @"\tDate = %@\n" + @"\tModification date = %@\n" @"\tHeader level = %u\n" @"\tCRC16 = %04" @PRIX16 @"\n" @"\tOperating system identifier = %c\n" @"\tComment = %@\n" @"\tMode = %@\n" @"\tUID = %@\n" @"\tGID = %@\n" @"\tOwner = %@\n" @"\tGroup = %@\n" - @"\tModification date = %@\n" @"\tExtensions: %@" @">", self.class, self.fileName, _compressionMethod, _compressedSize, - _uncompressedSize, _date, _headerLevel, _CRC16, + _uncompressedSize, _modificationDate, _headerLevel, _CRC16, _operatingSystemIdentifier, _fileComment, mode, _UID, _GID, _owner, - _group, _modificationDate, extensions]; + _group, extensions]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } @end Index: src/OFMutableLHAArchiveEntry.h ================================================================== --- src/OFMutableLHAArchiveEntry.h +++ src/OFMutableLHAArchiveEntry.h @@ -47,13 +47,13 @@ * @brief The uncompressed size of the entry's file. */ @property (readwrite, nonatomic) uint32_t uncompressedSize; /** - * @brief The date of the file. + * @brief The modification date of the file. */ -@property (readwrite, retain, nonatomic) OFDate *date; +@property (readwrite, retain, nonatomic) OFDate *modificationDate; /** * @brief The LHA level of the file. */ @property (readwrite, nonatomic) uint8_t headerLevel; @@ -97,16 +97,10 @@ /** * @brief The group of the file. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *group; -/** - * @brief The date of the last modification of the file. - */ -@property OF_NULLABLE_PROPERTY (readwrite, retain, nonatomic) - OFDate *modificationDate; - /** * @brief The LHA extensions of the file. */ @property (readwrite, copy, nonatomic) OFArray OF_GENERIC(OFData *) *extensions; Index: src/OFMutableLHAArchiveEntry.m ================================================================== --- src/OFMutableLHAArchiveEntry.m +++ src/OFMutableLHAArchiveEntry.m @@ -23,13 +23,13 @@ #import "OFDate.h" #import "OFNumber.h" #import "OFString.h" @implementation OFMutableLHAArchiveEntry -@dynamic fileName, compressionMethod, compressedSize, uncompressedSize, date; -@dynamic headerLevel, CRC16, operatingSystemIdentifier, fileComment, mode, UID; -@dynamic GID, owner, group, modificationDate, extensions; +@dynamic fileName, compressionMethod, compressedSize, uncompressedSize; +@dynamic modificationDate, headerLevel, CRC16, operatingSystemIdentifier; +@dynamic fileComment, mode, UID, GID, owner, group, extensions; + (instancetype)entryWithFileName: (OFString *)fileName { return [[[self alloc] initWithFileName: fileName] autorelease]; } @@ -82,14 +82,14 @@ - (void)setUncompressedSize: (uint32_t)uncompressedSize { _uncompressedSize = uncompressedSize; } -- (void)setDate: (OFDate *)date +- (void)setModificationDate: (OFDate *)modificationDate { - OFDate *old = _date; - _date = [date retain]; + OFDate *old = _modificationDate; + _modificationDate = [modificationDate retain]; [old release]; } - (void)setHeaderLevel: (uint8_t)headerLevel { @@ -146,17 +146,10 @@ OFString *old = _group; _group = [group copy]; [old release]; } -- (void)setModificationDate: (OFDate *)modificationDate -{ - OFDate *old = _modificationDate; - _modificationDate = [modificationDate retain]; - [old release]; -} - - (void)setExtensions: (OFArray OF_GENERIC(OFData *) *)extensions { OFArray OF_GENERIC(OFData *) *old = _extensions; _extensions = [extensions copy]; [old release]; Index: utils/ofarc/LHAArchive.m ================================================================== --- utils/ofarc/LHAArchive.m +++ utils/ofarc/LHAArchive.m @@ -58,26 +58,12 @@ } static void setModificationDate(OFString *path, OFLHAArchiveEntry *entry) { - OFDate *modificationDate = entry.modificationDate; - OFFileAttributes attributes; - - if (modificationDate == nil) { - /* - * Fall back to the original date if we have no modification - * date, as the modification date is a UNIX extension. - */ - modificationDate = entry.date; - - if (modificationDate == nil) - return; - } - - attributes = [OFDictionary - dictionaryWithObject: modificationDate + OFFileAttributes attributes = [OFDictionary + dictionaryWithObject: entry.modificationDate forKey: OFFileModificationDate]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; } @@ -132,11 +118,11 @@ void *pool = objc_autoreleasePoolPush(); [OFStdOut writeLine: entry.fileName]; if (app->_outputLevel >= 1) { - OFString *date = [entry.date + OFString *modificationDate = [entry.modificationDate localDateStringWithFormat: @"%Y-%m-%d %H:%M:%S"]; OFString *compressedSize = [OFString stringWithFormat: @"%" PRIu32, entry.compressedSize]; OFString *uncompressedSize = [OFString stringWithFormat: @"%" PRIu32, entry.uncompressedSize]; @@ -173,13 +159,14 @@ [OFStdOut writeString: @"\t"]; [OFStdOut writeLine: OF_LOCALIZED(@"list_crc16", @"CRC16: %[crc16]", @"crc16", CRC16)]; [OFStdOut writeString: @"\t"]; - [OFStdOut writeLine: OF_LOCALIZED(@"list_date", - @"Date: %[date]", - @"date", date)]; + [OFStdOut writeLine: OF_LOCALIZED( + @"list_modification_date", + @"Modification date: %[date]", + @"date", modificationDate)]; if (entry.mode != nil) { OFString *modeString = [OFString stringWithFormat: @"%ho", entry.mode.unsignedShortValue]; @@ -237,21 +224,10 @@ @"list_osid", @"Operating system identifier: " "%[osid]", @"osid", OSID)]; } - - if (entry.modificationDate != nil) { - OFString *modificationDate = - entry.modificationDate.description; - - [OFStdOut writeString: @"\t"]; - [OFStdOut writeLine: OF_LOCALIZED( - @"list_modification_date", - @"Modification date: %[date]", - @"date", modificationDate)]; - } } if (app->_outputLevel >= 3) { OFString *extensions = indent(entry.extensions.description); @@ -469,11 +445,11 @@ #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS entry.mode = [OFNumber numberWithUnsignedLong: attributes.filePOSIXPermissions]; #endif - entry.date = attributes.fileModificationDate; + entry.modificationDate = attributes.fileModificationDate; #ifdef OF_FILE_MANAGER_SUPPORTS_OWNER entry.UID = [OFNumber numberWithUnsignedLong: attributes.fileOwnerAccountID]; entry.GID = [OFNumber numberWithUnsignedLong: Index: utils/ofarc/lang/de.json ================================================================== --- utils/ofarc/lang/de.json +++ utils/ofarc/lang/de.json @@ -105,11 +105,10 @@ {"size == 1": "1 Byte"}, {"": "%[size] Bytes"} ] ], "list_compression_method": "Kompressionsmethode: %[method]", - "list_date": "Datum: %[date]", "list_osid": "Betriebssystem-Identifikator: %[osid]", "list_extensions": "Erweiterungen: %[extensions]", "list_version_made_by": "Erstellt mit Version: %[version]", "list_min_version_needed": "Mindestens benötigte Version: %[version]", "list_general_purpose_bit_flag": "General Purpose Bit Flag: %[gpbf]",