ObjFW  Check-in [a39a0d7bec]

Overview
Comment:Silence warnings about implicit float to int casts
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a39a0d7bec4f65d125ffd1813331fdd9b3e27a991c69adc47f10221097ea3a02
User & Date: js on 2012-10-09 22:02:40
Other Links: manifest | tags
Context
2012-10-10
10:16
Provide objc_constructInstance() when necessary. check-in: 16ba7ec477 user: js tags: trunk
2012-10-09
22:02
Silence warnings about implicit float to int casts check-in: a39a0d7bec user: js tags: trunk
21:57
Remove wrong byte swaps. check-in: 3f29426e99 user: js tags: trunk
Changes

Modified src/OFStreamObserver_kqueue.m from [daffa70891] to [8827a4d942].

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
- (BOOL)observeWithTimeout: (double)timeout
{
	void *pool = objc_autoreleasePoolPush();
	struct timespec timespec;
	struct kevent eventList[EVENTLIST_SIZE];
	int i, events, realEvents = 0;

	timespec.tv_sec = timeout;
	timespec.tv_nsec = (timeout - timespec.tv_sec) * 1000000000;

	[self OF_processQueue];

	if ([self OF_processCache]) {
		objc_autoreleasePoolPop(pool);
		return YES;
	}







|
|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
- (BOOL)observeWithTimeout: (double)timeout
{
	void *pool = objc_autoreleasePoolPush();
	struct timespec timespec;
	struct kevent eventList[EVENTLIST_SIZE];
	int i, events, realEvents = 0;

	timespec.tv_sec = (time_t)timeout;
	timespec.tv_nsec = (long)((timeout - timespec.tv_sec) * 1000000000);

	[self OF_processQueue];

	if ([self OF_processCache]) {
		objc_autoreleasePoolPop(pool);
		return YES;
	}

Modified src/OFStreamObserver_poll.m from [80446fffb3] to [ca9d956364].

140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

#ifdef OPEN_MAX
	if (nFDs > OPEN_MAX)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];
#endif

	if (poll(FDsCArray, (nfds_t)nFDs,
	    (timeout != -1 ? timeout * 1000 : -1)) < 1)
		return NO;

	for (i = 0; i < nFDs; i++) {
		pool = objc_autoreleasePoolPush();

		if (FDsCArray[i].revents & POLLIN) {
			if (FDsCArray[i].fd == cancelFD[0]) {







|







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

#ifdef OPEN_MAX
	if (nFDs > OPEN_MAX)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];
#endif

	if (poll(FDsCArray, (nfds_t)nFDs,
	    (int)(timeout != -1 ? timeout * 1000 : -1)) < 1)
		return NO;

	for (i = 0; i < nFDs; i++) {
		pool = objc_autoreleasePoolPush();

		if (FDsCArray[i].revents & POLLIN) {
			if (FDsCArray[i].fd == cancelFD[0]) {

Modified src/OFStreamObserver_select.m from [499369cb3d] to [66f75ef514].

94
95
96
97
98
99
100






101
102
103
104
105
106
107
108
109
	FD_COPY(&exceptFDs, &exceptFDs_);
#else
	readFDs_ = readFDs;
	writeFDs_ = writeFDs;
	exceptFDs_ = exceptFDs;
#endif







	time.tv_sec = timeout;
	time.tv_usec = (timeout - time.tv_sec) * 1000;

	if (select((int)maxFD + 1, &readFDs_, &writeFDs_, &exceptFDs_,
	    (timeout != -1 ? &time : NULL)) < 1)
		return NO;

	if (FD_ISSET(cancelFD[0], &readFDs_)) {
		char buffer;







>
>
>
>
>
>
|
|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
	FD_COPY(&exceptFDs, &exceptFDs_);
#else
	readFDs_ = readFDs;
	writeFDs_ = writeFDs;
	exceptFDs_ = exceptFDs;
#endif

	/*
	 * We cast to int before assigning to tv_usec in order to avoid a
	 * warning with Apple GCC on PPC. POSIX defines this as suseconds_t,
	 * however, this is not available on Win32. As an int should always
	 * satisfy the required range, we just cast to int.
	 */
	time.tv_sec = (time_t)timeout;
	time.tv_usec = (int)((timeout - time.tv_sec) * 1000);

	if (select((int)maxFD + 1, &readFDs_, &writeFDs_, &exceptFDs_,
	    (timeout != -1 ? &time : NULL)) < 1)
		return NO;

	if (FD_ISSET(cancelFD[0], &readFDs_)) {
		char buffer;