Differences From Artifact [f5e97efd24]:
- File
src/OFZooArchiveEntry.m
— part of check-in
[830df1e8ec]
at
2024-03-02 11:01:18
on branch trunk
— OFZooArchiveEntry: Fix time zone
The time zone in Zoo archives is stored as west of UTC. (user: js, size: 6494) [annotate] [blame] [check-ins using]
To Artifact [68f5329f4b]:
- File src/OFZooArchiveEntry.m — part of check-in [52a1740f5e] at 2024-03-02 17:13:10 on branch trunk — OFZooArchiveEntry: Add header type and OS ID (user: js, size: 6802) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 | #import "OFDate.h" #import "OFNumber.h" #import "OFSeekableStream.h" #import "OFStream.h" #import "OFString.h" #import "OFInvalidFormatException.h" @implementation OFZooArchiveEntry | > | | | > > < | | > > > > > > > > | > > > | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #import "OFDate.h" #import "OFNumber.h" #import "OFSeekableStream.h" #import "OFStream.h" #import "OFString.h" #import "OFInvalidFormatException.h" #import "OFUnsupportedVersionException.h" @implementation OFZooArchiveEntry @synthesize headerType = _headerType, compressionMethod = _compressionMethod; @synthesize CRC16 = _CRC16, uncompressedSize = _uncompressedSize; @synthesize compressedSize = _compressedSize; @synthesize minVersionNeeded = _minVersionNeeded, deleted = _deleted; @synthesize fileComment = _fileComment; @synthesize operatingSystemIdentifier = _operatingSystemIdentifier; @synthesize POSIXPermissions = _POSIXPermissions; - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithStream: (OF_KINDOF(OFStream *))stream encoding: (OFStringEncoding)encoding { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); char fileNameBuffer[13]; uint32_t commentOffset; uint16_t commentLength; if ([stream readLittleEndianInt32] != 0xFDC4A7DC) @throw [OFInvalidFormatException exception]; if ((_headerType = [stream readInt8]) > 2) @throw [OFUnsupportedVersionException exceptionWithVersion: [OFString stringWithFormat: @"%u", _headerType]]; _compressionMethod = [stream readInt8]; _nextHeaderOffset = [stream readLittleEndianInt32]; if (_nextHeaderOffset == 0) { [self release]; return nil; } _dataOffset = [stream readLittleEndianInt32]; _lastModifiedFileDate = [stream readLittleEndianInt16]; _lastModifiedFileTime = [stream readLittleEndianInt16]; _CRC16 = [stream readLittleEndianInt16]; _uncompressedSize = [stream readLittleEndianInt32]; _compressedSize = [stream readLittleEndianInt32]; _minVersionNeeded = [stream readBigEndianInt16]; _deleted = [stream readInt8]; /* * File structure, whatever that is meant to be. Seems to * always be 0. */ [stream readInt8]; commentOffset = [stream readLittleEndianInt32]; commentLength = [stream readLittleEndianInt16]; [stream readIntoBuffer: fileNameBuffer exactLength: 13]; if (fileNameBuffer[12] != '\0') fileNameBuffer[12] = '\0'; if (_headerType >= 2) { uint16_t extraLength = [stream readLittleEndianInt16]; uint8_t fileNameLength, directoryNameLength; if (extraLength < 10) @throw [OFInvalidFormatException exception]; _timeZone = [stream readInt8]; |
︙ | ︙ | |||
111 112 113 114 115 116 117 | _directoryName = [[stream readStringWithLength: directoryNameLength encoding: encoding] copy]; extraLength -= directoryNameLength; } if (extraLength >= 2) { | | | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | _directoryName = [[stream readStringWithLength: directoryNameLength encoding: encoding] copy]; extraLength -= directoryNameLength; } if (extraLength >= 2) { _operatingSystemIdentifier = [stream readLittleEndianInt16]; extraLength -= 2; } if (extraLength >= 3) { uint8_t attributes[3]; [stream readIntoBuffer: attributes |
︙ | ︙ |