Differences From Artifact [027838e133]:
- File
src/OFLHAArchiveEntry.m
— part of check-in
[327e67021e]
at
2022-08-25 19:56:25
on branch trunk
— OFLHAArchiveEntry: Merge date and modificationDate
The date is meant to be the modification date and the extension is
supposed to override the modification date on old LHA versions where the
modification date is only stored in local time. (user: js, size: 18018) [annotate] [blame] [check-ins using]
To Artifact [c71c080e0a]:
- File
src/OFLHAArchiveEntry.m
— part of check-in
[6f13f74134]
at
2022-08-27 20:23:24
on branch trunk
— OFLHAArchiveEntry: Make (un)compressedSize ull
There's newer, less common LHA versions that allow 64 bit for the size.
However, for consistency with OFTarArchiveEntry, use unsigned long long
instead of uint64_t. (user: js, size: 18267) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
333 334 335 336 337 338 339 340 | uint32_t date; _compressionMethod = [[OFString alloc] initWithCString: header + 2 encoding: OFStringEncodingASCII length: 5]; memcpy(&_compressedSize, header + 7, 4); | > > > > | > | > | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | uint32_t date; _compressionMethod = [[OFString alloc] initWithCString: header + 2 encoding: OFStringEncodingASCII length: 5]; if (_compressedSize > UINT32_MAX || _uncompressedSize > UINT32_MAX) @throw [OFOutOfRangeException exception]; memcpy(&_compressedSize, header + 7, 4); _compressedSize = OFFromLittleEndian32((uint32_t)_compressedSize); memcpy(&_uncompressedSize, header + 11, 4); _uncompressedSize = OFFromLittleEndian32((uint32_t)_uncompressedSize); memcpy(&date, header + 15, 4); date = OFFromLittleEndian32(date); _headerLevel = header[20]; _extensions = [[OFMutableArray alloc] init]; |
︙ | ︙ | |||
471 472 473 474 475 476 477 | } - (OFString *)compressionMethod { return _compressionMethod; } | | | | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | } - (OFString *)compressionMethod { return _compressionMethod; } - (unsigned long long)compressedSize { return _compressedSize; } - (unsigned long long)uncompressedSize { return _uncompressedSize; } - (OFDate *)modificationDate { return _modificationDate; |
︙ | ︙ | |||
555 556 557 558 559 560 561 | OFStringEncodingASCII] != 5) @throw [OFInvalidArgumentException exception]; getFileNameAndDirectoryName(self, encoding, &fileName, &fileNameLength, &directoryName, &directoryNameLength); if (fileNameLength > UINT16_MAX - 3 || | | > | | | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | OFStringEncodingASCII] != 5) @throw [OFInvalidArgumentException exception]; getFileNameAndDirectoryName(self, encoding, &fileName, &fileNameLength, &directoryName, &directoryNameLength); if (fileNameLength > UINT16_MAX - 3 || directoryNameLength > UINT16_MAX - 3 || _compressedSize > UINT32_MAX || _uncompressedSize > UINT32_MAX) @throw [OFOutOfRangeException exception]; /* Length. Filled in after we're done. */ [data increaseCountBy: 2]; [data addItems: [_compressionMethod cStringWithEncoding: OFStringEncodingASCII] count: 5]; tmp32 = OFToLittleEndian32((uint32_t)_compressedSize); [data addItems: &tmp32 count: sizeof(tmp32)]; tmp32 = OFToLittleEndian32((uint32_t)_uncompressedSize); [data addItems: &tmp32 count: sizeof(tmp32)]; tmp32 = OFToLittleEndian32( (uint32_t)_modificationDate.timeIntervalSince1970); [data addItems: &tmp32 count: sizeof(tmp32)]; /* Reserved */ |
︙ | ︙ | |||
719 720 721 722 723 724 725 | OFString *extensions = [_extensions.description stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; OFString *ret = [OFString stringWithFormat: @"<%@:\n" @"\tFile name = %@\n" @"\tCompression method = %@\n" | | | | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | OFString *extensions = [_extensions.description stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; OFString *ret = [OFString stringWithFormat: @"<%@:\n" @"\tFile name = %@\n" @"\tCompression method = %@\n" @"\tCompressed size = %llu\n" @"\tUncompressed size = %llu\n" @"\tModification date = %@\n" @"\tHeader level = %u\n" @"\tCRC16 = %04" @PRIX16 @"\n" @"\tOperating system identifier = %c\n" @"\tComment = %@\n" @"\tMode = %@\n" @"\tUID = %@\n" |
︙ | ︙ |