ObjFW  Diff

Differences From Artifact [9e8fe0a5ac]:

To Artifact [815f2dd728]:


657
658
659
660
661
662
663
664

665
666
667


668
669
670
671
672
673
674
657
658
659
660
661
662
663

664



665
666
667
668
669
670
671
672
673







-
+
-
-
-
+
+







			if OF_UNLIKELY (_readBuffer[i] == '\n' ||
			    _readBuffer[i] == '\0') {
				retLength = i;

				if (i > 0 && _readBuffer[i - 1] == '\r')
					retLength--;

				ret = [OFString
				ret = [OFString stringWithCString: _readBuffer
				    stringWithCString: (char *)_readBuffer
					     encoding: encoding
					       length: retLength];
							 encoding: encoding
							   length: retLength];

				_readBuffer += i + 1;
				_readBufferLength -= i + 1;

				_waitingForDelimiter = false;
				return ret;
			}
687
688
689
690
691
692
693
694

695
696
697
698
699
700
701
686
687
688
689
690
691
692

693
694
695
696
697
698
699
700







-
+







			}

			retLength = _readBufferLength;

			if (retLength > 0 && _readBuffer[retLength - 1] == '\r')
				retLength--;

			ret = [OFString stringWithCString: (char *)_readBuffer
			ret = [OFString stringWithCString: _readBuffer
						 encoding: encoding
						   length: retLength];

			[self freeMemory: _readBufferMemory];
			_readBuffer = _readBufferMemory = NULL;
			_readBufferLength = 0;

882
883
884
885
886
887
888
889

890
891
892
893
894
895
896
881
882
883
884
885
886
887

888
889
890
891
892
893
894
895







-
+







				j = 0;

			if (j == delimiterLength || _readBuffer[i] == '\0') {
				if (_readBuffer[i] == '\0')
					delimiterLength = 1;

				ret = [OFString
				    stringWithCString: (char *)_readBuffer
				    stringWithCString: _readBuffer
					     encoding: encoding
					      length: i + 1 - delimiterLength];

				_readBuffer += i + 1;
				_readBufferLength -= i + 1;

				_waitingForDelimiter = false;
906
907
908
909
910
911
912
913

914
915
916
917
918
919
920
905
906
907
908
909
910
911

912
913
914
915
916
917
918
919







-
+







	@try {
		if ([self lowlevelIsAtEndOfStream]) {
			if (_readBuffer == NULL) {
				_waitingForDelimiter = false;
				return nil;
			}

			ret = [OFString stringWithCString: (char *)_readBuffer
			ret = [OFString stringWithCString: _readBuffer
						 encoding: encoding
						   length: _readBufferLength];

			[self freeMemory: _readBufferMemory];
			_readBuffer = _readBufferMemory = NULL;
			_readBufferLength = 0;

1036
1037
1038
1039
1040
1041
1042
1043

1044
1045
1046
1047
1048
1049
1050
1035
1036
1037
1038
1039
1040
1041

1042
1043
1044
1045
1046
1047
1048
1049







-
+







}

- (void)flushWriteBuffer
{
	if (_writeBuffer == NULL)
		return;

	[self lowlevelWriteBuffer: (char *)_writeBuffer
	[self lowlevelWriteBuffer: _writeBuffer
			   length: _writeBufferLength];

	[self freeMemory: _writeBuffer];
	_writeBuffer = NULL;
	_writeBufferLength = 0;
}