ObjFW  Check-in [96f3ab8477]

Overview
Comment:Fix -[OFGZIPStream isAtEndOfStream]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 96f3ab847788a43ae5d250c9ca2b1bbdbdbfc1d0ea2ecd60a9ee52798eee25df
User & Date: js on 2024-03-04 01:07:30
Other Links: manifest | tags
Context
2024-03-04
01:21
Rename schemes for archive IRI handlers back check-in: 34a3e817b3 user: js tags: trunk
01:07
Fix -[OFGZIPStream isAtEndOfStream] check-in: d1e7172eff user: js tags: 1.0
01:07
Fix -[OFGZIPStream isAtEndOfStream] check-in: 96f3ab8477 user: js tags: trunk
00:43
Fix -[OFHTTPClientResponse isAtEndOfStream] check-in: 3ef01bd2d5 user: js tags: trunk
Changes

Modified src/OFGZIPStream.m from [446ae4ffb6] to [68192b71aa].

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)lowlevelHasDataInReadBuffer
{
	if (_state == OFGZIPStreamStateData)
		return _inflateStream.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)lowlevelHasDataInReadBuffer
{
	if (_state == OFGZIPStreamStateData)
		return _inflateStream.hasDataInReadBuffer;