ObjFW  Diff

Differences From Artifact [f82daa6eae]:

To Artifact [f074dafa32]:


787
788
789
790
791
792
793

794

795

796
797
798
799
800
801
802
787
788
789
790
791
792
793
794

795
796
797
798
799
800
801
802
803
804







+
-
+

+








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

	if (_atEndOfStream)
		return 0;

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

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

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

846
847
848
849
850
851
852

853
854





855
856
857
858
859
860
861
848
849
850
851
852
853
854
855


856
857
858
859
860
861
862
863
864
865
866
867







+
-
-
+
+
+
+
+







}

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

#if SIZE_MAX >= INT64_MAX
	if ((sizeof(length) >= sizeof(int64_t) && length > INT64_MAX) ||
	    INT64_MAX - _bytesWritten < (int64_t)length)
	if (length > INT64_MAX)
		@throw [OFOutOfRangeException exception];
#endif

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

	bytesWritten = [_stream writeBuffer: buffer
				     length: length];

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