14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
*/
#include "config.h"
#import "OFZooArchiveEntry.h"
#import "OFZooArchiveEntry+Private.h"
#import "OFDate.h"
#import "OFSeekableStream.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFInvalidFormatException.h"
@implementation OFZooArchiveEntry
@synthesize compressionMethod = _compressionMethod, CRC16 = _CRC16;
@synthesize uncompressedSize = _uncompressedSize;
@synthesize compressedSize = _compressedSize, deleted = _deleted;
@synthesize fileComment = _fileComment;
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)of_initWithStream: (OF_KINDOF(OFStream *))stream
|
>
|
|
14
15
16
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"
#import "OFZooArchiveEntry.h"
#import "OFZooArchiveEntry+Private.h"
#import "OFDate.h"
#import "OFNumber.h"
#import "OFSeekableStream.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFInvalidFormatException.h"
@implementation OFZooArchiveEntry
@synthesize compressionMethod = _compressionMethod, CRC16 = _CRC16;
@synthesize uncompressedSize = _uncompressedSize;
@synthesize compressedSize = _compressedSize, deleted = _deleted;
@synthesize fileComment = _fileComment, POSIXPermissions = _POSIXPermissions;
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)of_initWithStream: (OF_KINDOF(OFStream *))stream
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
exception];
_directoryName = [[stream
readStringWithLength: directoryNameLength
encoding: encoding] copy];
extraLength -= directoryNameLength;
}
} else
_fileName = [[OFString alloc]
initWithCString: fileNameBuffer
encoding: encoding];
if (commentOffset != 0) {
[stream seekToOffset: commentOffset whence: OFSeekSet];
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
exception];
_directoryName = [[stream
readStringWithLength: directoryNameLength
encoding: encoding] copy];
extraLength -= directoryNameLength;
}
if (extraLength >= 2) {
/* System ID */
[stream readLittleEndianInt16];
extraLength -= 2;
}
if (extraLength >= 3) {
uint8_t attributes[3];
[stream readIntoBuffer: attributes
exactLength: 3];
if (attributes[2] & (1 << 6)) {
uint16_t mode = (attributes[0] |
(attributes[1] << 8)) & 0777;
_POSIXPermissions = [[OFNumber alloc]
initWithUnsignedShort: mode];
}
extraLength -= 3;
}
} else
_fileName = [[OFString alloc]
initWithCString: fileNameBuffer
encoding: encoding];
if (commentOffset != 0) {
[stream seekToOffset: commentOffset whence: OFSeekSet];
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
}
- (void)dealloc
{
[_fileComment release];
[_fileName release];
[_directoryName release];
[super dealloc];
}
- (id)copy
{
return [self retain];
|
>
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
}
- (void)dealloc
{
[_fileComment release];
[_fileName release];
[_directoryName release];
[_POSIXPermissions release];
[super dealloc];
}
- (id)copy
{
return [self retain];
|