Differences From Artifact [0ac2251133]:
- File
src/OFZIPArchive.m
— part of check-in
[53e46a8326]
at
2013-10-10 13:36:13
on branch trunk
— OFZIPArchive: Add support for deflate.
Also adds support for data descriptors. (user: js, size: 9717) [annotate] [blame] [check-ins using]
To Artifact [8bbe969b1a]:
- File
src/OFZIPArchive.m
— part of check-in
[e2ad3ceacb]
at
2013-10-10 22:18:52
on branch trunk
— OFZIPArchive: Correctly handle archive comments.
Archive comments allow up to 65535 bytes after the end of central
directory record, thus the magic bytes for the end of central directory
record are not always at end - 22. (user: js, size: 9897) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
147 148 149 150 151 152 153 154 155 156 157 | [super dealloc]; } - (void)OF_readZIPInfo { void *pool = objc_autoreleasePoolPush(); uint16_t commentLength; [_file seekToOffset: -22 whence: SEEK_END]; | > > > | > > > > > > > > | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | [super dealloc]; } - (void)OF_readZIPInfo { void *pool = objc_autoreleasePoolPush(); uint16_t commentLength; size_t offset = 0; bool valid = false; [_file seekToOffset: -22 whence: SEEK_END]; while (offset++ < 65536) { if ([_file readLittleEndianInt32] == 0x06054B50) { valid = true; break; } else [_file seekToOffset: -5 whence: SEEK_CUR]; } if (!valid) @throw [OFInvalidFormatException exception]; _diskNumber = [_file readLittleEndianInt16], _centralDirectoryDisk = [_file readLittleEndianInt16]; _centralDirectoryEntriesInDisk = [_file readLittleEndianInt16]; _centralDirectoryEntries = [_file readLittleEndianInt16]; _centralDirectorySize = [_file readLittleEndianInt32]; |
︙ | ︙ |