Differences From Artifact [bdb8babfcc]:
- File
src/OFZIPArchiveEntry.m
— part of check-in
[6b77a5dd8b]
at
2017-05-21 21:28:57
on branch trunk
— Prefix private methods with of_ instead of OF_
This matches Apple's style. (user: js, size: 8608) [annotate] [blame] [check-ins using]
To Artifact [ed0dd8e296]:
- File src/OFZIPArchiveEntry.m — part of check-in [c8f7b90082] at 2017-07-22 20:50:27 on branch trunk — Split OFDataArray into OFData and OFMutableData (user: js, size: 8616) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
17 18 19 20 21 22 23 | #include "config.h" #include <inttypes.h> #import "OFZIPArchiveEntry.h" #import "OFZIPArchiveEntry+Private.h" #import "OFString.h" | | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include "config.h" #include <inttypes.h> #import "OFZIPArchiveEntry.h" #import "OFZIPArchiveEntry+Private.h" #import "OFString.h" #import "OFData.h" #import "OFDate.h" #import "OFStream.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" extern uint32_t of_zip_archive_read_field32(const uint8_t **, uint16_t *); extern uint64_t of_zip_archive_read_field64(const uint8_t **, uint16_t *); OFString * of_zip_archive_entry_version_to_string(uint16_t version) { const char *attrCompat = NULL; switch (version >> 8) { |
︙ | ︙ | |||
106 107 108 109 110 111 112 | else return [OFString stringWithFormat: @"%u.%u, unknown %02X", (version % 0xFF) / 10, (version & 0xFF) % 10, version >> 8]; } void | | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | else return [OFString stringWithFormat: @"%u.%u, unknown %02X", (version % 0xFF) / 10, (version & 0xFF) % 10, version >> 8]; } void of_zip_archive_entry_extra_field_find(OFData *extraField, uint16_t tag, const uint8_t **data, uint16_t *size) { const uint8_t *bytes = [extraField items]; size_t count = [extraField count]; for (size_t i = 0; i < count;) { uint16_t currentTag, currentSize; if (i + 3 >= count) @throw [OFInvalidFormatException exception]; |
︙ | ︙ | |||
164 165 166 167 168 169 170 | { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); uint16_t fileNameLength, extraFieldLength, fileCommentLength; of_string_encoding_t encoding; | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); uint16_t fileNameLength, extraFieldLength, fileCommentLength; of_string_encoding_t encoding; const uint8_t *ZIP64 = NULL; uint16_t ZIP64Size; if ([stream readLittleEndianInt32] != 0x02014B50) @throw [OFInvalidFormatException exception]; _versionMadeBy = [stream readLittleEndianInt16]; _minVersionNeeded = [stream readLittleEndianInt16]; |
︙ | ︙ | |||
193 194 195 196 197 198 199 | encoding = (_generalPurposeBitFlag & (1 << 11) ? OF_STRING_ENCODING_UTF_8 : OF_STRING_ENCODING_CODEPAGE_437); _fileName = [[stream readStringWithLength: fileNameLength encoding: encoding] copy]; | | | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | encoding = (_generalPurposeBitFlag & (1 << 11) ? OF_STRING_ENCODING_UTF_8 : OF_STRING_ENCODING_CODEPAGE_437); _fileName = [[stream readStringWithLength: fileNameLength encoding: encoding] copy]; _extraField = [[stream readDataWithCount: extraFieldLength] copy]; _fileComment = [[stream readStringWithLength: fileCommentLength encoding: encoding] copy]; of_zip_archive_entry_extra_field_find(_extraField, OF_ZIP_ARCHIVE_ENTRY_EXTRA_FIELD_ZIP64, &ZIP64, &ZIP64Size); if (ZIP64 != NULL) { |
︙ | ︙ | |||
262 263 264 265 266 267 268 | format: @"%Y-%m-%d %H:%M:%S"]; objc_autoreleasePoolPop(pool); return [date autorelease]; } | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | format: @"%Y-%m-%d %H:%M:%S"]; objc_autoreleasePoolPop(pool); return [date autorelease]; } - (OFData *)extraField { return [[_extraField copy] autorelease]; } - (OFString *)description { void *pool = objc_autoreleasePoolPush(); |
︙ | ︙ |