ObjFW  Check-in [6d765d0301]

Overview
Comment:Fix two FIXMEs in OFTCPSocket.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6d765d03011c814b63fcd7f0c795b513b5b892e2fdc7a0ba777f6e99db2b57fe
User & Date: js on 2008-12-11 13:56:14
Other Links: manifest | tags
Context
2008-12-11
14:06
Fix two more FIXMEs in OFTCPSocket; new exception. check-in: 85f7e202b1 user: js tags: trunk
13:56
Fix two FIXMEs in OFTCPSocket. check-in: 6d765d0301 user: js tags: trunk
13:53
Allow initialization without NItems for OFReadOrWriteFailedException. check-in: 5168142abe user: js tags: trunk
Changes

Modified src/OFTCPSocket.m from [8a2ef1e3cd] to [cbc64c1780].

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
	  intoBuffer: (uint8_t*)buf
{
	ssize_t ret;

	if (sock < 0) 
		@throw [OFNotConnectedException newWithObject: self];

	if ((ret = recv(sock, buf, size, 0)) < 0) {
		/* FIXME: Throw exception */
		return 0;
	}

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

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







|
|
|
<







205
206
207
208
209
210
211
212
213
214

215
216
217
218
219
220
221
	  intoBuffer: (uint8_t*)buf
{
	ssize_t ret;

	if (sock < 0) 
		@throw [OFNotConnectedException newWithObject: self];

	if ((ret = recv(sock, buf, size, 0)) < 0)
		@throw [OFReadFailedException newWithObject: self
						    andSize: size];


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

- (uint8_t*)readNBytes: (size_t)size
{
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
	   fromBuffer: (const uint8_t*)buf
{
	ssize_t ret;

	if (sock < 0) 
		@throw [OFNotConnectedException newWithObject: self];

	if ((ret = send(sock, buf, size, 0)) < 0) {
		/* FIXME: Throw exception */
		return 0;
	}

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

- (size_t)writeCString: (const char*)str
{







|
|
|
<







241
242
243
244
245
246
247
248
249
250

251
252
253
254
255
256
257
	   fromBuffer: (const uint8_t*)buf
{
	ssize_t ret;

	if (sock < 0) 
		@throw [OFNotConnectedException newWithObject: self];

	if ((ret = send(sock, buf, size, 0)) < 0)
		@throw [OFWriteFailedException newWithObject: self
						     andSize: size];


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

- (size_t)writeCString: (const char*)str
{