ObjFW  Diff

Differences From Artifact [efdb457766]:

To Artifact [3dac29634e]:


231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
		@throw [OFNotConnectedException newWithClass: [self class]];

	if ((ret = recv(sock, (char*)buf, size, 0)) < 1)
		@throw [OFReadFailedException newWithClass: [self class]
						   andSize: size];

	/* This is safe, as we already checked < 1 */
	return ret;
}

- (uint8_t*)readNBytes: (size_t)size
{
	uint8_t *ret;

	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException newWithClass: [self class]];

	ret = [self getMemWithSize: size];

	@try {
		[self readNBytes: size
		      intoBuffer: ret];
	} @catch (id exception) {
		[self freeMem: ret];
		@throw exception;
	}

	return ret;
}

- (size_t)writeNBytes: (size_t)size
	   fromBuffer: (const uint8_t*)buf
{
	ssize_t ret;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







231
232
233
234
235
236
237




















238
239
240
241
242
243
244
		@throw [OFNotConnectedException newWithClass: [self class]];

	if ((ret = recv(sock, (char*)buf, size, 0)) < 1)
		@throw [OFReadFailedException newWithClass: [self class]
						   andSize: size];

	/* This is safe, as we already checked < 1 */




















	return ret;
}

- (size_t)writeNBytes: (size_t)size
	   fromBuffer: (const uint8_t*)buf
{
	ssize_t ret;