From 91925d70d901b180fffa1f40e0afafbc4b6c560e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Jan 2020 22:32:07 +0100 Subject: Clarify use of and need for mffs vs. ffs Backport of this xorg-xserver commit: commit 75c51c67b340548286efd41a53882e2acaf74ab5 Author: Alan Coopersmith Date: Thu Jun 18 09:49:12 2009 -0700 Clarify use of and need for mffs vs. ffs Signed-off-by: Alan Coopersmith --- nx-X11/programs/Xserver/os/WaitFor.c | 4 +++- nx-X11/programs/Xserver/os/connection.c | 2 +- nx-X11/programs/Xserver/os/osdep.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'nx-X11/programs/Xserver') diff --git a/nx-X11/programs/Xserver/os/WaitFor.c b/nx-X11/programs/Xserver/os/WaitFor.c index 3d53335b3..82462b926 100644 --- a/nx-X11/programs/Xserver/os/WaitFor.c +++ b/nx-X11/programs/Xserver/os/WaitFor.c @@ -106,6 +106,8 @@ static unsigned long startTimeInMillis; Windows in the code */ #define GetErrno() errno +/* like ffs, but uses fd_mask instead of int as argument, so it works + when fd_mask is longer than an int, such as common 64-bit platforms */ /* modifications by raphael */ int mffs(fd_mask mask) @@ -480,7 +482,7 @@ WaitForSomething(int *pClientsReady) { int client_index; - curclient = ffs (clientsReadable.fds_bits[i]) - 1; + curclient = mffs (clientsReadable.fds_bits[i]) - 1; client_index = /* raphael: modified */ ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))]; pClientsReady[nready++] = client_index; diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c index 8ebef9c33..4d30dd86f 100644 --- a/nx-X11/programs/Xserver/os/connection.c +++ b/nx-X11/programs/Xserver/os/connection.c @@ -908,7 +908,7 @@ CheckConnections(void) mask = AllClients.fds_bits[i]; while (mask) { - curoff = ffs (mask) - 1; + curoff = mffs (mask) - 1; curclient = curoff + (i * (sizeof(fd_mask)*8)); FD_ZERO(&tmask); FD_SET(curclient, &tmask); diff --git a/nx-X11/programs/Xserver/os/osdep.h b/nx-X11/programs/Xserver/os/osdep.h index 5985cfef2..e106c5544 100644 --- a/nx-X11/programs/Xserver/os/osdep.h +++ b/nx-X11/programs/Xserver/os/osdep.h @@ -218,7 +218,7 @@ extern OsCommPtr AvailableInput; extern WorkQueuePtr workQueue; -/* added by raphael */ +/* in WaitFor.c */ #define ffs mffs extern int mffs(fd_mask); -- cgit v1.2.3