ObjFW  Diff

Differences From Artifact [0671a78655]:

To Artifact [7e32841415]:


123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{
	if (_readBufferLength > 0)
		return false;

	return [self lowlevelIsAtEndOfStream];
}

- (size_t)readIntoBuffer: (void *)buffer
		  length: (size_t)length
{
	if (_readBufferLength == 0) {
		/*
		 * For small sizes, it is cheaper to read more and cache the
		 * remainder - even if that means more copying of data - than
		 * to do a syscall for every read.
		 */







|
<







123
124
125
126
127
128
129
130

131
132
133
134
135
136
137
{
	if (_readBufferLength > 0)
		return false;

	return [self lowlevelIsAtEndOfStream];
}

- (size_t)readIntoBuffer: (void *)buffer length: (size_t)length

{
	if (_readBufferLength == 0) {
		/*
		 * For small sizes, it is cheaper to read more and cache the
		 * remainder - even if that means more copying of data - than
		 * to do a syscall for every read.
		 */
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
			[data addItems: buffer count: length];
		}
	} @finally {
		free(buffer);
	}

	[data makeImmutable];

	return data;
}

- (OFString *)readStringWithLength: (size_t)length
{
	return [self readStringWithLength: length
				 encoding: OF_STRING_ENCODING_UTF_8];







<







612
613
614
615
616
617
618

619
620
621
622
623
624
625
			[data addItems: buffer count: length];
		}
	} @finally {
		free(buffer);
	}

	[data makeImmutable];

	return data;
}

- (OFString *)readStringWithLength: (size_t)length
{
	return [self readStringWithLength: length
				 encoding: OF_STRING_ENCODING_UTF_8];