ObjFW  Check-in [44bf860dc2]

Overview
Comment:OFZIPArchive: Throw exception on closed archive
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 44bf860dc216e204e312b12eecd9702947c82a81e8bfb1957af0c231bc04e317
User & Date: js on 2022-01-16 18:23:25
Other Links: manifest | tags
Context
2022-01-17
08:18
OFUUID: Use lowercase as per RFC 4122 Section 3 check-in: f70ea939ba user: js tags: trunk
2022-01-16
18:23
OFZIPArchive: Throw exception on closed archive check-in: 44bf860dc2 user: js tags: trunk
16:31
objfw-compile: Fix checking which files to rebuild check-in: de3f98e75b user: js tags: trunk
Changes

Modified src/OFZIPArchive.m from [349c80f1a5] to [eb9f1fb6fa].

431
432
433
434
435
436
437



438
439
440
441
442
443
444
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447







+
+
+







- (OFStream *)streamForReadingFile: (OFString *)path
{
	void *pool = objc_autoreleasePoolPush();
	OFZIPArchiveEntry *entry;
	OFZIPArchiveLocalFileHeader *localFileHeader;
	int64_t offset64;

	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_mode != modeRead)
		@throw [OFInvalidArgumentException exception];

	if ((entry = [_pathToEntryMap objectForKey: path]) == nil)
		@throw [OFOpenItemFailedException exceptionWithPath: path
							       mode: @"r"
							      errNo: ENOENT];
481
482
483
484
485
486
487



488
489
490
491
492
493
494
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500







+
+
+







	int64_t offsetAdd = 0;
	void *pool;
	OFMutableZIPArchiveEntry *entry;
	OFString *fileName;
	OFData *extraField;
	uint16_t fileNameLength, extraFieldLength;

	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_mode != modeWrite && _mode != modeAppend)
		@throw [OFInvalidArgumentException exception];

	pool = objc_autoreleasePoolPush();
	entry = [[entry_ mutableCopy] autorelease];

	if ([_pathToEntryMap objectForKey: entry.fileName] != nil)