ObjFW  Check-in [3cd42fa72d]

Overview
Comment:OFKernelEventObserver_select: Check range of fd
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3cd42fa72d92d63f8faca92264b9486064706342045496c6477be69e561a1c7d
User & Date: js on 2015-01-19 22:44:57
Other Links: manifest | tags
Context
2015-01-20
19:38
tests: Class and category name consistency check-in: ea500c31be user: js tags: trunk
2015-01-19
22:44
OFKernelEventObserver_select: Check range of fd check-in: 3cd42fa72d user: js tags: trunk
22:29
OFStream: writeBufferEnabled -> writeBuffered check-in: afb42d363d user: js tags: trunk
Changes

Modified src/OFKernelEventObserver_select.m from [61b8cbcd77] to [905345cfde].

24
25
26
27
28
29
30


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47



48
49
50
51
52



53
54
55
56
57



58
59
60
61
62



63
64
65
66
67
68
69
#include <sys/time.h>

#import "OFKernelEventObserver.h"
#import "OFKernelEventObserver+Private.h"
#import "OFKernelEventObserver_select.h"
#import "OFArray.h"



#import "socket_helpers.h"

@implementation OFKernelEventObserver_select
- init
{
	self = [super init];

	FD_ZERO(&_readFDs);
	FD_ZERO(&_writeFDs);

	FD_SET(_cancelFD[0], &_readFDs);

	return self;
}

- (void)OF_addFileDescriptorForReading: (int)fd
{



	FD_SET(fd, &_readFDs);
}

- (void)OF_addFileDescriptorForWriting: (int)fd
{



	FD_SET(fd, &_writeFDs);
}

- (void)OF_removeFileDescriptorForReading: (int)fd
{



	FD_CLR(fd, &_readFDs);
}

- (void)OF_removeFileDescriptorForWriting: (int)fd
{



	FD_CLR(fd, &_writeFDs);
}

- (bool)observeForTimeInterval: (of_time_interval_t)timeInterval
{
	void *pool = objc_autoreleasePoolPush();
	id const *objects;







>
>

















>
>
>





>
>
>





>
>
>





>
>
>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <sys/time.h>

#import "OFKernelEventObserver.h"
#import "OFKernelEventObserver+Private.h"
#import "OFKernelEventObserver_select.h"
#import "OFArray.h"

#import "OFOutOfRangeException.h"

#import "socket_helpers.h"

@implementation OFKernelEventObserver_select
- init
{
	self = [super init];

	FD_ZERO(&_readFDs);
	FD_ZERO(&_writeFDs);

	FD_SET(_cancelFD[0], &_readFDs);

	return self;
}

- (void)OF_addFileDescriptorForReading: (int)fd
{
	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException exception];

	FD_SET(fd, &_readFDs);
}

- (void)OF_addFileDescriptorForWriting: (int)fd
{
	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException exception];

	FD_SET(fd, &_writeFDs);
}

- (void)OF_removeFileDescriptorForReading: (int)fd
{
	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException exception];

	FD_CLR(fd, &_readFDs);
}

- (void)OF_removeFileDescriptorForWriting: (int)fd
{
	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException exception];

	FD_CLR(fd, &_writeFDs);
}

- (bool)observeForTimeInterval: (of_time_interval_t)timeInterval
{
	void *pool = objc_autoreleasePoolPush();
	id const *objects;