Differences From Artifact [4f0d23572a]:
- File src/OFLHAArchive.m — part of check-in [6b42e44f99] at 2018-06-10 20:29:27 on branch trunk — OF{LHA,ZIP}Archive: Improve truncation detection (user: js, size: 19759) [annotate] [blame] [check-ins using]
To Artifact [1f3aa621cb]:
- File
src/OFLHAArchive.m
— part of check-in
[8f21e8acb5]
at
2018-06-12 21:33:18
on branch trunk
— Rename OFChecksum{Failed -> Mismatch}Exception
This also adds a parameter for the actual and expected checksum. (user: js, size: 20045) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
28 29 30 31 32 33 34 | #import "OFStream.h" #import "OFSeekableStream.h" #import "OFString.h" #import "crc16.h" #import "huffman_tree.h" | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #import "OFStream.h" #import "OFSeekableStream.h" #import "OFString.h" #import "crc16.h" #import "huffman_tree.h" #import "OFChecksumMismatchException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFNotOpenException.h" #import "OFTruncatedDataException.h" #define LHSTREAM_BUFFER_SIZE 4096 |
︙ | ︙ | |||
806 807 808 809 810 811 812 | _toRead -= ret; _CRC16 = of_crc16(_CRC16, buffer, ret); if (_toRead == 0) { _atEndOfStream = true; | | > > > > > | > > > | 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 | _toRead -= ret; _CRC16 = of_crc16(_CRC16, buffer, ret); if (_toRead == 0) { _atEndOfStream = true; if (_CRC16 != [_entry CRC16]) { OFString *actualChecksum = [OFString stringWithFormat: @"%04" PRIX16, _CRC16]; OFString *expectedChecksum = [OFString stringWithFormat: @"%04" PRIX16, [_entry CRC16]]; @throw [OFChecksumMismatchException exceptionWithActualChecksum: actualChecksum expectedChecksum: expectedChecksum]; } } return ret; } - (bool)hasDataInReadBuffer { |
︙ | ︙ |