ObjFW  Check-in [ddcef349e5]

Overview
Comment:ofarc: Fix multipart ZIP files

This was broken when switching adding the path extension to the IRI
methods.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ddcef349e53b0a770ff84acbdff3fd62aa091ac05f3b48e3bf9c1b9ca4a20ec5
User & Date: js on 2024-03-10 23:10:26
Other Links: manifest | tags
Context
2024-03-10
23:33
OFZIPArchive: Write correct number of disks check-in: 9f7c0669b0 user: js tags: trunk
23:10
ofarc: Fix multipart ZIP files check-in: ddcef349e5 user: js tags: trunk
23:06
OFZIPArchive: Undo incorrect disk 0 vs 1 fix check-in: 0c8f496588 user: js tags: trunk
Changes

Modified utils/ofarc/ZIPArchive.m from [05dbf8ce6d] to [f42e8a7cde].

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

- (OFSeekableStream *)archive: (OFZIPArchive *)archive
	    wantsPartNumbered: (unsigned int)partNumber
	       lastPartNumber: (unsigned int)lastPartNumber
{
	OFIRI *IRI;

	if ([_archiveIRI.path.pathExtension caseInsensitiveCompare: @"zip"] !=
	    OFOrderedSame)
		return nil;

	if (partNumber > 98)
		return nil;

	if (partNumber == lastPartNumber)
		IRI = _archiveIRI;
	else {
		OFMutableIRI *copy = [[_archiveIRI mutableCopy] autorelease];
		[copy deletePathExtension];
		[copy appendPathExtension: [OFString
		    stringWithFormat: @".z%02u", partNumber + 1]];
		[copy makeImmutable];
		IRI = copy;
	}

	return (OFSeekableStream *)[OFIRIHandler openItemAtIRI: IRI mode: @"r"];
}








|












|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

- (OFSeekableStream *)archive: (OFZIPArchive *)archive
	    wantsPartNumbered: (unsigned int)partNumber
	       lastPartNumber: (unsigned int)lastPartNumber
{
	OFIRI *IRI;

	if ([_archiveIRI.pathExtension caseInsensitiveCompare: @"zip"] !=
	    OFOrderedSame)
		return nil;

	if (partNumber > 98)
		return nil;

	if (partNumber == lastPartNumber)
		IRI = _archiveIRI;
	else {
		OFMutableIRI *copy = [[_archiveIRI mutableCopy] autorelease];
		[copy deletePathExtension];
		[copy appendPathExtension: [OFString
		    stringWithFormat: @"z%02u", partNumber + 1]];
		[copy makeImmutable];
		IRI = copy;
	}

	return (OFSeekableStream *)[OFIRIHandler openItemAtIRI: IRI mode: @"r"];
}