Overview
Comment: | OFLHAArchiveEntry: Merge date and modificationDate
The date is meant to be the modification date and the extension is |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
327e67021e3f10ec1b5f37bed88ddd42 |
User & Date: | js on 2022-08-25 19:56:25 |
Other Links: | manifest | tags |
Context
2022-08-27
| ||
20:23 | OFLHAArchiveEntry: Make (un)compressedSize ull check-in: 6f13f74134 user: js tags: trunk | |
2022-08-25
| ||
19:56 | OFLHAArchiveEntry: Merge date and modificationDate check-in: 327e67021e user: js tags: trunk | |
2022-08-24
| ||
20:51 | OF{LHA,Tar}ArchiveEntry+Private.h: Fix OF_DIRECT check-in: a777cef361 user: js tags: trunk | |
Changes
Modified src/OFLHAArchiveEntry.h from [c3c2e27dd4] to [667eea830b].
︙ | ︙ | |||
29 30 31 32 33 34 35 | * * @brief A class which represents an entry in an LHA archive. */ @interface OFLHAArchiveEntry: OFObject <OFCopying, OFMutableCopying> { OFString *_fileName, *_Nullable _directoryName, *_compressionMethod; uint32_t _compressedSize, _uncompressedSize; | | < | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | * * @brief A class which represents an entry in an LHA archive. */ @interface OFLHAArchiveEntry: OFObject <OFCopying, OFMutableCopying> { OFString *_fileName, *_Nullable _directoryName, *_compressionMethod; uint32_t _compressedSize, _uncompressedSize; 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; OFMutableArray OF_GENERIC(OFData *) *_extensions; OF_RESERVE_IVARS(OFLHAArchiveEntry, 4) } /** * @brief The file name of the entry. */ |
︙ | ︙ | |||
62 63 64 65 66 67 68 | /** * @brief The uncompressed size of the entry's file. */ @property (readonly, nonatomic) uint32_t uncompressedSize; /** | | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | /** * @brief The uncompressed size of the entry's file. */ @property (readonly, nonatomic) uint32_t uncompressedSize; /** * @brief The modification date of the file. */ @property (readonly, retain, nonatomic) OFDate *modificationDate; /** * @brief The LHA level of the file. */ @property (readonly, nonatomic) uint8_t headerLevel; /** |
︙ | ︙ | |||
112 113 114 115 116 117 118 | @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *owner; /** * @brief The group of the file. */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *group; | < < < < < < | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *owner; /** * @brief The group of the file. */ @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFString *group; /** * @brief The LHA extensions of the file. */ @property (readonly, copy, nonatomic) OFArray OF_GENERIC(OFData *) *extensions; - (instancetype)init OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END #import "OFMutableLHAArchiveEntry.h" |
Modified src/OFLHAArchiveEntry.m from [1ef68b0ae3] to [027838e133].
︙ | ︙ | |||
310 311 312 313 314 315 316 | - (instancetype)of_init { self = [super init]; @try { _compressionMethod = @"-lh0-"; | | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | - (instancetype)of_init { self = [super init]; @try { _compressionMethod = @"-lh0-"; _modificationDate = [[OFDate alloc] init]; } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ | |||
352 353 354 355 356 357 358 | switch (_headerLevel) { case 0: case 1:; void *pool = objc_autoreleasePoolPush(); uint8_t fileNameLength; OFString *tmp; | | | | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | switch (_headerLevel) { case 0: case 1:; void *pool = objc_autoreleasePoolPush(); uint8_t fileNameLength; OFString *tmp; _modificationDate = [parseMSDOSDate(date) retain]; fileNameLength = [stream readInt8]; tmp = [stream readStringWithLength: fileNameLength encoding: encoding]; tmp = [tmp stringByReplacingOccurrencesOfString: @"\\" withString: @"/"]; _fileName = [tmp copy]; _CRC16 = [stream readLittleEndianInt16]; if (_headerLevel == 1) { _operatingSystemIdentifier = [stream readInt8]; readExtensions(self, stream, encoding, false); } objc_autoreleasePoolPop(pool); break; case 2: _modificationDate = [[OFDate alloc] initWithTimeIntervalSince1970: date]; _CRC16 = [stream readLittleEndianInt16]; _operatingSystemIdentifier = [stream readInt8]; readExtensions(self, stream, encoding, true); |
︙ | ︙ | |||
406 407 408 409 410 411 412 | } - (void)dealloc { [_compressionMethod release]; [_fileName release]; [_directoryName release]; | | | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | } - (void)dealloc { [_compressionMethod release]; [_fileName release]; [_directoryName release]; [_modificationDate release]; [_fileComment release]; [_mode release]; [_UID release]; [_GID release]; [_owner release]; [_group release]; [_extensions release]; |
︙ | ︙ | |||
432 433 434 435 436 437 438 | OFLHAArchiveEntry *copy = [[OFMutableLHAArchiveEntry alloc] initWithFileName: _fileName]; @try { [copy->_compressionMethod release]; copy->_compressionMethod = nil; | | | | < | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | OFLHAArchiveEntry *copy = [[OFMutableLHAArchiveEntry alloc] initWithFileName: _fileName]; @try { [copy->_compressionMethod release]; copy->_compressionMethod = nil; [copy->_modificationDate release]; copy->_modificationDate = nil; copy->_directoryName = [_directoryName copy]; copy->_compressionMethod = [_compressionMethod copy]; copy->_compressedSize = _compressedSize; copy->_uncompressedSize = _uncompressedSize; 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->_extensions = [_extensions copy]; } @catch (id e) { [copy release]; @throw e; } return copy; |
︙ | ︙ | |||
482 483 484 485 486 487 488 | } - (uint32_t)uncompressedSize { return _uncompressedSize; } | | | | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | } - (uint32_t)uncompressedSize { return _uncompressedSize; } - (OFDate *)modificationDate { return _modificationDate; } - (uint8_t)headerLevel { return _headerLevel; } |
︙ | ︙ | |||
532 533 534 535 536 537 538 | } - (OFString *)group { return _group; } | < < < < < | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | } - (OFString *)group { return _group; } - (OFArray OF_GENERIC(OFData *) *)extensions { return _extensions; } - (void)of_writeToStream: (OFStream *)stream encoding: (OFStringEncoding)encoding |
︙ | ︙ | |||
577 578 579 580 581 582 583 | tmp32 = OFToLittleEndian32(_compressedSize); [data addItems: &tmp32 count: sizeof(tmp32)]; tmp32 = OFToLittleEndian32(_uncompressedSize); [data addItems: &tmp32 count: sizeof(tmp32)]; | | > | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | tmp32 = OFToLittleEndian32(_compressedSize); [data addItems: &tmp32 count: sizeof(tmp32)]; tmp32 = OFToLittleEndian32(_uncompressedSize); [data addItems: &tmp32 count: sizeof(tmp32)]; tmp32 = OFToLittleEndian32( (uint32_t)_modificationDate.timeIntervalSince1970); [data addItems: &tmp32 count: sizeof(tmp32)]; /* Reserved */ [data increaseCountBy: 1]; /* Header level */ [data addItem: "\x02"]; |
︙ | ︙ | |||
677 678 679 680 681 682 683 | tmp16 = OFToLittleEndian16((uint16_t)ownerLength + 3); [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x53"]; [data addItems: [_owner cStringWithEncoding: encoding] count: ownerLength]; } | < < < < < < < < < < | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | tmp16 = OFToLittleEndian16((uint16_t)ownerLength + 3); [data addItems: &tmp16 count: sizeof(tmp16)]; [data addItem: "\x53"]; [data addItems: [_owner cStringWithEncoding: encoding] count: ownerLength]; } for (OFData *extension in _extensions) { size_t extensionLength = extension.count; if (extension.itemSize != 1) @throw [OFInvalidArgumentException exception]; if (extensionLength > UINT16_MAX - 2) |
︙ | ︙ | |||
736 737 738 739 740 741 742 | withString: @"\n\t"]; OFString *ret = [OFString stringWithFormat: @"<%@:\n" @"\tFile name = %@\n" @"\tCompression method = %@\n" @"\tCompressed size = %" @PRIu32 "\n" @"\tUncompressed size = %" @PRIu32 "\n" | | < | | | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | withString: @"\n\t"]; OFString *ret = [OFString stringWithFormat: @"<%@:\n" @"\tFile name = %@\n" @"\tCompression method = %@\n" @"\tCompressed size = %" @PRIu32 "\n" @"\tUncompressed size = %" @PRIu32 "\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" @"\tExtensions: %@" @">", self.class, self.fileName, _compressionMethod, _compressedSize, _uncompressedSize, _modificationDate, _headerLevel, _CRC16, _operatingSystemIdentifier, _fileComment, mode, _UID, _GID, _owner, _group, extensions]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } @end |
Modified src/OFMutableLHAArchiveEntry.h from [7c0878ecfb] to [eae4b7cde4].
︙ | ︙ | |||
45 46 47 48 49 50 51 | /** * @brief The uncompressed size of the entry's file. */ @property (readwrite, nonatomic) uint32_t uncompressedSize; /** | | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | /** * @brief The uncompressed size of the entry's file. */ @property (readwrite, nonatomic) uint32_t uncompressedSize; /** * @brief The modification date of the file. */ @property (readwrite, retain, nonatomic) OFDate *modificationDate; /** * @brief The LHA level of the file. */ @property (readwrite, nonatomic) uint8_t headerLevel; /** |
︙ | ︙ | |||
95 96 97 98 99 100 101 | @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *owner; /** * @brief The group of the file. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *group; | < < < < < < | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *owner; /** * @brief The group of the file. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *group; /** * @brief The LHA extensions of the file. */ @property (readwrite, copy, nonatomic) OFArray OF_GENERIC(OFData *) *extensions; /** * @brief Creates a new OFMutableLHAArchiveEntry with the specified file name. |
︙ | ︙ |
Modified src/OFMutableLHAArchiveEntry.m from [c454bff778] to [c791dddd21].
︙ | ︙ | |||
21 22 23 24 25 26 27 | #import "OFArray.h" #import "OFData.h" #import "OFDate.h" #import "OFNumber.h" #import "OFString.h" @implementation OFMutableLHAArchiveEntry | | | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #import "OFArray.h" #import "OFData.h" #import "OFDate.h" #import "OFNumber.h" #import "OFString.h" @implementation OFMutableLHAArchiveEntry @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]; } - (instancetype)initWithFileName: (OFString *)fileName |
︙ | ︙ | |||
80 81 82 83 84 85 86 | } - (void)setUncompressedSize: (uint32_t)uncompressedSize { _uncompressedSize = uncompressedSize; } | | | | | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | } - (void)setUncompressedSize: (uint32_t)uncompressedSize { _uncompressedSize = uncompressedSize; } - (void)setModificationDate: (OFDate *)modificationDate { OFDate *old = _modificationDate; _modificationDate = [modificationDate retain]; [old release]; } - (void)setHeaderLevel: (uint8_t)headerLevel { _headerLevel = headerLevel; } |
︙ | ︙ | |||
144 145 146 147 148 149 150 | - (void)setGroup: (OFString *)group { OFString *old = _group; _group = [group copy]; [old release]; } | < < < < < < < | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | - (void)setGroup: (OFString *)group { OFString *old = _group; _group = [group copy]; [old release]; } - (void)setExtensions: (OFArray OF_GENERIC(OFData *) *)extensions { OFArray OF_GENERIC(OFData *) *old = _extensions; _extensions = [extensions copy]; [old release]; } - (void)makeImmutable { object_setClass(self, [OFLHAArchiveEntry class]); } @end |
Modified utils/ofarc/LHAArchive.m from [fb0bc51e00] to [5f83697ea8].
︙ | ︙ | |||
56 57 58 59 60 61 62 | ofItemAtPath: path]; #endif } static void setModificationDate(OFString *path, OFLHAArchiveEntry *entry) { | < | < < < < < < < < < < < < < | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | ofItemAtPath: path]; #endif } static void setModificationDate(OFString *path, OFLHAArchiveEntry *entry) { OFFileAttributes attributes = [OFDictionary dictionaryWithObject: entry.modificationDate forKey: OFFileModificationDate]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; } @implementation LHAArchive + (void)initialize |
︙ | ︙ | |||
130 131 132 133 134 135 136 | while ((entry = [_archive nextEntry]) != nil) { void *pool = objc_autoreleasePoolPush(); [OFStdOut writeLine: entry.fileName]; if (app->_outputLevel >= 1) { | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | while ((entry = [_archive nextEntry]) != nil) { void *pool = objc_autoreleasePoolPush(); [OFStdOut writeLine: entry.fileName]; if (app->_outputLevel >= 1) { 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]; OFString *CRC16 = [OFString stringWithFormat: @"%04" PRIX16, entry.CRC16]; |
︙ | ︙ | |||
171 172 173 174 175 176 177 | @"Compression method: %[method]", @"method", entry.compressionMethod)]; [OFStdOut writeString: @"\t"]; [OFStdOut writeLine: OF_LOCALIZED(@"list_crc16", @"CRC16: %[crc16]", @"crc16", CRC16)]; [OFStdOut writeString: @"\t"]; | | > | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | @"Compression method: %[method]", @"method", entry.compressionMethod)]; [OFStdOut writeString: @"\t"]; [OFStdOut writeLine: OF_LOCALIZED(@"list_crc16", @"CRC16: %[crc16]", @"crc16", CRC16)]; [OFStdOut writeString: @"\t"]; [OFStdOut writeLine: OF_LOCALIZED( @"list_modification_date", @"Modification date: %[date]", @"date", modificationDate)]; if (entry.mode != nil) { OFString *modeString = [OFString stringWithFormat: @"%ho", entry.mode.unsignedShortValue]; [OFStdOut writeString: @"\t"]; |
︙ | ︙ | |||
235 236 237 238 239 240 241 | [OFStdOut writeString: @"\t"]; [OFStdOut writeLine: OF_LOCALIZED( @"list_osid", @"Operating system identifier: " "%[osid]", @"osid", OSID)]; } | < < < < < < < < < < < | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | [OFStdOut writeString: @"\t"]; [OFStdOut writeLine: OF_LOCALIZED( @"list_osid", @"Operating system identifier: " "%[osid]", @"osid", OSID)]; } } if (app->_outputLevel >= 3) { OFString *extensions = indent(entry.extensions.description); [OFStdOut writeString: @"\t"]; |
︙ | ︙ | |||
467 468 469 470 471 472 473 | type = attributes.fileType; entry = [OFMutableLHAArchiveEntry entryWithFileName: fileName]; #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS entry.mode = [OFNumber numberWithUnsignedLong: attributes.filePOSIXPermissions]; #endif | | | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | type = attributes.fileType; entry = [OFMutableLHAArchiveEntry entryWithFileName: fileName]; #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS entry.mode = [OFNumber numberWithUnsignedLong: attributes.filePOSIXPermissions]; #endif entry.modificationDate = attributes.fileModificationDate; #ifdef OF_FILE_MANAGER_SUPPORTS_OWNER entry.UID = [OFNumber numberWithUnsignedLong: attributes.fileOwnerAccountID]; entry.GID = [OFNumber numberWithUnsignedLong: attributes.fileGroupOwnerAccountID]; entry.owner = attributes.fileOwnerAccountName; |
︙ | ︙ |
Modified utils/ofarc/lang/de.json from [d777ea4bdf] to [1249658b50].
︙ | ︙ | |||
103 104 105 106 107 108 109 | "Unkomprimierte Größe: ", [ {"size == 1": "1 Byte"}, {"": "%[size] Bytes"} ] ], "list_compression_method": "Kompressionsmethode: %[method]", | < | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | "Unkomprimierte Größe: ", [ {"size == 1": "1 Byte"}, {"": "%[size] Bytes"} ] ], "list_compression_method": "Kompressionsmethode: %[method]", "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]", "list_extra_field": "Extra-Feld: %[extra]", "list_comment": "Kommentar: %[comment]", |
︙ | ︙ |