ObjFW  Diff

Differences From Artifact [eca8fcf711]:

To Artifact [7073d8b5b3]:


749
750
751
752
753
754
755
756
757
758
759
760
761
762
763

	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_atEndOfStream)
		return 0;

	if (length > UINT64_MAX)
		@throw [OFOutOfRangeException exception];

	if ((uint64_t)length > _toRead)
		length = (size_t)_toRead;

	ret = [_decompressedStream readIntoBuffer: buffer
					   length: length];







|







749
750
751
752
753
754
755
756
757
758
759
760
761
762
763

	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_atEndOfStream)
		return 0;

	if (sizeof(length) >= sizeof(uint64_t) && length > UINT64_MAX)
		@throw [OFOutOfRangeException exception];

	if ((uint64_t)length > _toRead)
		length = (size_t)_toRead;

	ret = [_decompressedStream readIntoBuffer: buffer
					   length: length];
806
807
808
809
810
811
812

813
814
815
816
817
818
819
820

	[super dealloc];
}

- (void)lowlevelWriteBuffer: (const void *)buffer
		     length: (size_t)length
{

	if (length > INT64_MAX || INT64_MAX - _bytesWritten < (int64_t)length)
		@throw [OFOutOfRangeException exception];

	[_stream writeBuffer: buffer
		      length: length];

	_bytesWritten += (int64_t)length;
	_CRC32 = of_crc32(_CRC32, buffer, length);







>
|







806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821

	[super dealloc];
}

- (void)lowlevelWriteBuffer: (const void *)buffer
		     length: (size_t)length
{
	if ((sizeof(length) >= sizeof(int64_t) && length > INT64_MAX) ||
	    INT64_MAX - _bytesWritten < (int64_t)length)
		@throw [OFOutOfRangeException exception];

	[_stream writeBuffer: buffer
		      length: length];

	_bytesWritten += (int64_t)length;
	_CRC32 = of_crc32(_CRC32, buffer, length);