ObjFW  Check-in [d1e7172eff]

Overview
Comment:Fix -[OFGZIPStream isAtEndOfStream]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.0
Files: files | file ages | folders
SHA3-256: d1e7172eff3daacdcb2543e9d100f6842ede9f2bbdf22dd82876d59aa15d5c31
User & Date: js on 2024-03-04 01:07:46
Other Links: branch diff | manifest | tags
Context
2024-03-09
16:13
OFZIPArchive: Fix disk number 0 vs 1 check-in: 3fc6209af6 user: js tags: 1.0
2024-03-04
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: 0d804ed391 user: js tags: 1.0
Changes

Modified src/OFGZIPStream.m from [abd233b804] to [2fbc571652].

77
78
79
80
81
82
83






84

85
86
87
88
89
90
91
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 (_stream.atEndOfStream) {
		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
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 ||