Differences From 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]
To Artifact [b22fa20c14]:
- File
src/OFZIPArchiveEntry.m
— part of check-in
[1aea73d8b1]
at
2017-08-05 11:15:25
on branch trunk
— Add OFMutableZIPArchiveEntry
This is in preparation for OFZIPArchive write support. (user: js, size: 10049) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
138 139 140 141 142 143 144 | } *data = NULL; *size = 0; } @implementation OFZIPArchiveEntry | | < > | < < < < < < < < < > > > > > > > > > > > > > > > | 138 139 140 141 142 143 144 145 146 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 | } *data = NULL; *size = 0; } @implementation OFZIPArchiveEntry + (instancetype)entryWithFileName: (OFString *)fileName { return [[[self alloc] initWithFileName: fileName] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithFileName: (OFString *)fileName { self = [super init]; @try { _fileName = [_fileName copy]; } @catch (id e) { [self release]; @throw e; } return self; } - (instancetype)of_initWithStream: (OFStream *)stream { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); |
︙ | ︙ | |||
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]; | > | | > | > | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | encoding = (_generalPurposeBitFlag & (1 << 11) ? OF_STRING_ENCODING_UTF_8 : OF_STRING_ENCODING_CODEPAGE_437); _fileName = [[stream readStringWithLength: fileNameLength encoding: encoding] copy]; if (extraFieldLength > 0) _extraField = [[stream readDataWithCount: extraFieldLength] copy]; if (fileCommentLength > 0) _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) { if (_uncompressedSize == 0xFFFFFFFF) _uncompressedSize = of_zip_archive_read_field64( |
︙ | ︙ | |||
237 238 239 240 241 242 243 244 245 246 247 248 249 250 | { [_fileName release]; [_extraField release]; [_fileComment release]; [super dealloc]; } - (OFDate *)modificationDate { void *pool = objc_autoreleasePoolPush(); uint16_t year = ((_lastModifiedFileDate & 0xFE00) >> 9) + 1980; uint8_t month = (_lastModifiedFileDate & 0x1E0) >> 5; uint8_t day = (_lastModifiedFileDate & 0x1F); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | { [_fileName release]; [_extraField release]; [_fileComment release]; [super dealloc]; } - copy { return [self retain]; } - mutableCopy { OFZIPArchiveEntry *copy = [[OFMutableZIPArchiveEntry alloc] initWithFileName: _fileName]; @try { copy->_versionMadeBy = _versionMadeBy; copy->_minVersionNeeded = _minVersionNeeded; copy->_generalPurposeBitFlag = _generalPurposeBitFlag; copy->_compressionMethod = _compressionMethod; copy->_lastModifiedFileTime = _lastModifiedFileTime; copy->_lastModifiedFileDate = _lastModifiedFileDate; copy->_CRC32 = _CRC32; copy->_compressedSize = _compressedSize; copy->_uncompressedSize = _uncompressedSize; copy->_extraField = [_extraField copy]; copy->_fileComment = [_extraField copy]; copy->_startDiskNumber = _startDiskNumber; copy->_internalAttributes = _internalAttributes; copy->_versionSpecificAttributes = _versionSpecificAttributes; copy->_localFileHeaderOffset = _localFileHeaderOffset; } @catch (id e) { [copy release]; @throw e; } } - (OFString *)fileName { return _fileName; } - (OFString *)fileComment { return _fileComment; } - (OFData *)extraField { return _extraField; } - (uint16_t)versionMadeBy { return _versionMadeBy; } - (uint16_t)minVersionNeeded { return _minVersionNeeded; } - (OFDate *)modificationDate { void *pool = objc_autoreleasePoolPush(); uint16_t year = ((_lastModifiedFileDate & 0xFE00) >> 9) + 1980; uint8_t month = (_lastModifiedFileDate & 0x1E0) >> 5; uint8_t day = (_lastModifiedFileDate & 0x1F); |
︙ | ︙ | |||
262 263 264 265 266 267 268 | format: @"%Y-%m-%d %H:%M:%S"]; objc_autoreleasePoolPop(pool); return [date autorelease]; } | > > > > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 328 329 330 331 332 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 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | format: @"%Y-%m-%d %H:%M:%S"]; objc_autoreleasePoolPop(pool); return [date autorelease]; } - (uint16_t)compressionMethod { return _compressionMethod; } - (uint64_t)compressedSize { return _compressedSize; } - (uint64_t)uncompressedSize { return _uncompressedSize; } - (uint32_t)CRC32 { return _CRC32; } - (uint32_t)versionSpecificAttributes { return _versionSpecificAttributes; } - (uint16_t)generalPurposeBitFlag { return _generalPurposeBitFlag; } - (uint16_t)of_lastModifiedFileTime { return _lastModifiedFileTime; } - (uint16_t)of_lastModifiedFileDate { return _lastModifiedFileDate; } - (int64_t)of_localFileHeaderOffset { return _localFileHeaderOffset; } - (OFString *)description { void *pool = objc_autoreleasePoolPush(); OFString *ret = [OFString stringWithFormat: @"<%@:\n" @"\tFile name = %@\n" |
︙ | ︙ |