ObjFW  Diff

Differences From Artifact [0ac2251133]:

To Artifact [8bbe969b1a]:


147
148
149
150
151
152
153


154
155
156
157

158








159
160
161
162
163
164
165
	[super dealloc];
}

- (void)OF_readZIPInfo
{
	void *pool = objc_autoreleasePoolPush();
	uint16_t commentLength;



	[_file seekToOffset: -22
		     whence: SEEK_END];


	if ([_file readLittleEndianInt32] != 0x06054B50)








		@throw [OFInvalidFormatException exception];

	_diskNumber = [_file readLittleEndianInt16],
	_centralDirectoryDisk = [_file readLittleEndianInt16];
	_centralDirectoryEntriesInDisk = [_file readLittleEndianInt16];
	_centralDirectoryEntries = [_file readLittleEndianInt16];
	_centralDirectorySize = [_file readLittleEndianInt32];







>
>




>
|
>
>
>
>
>
>
>
>







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
	[super dealloc];
}

- (void)OF_readZIPInfo
{
	void *pool = objc_autoreleasePoolPush();
	uint16_t commentLength;
	size_t offset = 0;
	bool valid = false;

	[_file seekToOffset: -22
		     whence: SEEK_END];

	while (offset++ < 65536) {
		if ([_file readLittleEndianInt32] == 0x06054B50) {
			valid = true;
			break;
		} else
			[_file seekToOffset: -5
				     whence: SEEK_CUR];
	}

	if (!valid)
		@throw [OFInvalidFormatException exception];

	_diskNumber = [_file readLittleEndianInt16],
	_centralDirectoryDisk = [_file readLittleEndianInt16];
	_centralDirectoryEntriesInDisk = [_file readLittleEndianInt16];
	_centralDirectoryEntries = [_file readLittleEndianInt16];
	_centralDirectorySize = [_file readLittleEndianInt32];