ObjFW  Check-in [fd9801229f]

Overview
Comment:Deflate & LHA: Return buffer to stream on close
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fd9801229f2a8c5f5fd0ee510c091c47edecf5c9c7b5f8d2baa364f8b68e0f56
User & Date: js on 2018-06-06 21:55:45
Other Links: manifest | tags
Context
2018-06-09
14:36
OFInflate64Stream: Don't subclass OFInflateStream check-in: 1b5d3ac8af user: js tags: trunk
2018-06-06
21:55
Deflate & LHA: Return buffer to stream on close check-in: fd9801229f user: js tags: trunk
21:36
.travis.yml: Disable devkitPro-based builds check-in: 1d154b247f user: js tags: trunk
Changes

Modified src/OFInflateStream.m from [2f25e4e657] to [e6df60b73e].

242
243
244
245
246
247
248

249
250
251
252
253
254
255
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256







+







start:
	switch ((enum state)_state) {
	case BLOCK_HEADER:
		if OF_UNLIKELY (_inLastBlock) {
			[_stream unreadFromBuffer: _buffer + _bufferIndex
					   length: _bufferLength -
						   _bufferIndex];
			_bufferIndex = _bufferLength = 0;

			_atEndOfStream = true;
			return bytesWritten;
		}

		if OF_UNLIKELY (!tryReadBits(self, &bits, 3))
			return bytesWritten;
673
674
675
676
677
678
679





680
681
682
683
684
685
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691







+
+
+
+
+






{
	return ([super hasDataInReadBuffer] || [_stream hasDataInReadBuffer]);
}
#endif

- (void)close
{
	/* Give back our buffer to the stream, in case it's shared */
	[_stream unreadFromBuffer: _buffer + _bufferIndex
			   length: _bufferLength - _bufferIndex];
	_bufferIndex = _bufferLength = 0;

	[_stream release];
	_stream = nil;

	[super close];
}
@end

Modified src/OFLHAArchive.m from [19e9187eb0] to [a7a157c7cf].

688
689
690
691
692
693
694





695
696
697
698
699
700
701
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706







+
+
+
+
+








	return ([_stream isAtEndOfStream] &&
	    _bufferLength - _bufferIndex == 0 && _state == STATE_BLOCK_HEADER);
}

- (void)close
{
	/* Give back our buffer to the stream, in case it's shared */
	[_stream unreadFromBuffer: _buffer + _bufferIndex
			   length: _bufferLength - _bufferIndex];
	_bufferIndex = _bufferLength = 0;

	[_stream release];
	_stream = nil;

	[super close];
}
@end