20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#import "OFLHAArchiveEntry.h"
#import "OFLHAArchiveEntry+Private.h"
#import "OFArray.h"
#import "OFCRC16.h"
#import "OFData.h"
#import "OFDate.h"
#import "OFNumber.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
#import "OFUnsupportedVersionException.h"
|
>
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#import "OFLHAArchiveEntry.h"
#import "OFLHAArchiveEntry+Private.h"
#import "OFArray.h"
#import "OFCRC16.h"
#import "OFData.h"
#import "OFDate.h"
#import "OFNumber.h"
#import "OFSeekableStream.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
#import "OFUnsupportedVersionException.h"
|
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
|
_headerLevel = header[20];
_extensions = [[OFMutableArray alloc] init];
switch (_headerLevel) {
case 0:
case 1:;
void *pool = objc_autoreleasePoolPush();
uint8_t fileNameLength;
OFString *tmp;
_modificationDate = [parseMSDOSDate(date) retain];
fileNameLength = [stream readInt8];
tmp = [stream readStringWithLength: fileNameLength
encoding: encoding];
tmp = [tmp stringByReplacingOccurrencesOfString: @"\\"
withString: @"/"];
_fileName = [tmp copy];
_CRC16 = [stream readLittleEndianInt16];
if (_headerLevel == 1) {
_operatingSystemIdentifier = [stream readInt8];
readExtensions(self, stream, encoding, false);
}
objc_autoreleasePoolPop(pool);
break;
case 2:
case 3:
_modificationDate = [[OFDate alloc]
initWithTimeIntervalSince1970: date];
|
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
|
_headerLevel = header[20];
_extensions = [[OFMutableArray alloc] init];
switch (_headerLevel) {
case 0:
case 1:;
void *pool = objc_autoreleasePoolPush();
uint8_t extendedAreaSize;
uint8_t fileNameLength;
OFString *tmp;
_modificationDate = [parseMSDOSDate(date) retain];
fileNameLength = [stream readInt8];
tmp = [stream readStringWithLength: fileNameLength
encoding: encoding];
tmp = [tmp stringByReplacingOccurrencesOfString: @"\\"
withString: @"/"];
_fileName = [tmp copy];
_CRC16 = [stream readLittleEndianInt16];
extendedAreaSize =
header[0] - (21 - 2) - 1 - fileNameLength - 2;
if (_headerLevel == 1) {
_operatingSystemIdentifier = [stream readInt8];
/*
* 1 for the operating system identifier, 2
* because we don't want to skip the size of
* the next extended header.
*/
extendedAreaSize -= 1 + 2;
}
/* Skip extended area. */
if ([stream isKindOfClass: [OFSeekableStream class]])
[(OFSeekableStream *)stream
seekToOffset: extendedAreaSize
whence: OFSeekCurrent];
else {
char buffer[256];
while (extendedAreaSize > 0)
extendedAreaSize -= [stream
readIntoBuffer: buffer
length: extendedAreaSize];
}
if (_headerLevel == 1)
readExtensions(self, stream, encoding, false);
objc_autoreleasePoolPop(pool);
break;
case 2:
case 3:
_modificationDate = [[OFDate alloc]
initWithTimeIntervalSince1970: date];
|