ObjFW  Diff

Differences From Artifact [6b838273dc]:

To Artifact [87dd5a9fa3]:


168
169
170
171
172
173
174
175
176
177



178



179
180
181
182
183
184
185

186
187

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
168
169
170
171
172
173
174



175
176
177

178
179
180
181
182
183
184
185
186

187
188

189
















190
191
192
193
194
195
196







-
-
-
+
+
+
-
+
+
+






-
+

-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







	}

	*size = 0;
	return OFNotFound;
}

@implementation OFZIPArchiveEntry
+ (instancetype)entryWithFileName: (OFString *)fileName
{
	return [[[self alloc] initWithFileName: fileName] autorelease];
/*
 * The following are optional in OFArchiveEntry, but Apple GCC 4.0.1 is buggy
 * and needs this to stop complaining.
}
 */
@dynamic POSIXPermissions, ownerAccountID, groupOwnerAccountID;
@dynamic ownerAccountName, groupOwnerAccountName;

- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}

- (instancetype)initWithFileName: (OFString *)fileName
- (instancetype)of_init
{
	self = [super init];
	return [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();

		if (fileName.UTF8StringLength > UINT16_MAX)
			@throw [OFOutOfRangeException exception];

		_fileName = [fileName copy];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (instancetype)of_initWithStream: (OFStream *)stream
{
	self = [super init];

	@try {
251
252
253
254
255
256
257
258

259
260
261
262
263
264
265
237
238
239
240
241
242
243

244
245
246
247
248
249
250
251







-
+







		ZIP64Index = OFZIPArchiveEntryExtraFieldFind(extraField,
		    OFZIPArchiveEntryExtraFieldTagZIP64, &ZIP64Size);

		if (ZIP64Index != OFNotFound) {
			const uint8_t *ZIP64 =
			    [extraField itemAtIndex: ZIP64Index];
			OFRange range =
			    OFRangeMake(ZIP64Index - 4, ZIP64Size + 4);
			    OFMakeRange(ZIP64Index - 4, ZIP64Size + 4);

			if (_uncompressedSize == 0xFFFFFFFF)
				_uncompressedSize = OFZIPArchiveReadField64(
				    &ZIP64, &ZIP64Size);
			if (_compressedSize == 0xFFFFFFFF)
				_compressedSize = OFZIPArchiveReadField64(
				    &ZIP64, &ZIP64Size);
383
384
385
386
387
388
389
390

391
392
393
394
395

396
397
398
399
400
401
402
369
370
371
372
373
374
375

376
377
378
379
380

381
382
383
384
385
386
387
388







-
+




-
+







}

- (OFZIPArchiveEntryCompressionMethod)compressionMethod
{
	return _compressionMethod;
}

- (uint64_t)compressedSize
- (unsigned long long)compressedSize
{
	return _compressedSize;
}

- (uint64_t)uncompressedSize
- (unsigned long long)uncompressedSize
{
	return _uncompressedSize;
}

- (uint32_t)CRC32
{
	return _CRC32;