ObjFW  Diff

Differences From Artifact [abd233b804]:

To Artifact [2fbc571652]:


77
78
79
80
81
82
83






84
85
86
87
88
89
90
91
	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	for (;;) {
		uint8_t byte;
		uint32_t CRC32, uncompressedSize;







		if (_stream.atEndOfStream) {
			if (_state != OFGZIPStreamStateID1)
				@throw [OFTruncatedDataException exception];

			return 0;
		}

		switch (_state) {







>
>
>
>
>
>
|







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	for (;;) {
		uint8_t byte;
		uint32_t CRC32, uncompressedSize;

		/*
		 * The inflate stream might have overread, causing _stream to
		 * be at the end, but the inflate stream will unread it once it
		 * has reached the end. Hence only check it if the state is not
		 * OFGZIPStreamStateData.
		 */
		if (_state != OFGZIPStreamStateData && _stream.atEndOfStream) {
			if (_state != OFGZIPStreamStateID1)
				@throw [OFTruncatedDataException exception];

			return 0;
		}

		switch (_state) {
304
305
306
307
308
309
310








311
312
313
314
315
316
317
}

- (bool)lowlevelIsAtEndOfStream
{
	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];









	return _stream.atEndOfStream;
}

- (bool)hasDataInReadBuffer
{
	if (_state == OFGZIPStreamStateData)
		return (super.hasDataInReadBuffer ||







>
>
>
>
>
>
>
>







310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
}

- (bool)lowlevelIsAtEndOfStream
{
	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	/*
	 * The inflate stream might have overread, causing _stream to be at the
	 * end, but the inflate stream will unread it once it has reached the
	 * end.
	 */
	if (_state == OFGZIPStreamStateData && !_inflateStream.atEndOfStream)
		return false;

	return _stream.atEndOfStream;
}

- (bool)hasDataInReadBuffer
{
	if (_state == OFGZIPStreamStateData)
		return (super.hasDataInReadBuffer ||