Overview
Comment: | OFKernelEventObserver_select: Ensure fd >= 0 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a54a47a4c331193622188a5eae548de7 |
User & Date: | js on 2015-05-16 15:16:11 |
Other Links: | manifest | tags |
Context
2015-05-16
| ||
18:28 | OFKernelEventObserver_poll: Exception -> assert check-in: 13d72034ed user: js tags: trunk | |
15:16 | OFKernelEventObserver_select: Ensure fd >= 0 check-in: a54a47a4c3 user: js tags: trunk | |
12:44 | configure: Go back to using -std=gnu* check-in: 989363c9fd user: js tags: trunk | |
Changes
Modified src/OFKernelEventObserver_select.m from [331bf675cd] to [69ccd8df63].
︙ | ︙ | |||
59 60 61 62 63 64 65 | return self; } - (void)OF_addObjectForReading: (id)object { int fd = [object fileDescriptorForReading]; | | | | | | 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | return self; } - (void)OF_addObjectForReading: (id)object { int fd = [object fileDescriptorForReading]; if (fd < 0 || fd > INT_MAX - 1) @throw [OFOutOfRangeException exception]; #ifndef _WIN32 if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif if (fd > _maxFD) _maxFD = fd; FD_SET(fd, &_readFDs); } - (void)OF_addObjectForWriting: (id)object { int fd = [object fileDescriptorForWriting]; if (fd < 0 || fd > INT_MAX - 1) @throw [OFOutOfRangeException exception]; #ifndef _WIN32 if (fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; #endif if (fd > _maxFD) _maxFD = fd; FD_SET(fd, &_writeFDs); } - (void)OF_removeObjectForReading: (id)object { /* TODO: Adjust _maxFD */ int fd = [object fileDescriptorForReading]; if (fd < 0 || fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; FD_CLR(fd, &_readFDs); } - (void)OF_removeObjectForWriting: (id)object { /* TODO: Adjust _maxFD */ int fd = [object fileDescriptorForWriting]; if (fd < 0 || fd >= FD_SETSIZE) @throw [OFOutOfRangeException exception]; FD_CLR(fd, &_writeFDs); } - (void)observeForTimeInterval: (of_time_interval_t)timeInterval { |
︙ | ︙ | |||
173 174 175 176 177 178 179 | #endif } objects = [_readObjects objects]; count = [_readObjects count]; for (i = 0; i < count; i++) { | | > | > | 173 174 175 176 177 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 | #endif } objects = [_readObjects objects]; count = [_readObjects count]; for (i = 0; i < count; i++) { int fd; pool = objc_autoreleasePoolPush(); fd = [objects[i] fileDescriptorForReading]; if (FD_ISSET(fd, &readFDs) && [_delegate respondsToSelector: @selector(objectIsReadyForReading:)]) [_delegate objectIsReadyForReading: objects[i]]; objc_autoreleasePoolPop(pool); } objects = [_writeObjects objects]; count = [_writeObjects count]; for (i = 0; i < count; i++) { int fd; pool = objc_autoreleasePoolPush(); fd = [objects[i] fileDescriptorForWriting]; if (FD_ISSET(fd, &writeFDs) && [_delegate respondsToSelector: @selector(objectIsReadyForWriting:)]) [_delegate objectIsReadyForWriting: objects[i]]; objc_autoreleasePoolPop(pool); } } @end |