ObjFW  Diff

Differences From Artifact [7f75898f5a]:

To Artifact [f365c42bc2]:


79
80
81
82
83
84
85
86

87
88
89
90
91
92
93
79
80
81
82
83
84
85

86
87
88
89
90
91
92
93







-
+







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

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

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

			return 0;
		}

		switch (_state) {
235
236
237
238
239
240
241
242

243
244
245
246
247
248
249
235
236
237
238
239
240
241

242
243
244
245
246
247
248
249







-
+







			_state++;
			break;
		case OF_GZIP_STREAM_DATA:
			if (_inflateStream == nil)
				_inflateStream = [[OFInflateStream alloc]
				    initWithStream: _stream];

			if (![_inflateStream isAtEndOfStream]) {
			if (!_inflateStream.atEndOfStream) {
				size_t bytesRead = [_inflateStream
				    readIntoBuffer: buffer
					    length: length];

				_CRC32 = of_crc32(_CRC32, buffer, bytesRead);
				_uncompressedSize += bytesRead;

305
306
307
308
309
310
311
312

313
314
315
316
317
318
319


320
321

322
323
324
325
326
327
328
329
330
331
305
306
307
308
309
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];

	return [_stream isAtEndOfStream];
	return _stream.atEndOfStream;
}

- (bool)hasDataInReadBuffer
{
	if (_state == OF_GZIP_STREAM_DATA)
		return ([super hasDataInReadBuffer] ||
		    [_inflateStream hasDataInReadBuffer]);
		return (super.hasDataInReadBuffer ||
		    _inflateStream.hasDataInReadBuffer);

	return ([super hasDataInReadBuffer] || [_stream hasDataInReadBuffer]);
	return (super.hasDataInReadBuffer || _stream.hasDataInReadBuffer);
}

- (void)close
{
	[_stream release];
	_stream = nil;

	[super close];
}
@end