ObjFW  Check-in [4f76840749]

Overview
Comment:OFLHAArchive: Fix iterating without reading
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4f768407494095be20ecf4d3f7bf037573e9117956040ee024f197c6b0f26b5b
User & Date: js on 2022-11-23 21:47:55
Other Links: manifest | tags
Context
2022-11-23
21:50
Remove OFTarArchiveMode from header check-in: e520af4113 user: js tags: trunk
21:47
OFLHAArchive: Fix iterating without reading check-in: 4f76840749 user: js tags: trunk
21:45
OFTarArchive: Fix iterating without reading check-in: 0966f1b371 user: js tags: trunk
Changes

Modified src/OFLHAArchive.m from [fa04eb799a] to [9bc5b44666].

171
172
173
174
175
176
177













178
179
180
181
182
183
184
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







+
+
+
+
+
+
+
+
+
+
+
+
+







- (OFLHAArchiveEntry *)nextEntry
{
	char header[21];
	size_t headerLen;

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

	if (_currentEntry != nil && _lastReturnedStream == nil) {
		/*
		 * No read stream was created since the last call to
		 * -[nextEntry]. Create it so that we can properly skip the
		 *  data.
		 */
		void *pool = objc_autoreleasePoolPush();

		[self streamForReadingCurrentEntry];

		objc_autoreleasePoolPop(pool);
	}

	[_currentEntry release];
	_currentEntry = nil;

	[(OFLHAArchiveFileReadStream *)_lastReturnedStream of_skip];
	@try {
		[_lastReturnedStream close];
198
199
200
201
202
203
204
205

206
207
208
209
210
211
212
211
212
213
214
215
216
217

218
219
220
221
222
223
224
225







-
+







			@throw [OFTruncatedDataException exception];
		}

		headerLen += [_stream readIntoBuffer: header + headerLen
					      length: 21 - headerLen];
	}

	_currentEntry= [[OFLHAArchiveEntry alloc]
	_currentEntry = [[OFLHAArchiveEntry alloc]
	    of_initWithHeader: header
		       stream: _stream
		     encoding: _encoding];

	return _currentEntry;
}