ObjFW  Check-in [57f51f7341]

Overview
Comment:Don't compare to FD_SETSIZE.

FD_SETSIZE is _NOT_ the number of the last fd, but the maximum number of
fds to observe!

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 57f51f734104e1131ae09e455325728eaac8617400f1db8a3f9233ff4e0958a6
User & Date: js on 2011-04-06 19:53:11
Other Links: manifest | tags
Context
2011-04-06
20:07
Port recent OFStreamObserver changes to Win32. check-in: a10390bfd6 user: js tags: trunk
19:53
Don't compare to FD_SETSIZE. check-in: 57f51f7341 user: js tags: trunk
18:35
This ivar does not need to be @public anymore as well. check-in: d9c7249304 user: js tags: trunk
Changes

Modified src/OFStreamObserver.m from [c4fa7336ee] to [b5be6cde87].

178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#else
- (void)_addStream: (OFStream*)stream
	 withFDSet: (fd_set*)fdset
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	int fd = [stream fileDescriptor];

	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException newWithClass: isa];

	FD_SET(fd, fdset);
	FD_SET(fd, &exceptfds);

	if (fd >= nfds)
		nfds = fd + 1;

	[pool release];
}

- (void)_removeStream: (OFStream*)stream
	    withFDSet: (fd_set*)fdset
	   otherFDSet: (fd_set*)other_fdset
{
	int fd = [stream fileDescriptor];

	if (fd >= FD_SETSIZE)
		@throw [OFOutOfRangeException newWithClass: isa];

	FD_CLR(fd, fdset);

	if (!FD_ISSET(fd, other_fdset))
		FD_CLR(fd, &exceptfds);
}
#endif








<
<
<















<
<
<







178
179
180
181
182
183
184



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199



200
201
202
203
204
205
206
#else
- (void)_addStream: (OFStream*)stream
	 withFDSet: (fd_set*)fdset
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	int fd = [stream fileDescriptor];




	FD_SET(fd, fdset);
	FD_SET(fd, &exceptfds);

	if (fd >= nfds)
		nfds = fd + 1;

	[pool release];
}

- (void)_removeStream: (OFStream*)stream
	    withFDSet: (fd_set*)fdset
	   otherFDSet: (fd_set*)other_fdset
{
	int fd = [stream fileDescriptor];




	FD_CLR(fd, fdset);

	if (!FD_ISSET(fd, other_fdset))
		FD_CLR(fd, &exceptfds);
}
#endif