ObjFW  Check-in [79b88573e0]

Overview
Comment:OFZIPArchive: Restrict split archives to mode @"r"
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 79b88573e0c534926c233211318b9921f0daa535b35ce2370d67f2740b1c5a5f
User & Date: js on 2023-07-24 18:40:56
Other Links: manifest | tags
Context
2023-07-25
21:21
OFZIPArchive: Handle files spanning multiple parts check-in: d6f5e2abc5 user: js tags: trunk
2023-07-24
18:40
OFZIPArchive: Restrict split archives to mode @"r" check-in: 79b88573e0 user: js tags: trunk
18:20
Make GCC happy again check-in: 139f041fa1 user: js tags: trunk
Changes

Modified src/OFZIPArchive.m from [a443071aae] to [d64ccad589].

154
155
156
157
158
159
160
161
162
163
164
165










166
167
168
169
170
171
172
154
155
156
157
158
159
160





161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177







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







@synthesize delegate = _delegate, archiveComment = _archiveComment;

static void
seekOrThrowInvalidFormat(OFZIPArchive *archive, const uint32_t *diskNumber,
    OFStreamOffset offset, OFSeekWhence whence)
{
	if (diskNumber != NULL && *diskNumber != archive->_diskNumber) {
		OFStream *oldStream = archive->_stream;
		OFSeekableStream *stream =
		    [archive->_delegate archive: archive
			      wantsPartNumbered: *diskNumber
			     totalNumberOfParts: archive->_numDisks];
		OFStream *oldStream;
		OFSeekableStream *stream;

		if (archive->_mode != modeRead)
			@throw [OFInvalidFormatException exception];

		oldStream = archive->_stream;
		stream = [archive->_delegate archive: archive
				   wantsPartNumbered: *diskNumber
				  totalNumberOfParts: archive->_numDisks];

		if (stream == nil)
			@throw [OFInvalidFormatException exception];

		archive->_diskNumber = *diskNumber;
		archive->_stream = [stream retain];
		[oldStream release];