ObjFW  Diff

Differences From Artifact [412525e4b5]:

To Artifact [a292f6c75d]:


254
255
256
257
258
259
260
261

262


263
264
265
266
267
268
269
254
255
256
257
258
259
260

261
262
263
264
265
266
267
268
269
270
271







-
+

+
+







	unsigned char *buffer;

	if (_lastHeaderOffset == 0)
		return;

	offset = [_stream seekToOffset: 0 whence: OFSeekCurrent];

	if (offset < 0 || offset > UINT32_MAX || _lastHeaderLength < 56)
	if (offset < 0 || (unsigned long long)offset > UINT32_MAX)
		@throw [OFOutOfRangeException exception];

	OFEnsure(_lastHeaderLength >= 56);

	[_stream seekToOffset: _lastHeaderOffset whence: OFSeekSet];
	buffer = OFAllocMemory(1, _lastHeaderLength);
	@try {
		uint16_t tmp16;
		uint32_t tmp32;

595
596
597
598
599
600
601
602

603
604
605
606
607
608
609
597
598
599
600
601
602
603

604
605
606
607
608
609
610
611







-
+








	_entry.uncompressedSize = _bytesWritten;
	_entry.compressedSize = _bytesWritten;
	_entry.CRC16 = _CRC16;

	offset = [_stream seekToOffset: 0 whence: OFSeekCurrent];

	if (offset > UINT32_MAX)
	if ((unsigned long long)offset > UINT32_MAX)
		@throw [OFOutOfRangeException exception];

	[_stream seekToOffset: *_lastHeaderOffset whence: OFSeekSet];
	_entry->_dataOffset = (uint32_t)offset;

	OFEnsure([_entry of_writeToStream: _stream
				 encoding: _encoding] == *_lastHeaderLength);