Overview
Comment: | OFZIPArchive: Fix uncompressed + data descriptor |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4f04f5be98096750f4cbd152fb5c097a |
User & Date: | js on 2017-08-06 20:27:04 |
Other Links: | manifest | tags |
Context
2017-08-06
| ||
21:45 | OFTarArchiveEntry: Minor refactoring check-in: a6b87a1a0c user: js tags: trunk | |
20:27 | OFZIPArchive: Fix uncompressed + data descriptor check-in: 4f04f5be98 user: js tags: trunk | |
20:10 | ofzip: Only print extraField if it exists check-in: b1356cb2f1 user: js tags: trunk | |
Changes
Modified src/OFTarArchive.m from [3df34606f0] to [d2f44563d3].
︙ | ︙ | |||
349 350 351 352 353 354 355 356 357 358 359 360 361 362 | if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; if (_atEndOfStream) return 0; if ((uint64_t)length > _toRead) length = (size_t)_toRead; ret = [_stream readIntoBuffer: buffer length: length]; if (ret == 0) | > > > | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; if (_atEndOfStream) return 0; if (length > UINT64_MAX) @throw [OFOutOfRangeException exception]; if ((uint64_t)length > _toRead) length = (size_t)_toRead; ret = [_stream readIntoBuffer: buffer length: length]; if (ret == 0) |
︙ | ︙ |
Modified src/OFZIPArchive.m from [2160df43d2] to [c368c2a33f].
︙ | ︙ | |||
73 74 75 76 77 78 79 | - initWithStream: (OFStream *)stream; - (bool)matchesEntry: (OFZIPArchiveEntry *)entry; @end @interface OFZIPArchive_FileReadStream: OFStream { OFStream *_stream, *_decompressedStream; | | < | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - initWithStream: (OFStream *)stream; - (bool)matchesEntry: (OFZIPArchiveEntry *)entry; @end @interface OFZIPArchive_FileReadStream: OFStream { OFStream *_stream, *_decompressedStream; OFZIPArchiveEntry *_entry; uint64_t _toRead; uint32_t _CRC32; bool _atEndOfStream; } - initWithStream: (OFStream *)stream entry: (OFZIPArchiveEntry *)entry; @end @interface OFZIPArchive_FileWriteStream: OFStream { OFStream *_stream; uint32_t _CRC32; @public |
︙ | ︙ | |||
454 455 456 457 458 459 460 | @throw [OFUnsupportedVersionException exceptionWithVersion: version]; } _lastReturnedStream = [[OFZIPArchive_FileReadStream alloc] initWithStream: _stream | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | @throw [OFUnsupportedVersionException exceptionWithVersion: version]; } _lastReturnedStream = [[OFZIPArchive_FileReadStream alloc] initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); return [[_lastReturnedStream retain] autorelease]; } - (OFStream *)streamForWritingEntry: (OFZIPArchiveEntry *)entry_ |
︙ | ︙ | |||
679 680 681 682 683 684 685 | return true; } @end @implementation OFZIPArchive_FileReadStream - initWithStream: (OFStream *)stream | | | | < < | > | | < < < | < | < < < < < | < < < < | < | < | | | | | < < | | | | < | < < < | < | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 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 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | return true; } @end @implementation OFZIPArchive_FileReadStream - initWithStream: (OFStream *)stream entry: (OFZIPArchiveEntry *)entry { self = [super init]; @try { _stream = [stream retain]; switch ([entry compressionMethod]) { case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_NONE: _decompressedStream = [stream retain]; break; case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE: _decompressedStream = [[OFInflateStream alloc] initWithStream: stream]; break; case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE64: _decompressedStream = [[OFInflate64Stream alloc] initWithStream: stream]; break; default: @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; } _entry = [entry copy]; _toRead = [entry uncompressedSize]; _CRC32 = ~0; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [self close]; [_stream release]; [_decompressedStream release]; [_entry release]; [super dealloc]; } - (bool)lowlevelIsAtEndOfStream { return _atEndOfStream; } - (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { size_t ret; if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; if (_atEndOfStream) return 0; if (length > UINT64_MAX) @throw [OFOutOfRangeException exception]; if ((uint64_t)length > _toRead) length = (size_t)_toRead; ret = [_decompressedStream readIntoBuffer: buffer length: length]; if (ret == 0) _atEndOfStream = true; _toRead -= ret; _CRC32 = of_crc32(_CRC32, buffer, ret); if (_toRead == 0) if (~_CRC32 != [_entry CRC32]) @throw [OFChecksumFailedException exception]; return ret; } - (void)close { [_stream release]; _stream = nil; |
︙ | ︙ |