From 09fac3deea3d74ca283f0a7109e4b190cdf97d95 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sat, 17 Jul 2021 11:11:14 +0100 Subject: mingw: update select(2) to latest gnulib version --- win32/select.c | 54 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/win32/select.c b/win32/select.c index 2c9d2d873..2be221ac8 100644 --- a/win32/select.c +++ b/win32/select.c @@ -1,30 +1,33 @@ /* Emulation for select(2) Contributed by Paolo Bonzini. - Copyright 2008-2015 Free Software Foundation, Inc. + Copyright 2008-2021 Free Software Foundation, Inc. This file is part of gnulib. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, see . */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include "libbb.h" -#include -#include -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* Specification. */ +#include + +#if defined _WIN32 && ! defined __CYGWIN__ /* Native Windows. */ +#include +#include #include #include #include @@ -37,10 +40,25 @@ #include /* Get the overridden 'struct timeval'. */ -#include #undef select +/* Don't assume that UNICODE is not defined. */ +#undef GetModuleHandle +#define GetModuleHandle GetModuleHandleA +#undef PeekConsoleInput +#define PeekConsoleInput PeekConsoleInputA +#undef CreateEvent +#define CreateEvent CreateEventA +#undef PeekMessage +#define PeekMessage PeekMessageA +#undef DispatchMessage +#define DispatchMessage DispatchMessageA + +/* Avoid warnings from gcc -Wcast-function-type. */ +#define GetProcAddress \ + (void *) GetProcAddress + struct bitset { unsigned char in[FD_SETSIZE / CHAR_BIT]; unsigned char out[FD_SETSIZE / CHAR_BIT]; @@ -506,12 +524,13 @@ restart: if (h != handle_array[nhandles]) { /* Perform handle->descriptor mapping. */ - WSAEventSelect ((SOCKET) h, NULL, 0); - if (FD_ISSET (h, &handle_rfds)) + SOCKET s = (SOCKET) h; + WSAEventSelect (s, NULL, 0); + if (FD_ISSET (s, &handle_rfds)) FD_SET (i, rfds); - if (FD_ISSET (h, &handle_wfds)) + if (FD_ISSET (s, &handle_wfds)) FD_SET (i, wfds); - if (FD_ISSET (h, &handle_xfds)) + if (FD_ISSET (s, &handle_xfds)) FD_SET (i, xfds); } else @@ -532,7 +551,6 @@ restart: #else /* ! Native Windows. */ -#include #include /* NULL */ #include #include -- cgit v1.2.3-55-g6feb