diff --git a/lib/common/WaitForEvent.cpp b/lib/common/WaitForEvent.cpp index 5646bfbf3..b0422cd46 100644 --- a/lib/common/WaitForEvent.cpp +++ b/lib/common/WaitForEvent.cpp @@ -141,7 +141,8 @@ void *WaitForEvent::Wait() if(mpPollInfo == 0) { // Yes... - mpPollInfo = (struct pollfd *)::malloc((sizeof(struct pollfd) * mItems.size()) + 4); + mpPollInfo = (EMU_STRUCT_POLLFD *)::malloc( + (sizeof(EMU_STRUCT_POLLFD) * mItems.size()) + 4); if(mpPollInfo == 0) { throw std::bad_alloc(); diff --git a/lib/common/WaitForEvent.h b/lib/common/WaitForEvent.h index a80761efd..4077748bd 100644 --- a/lib/common/WaitForEvent.h +++ b/lib/common/WaitForEvent.h @@ -141,7 +141,7 @@ class WaitForEvent #else int mTimeout; std::vector mItems; - struct pollfd *mpPollInfo; + EMU_STRUCT_POLLFD *mpPollInfo; #endif }; diff --git a/lib/server/SocketListen.h b/lib/server/SocketListen.h index 39fe7e240..36712f075 100644 --- a/lib/server/SocketListen.h +++ b/lib/server/SocketListen.h @@ -231,7 +231,7 @@ class SocketListen } // poll this socket - struct pollfd p; + EMU_STRUCT_POLLFD p; p.fd = mSocketHandle; p.events = POLLIN; p.revents = 0; diff --git a/lib/server/SocketStream.cpp b/lib/server/SocketStream.cpp index edb5e5b89..6152ec7d0 100644 --- a/lib/server/SocketStream.cpp +++ b/lib/server/SocketStream.cpp @@ -228,7 +228,7 @@ int SocketStream::Read(void *pBuffer, int NBytes, int Timeout) if(Timeout != IOStream::TimeOutInfinite) { - struct pollfd p; + EMU_STRUCT_POLLFD p; p.fd = mSocketHandle; p.events = POLLIN; p.revents = 0; @@ -295,7 +295,7 @@ int SocketStream::Read(void *pBuffer, int NBytes, int Timeout) bool SocketStream::Poll(short Events, int Timeout) { // Wait for data to send. - struct pollfd p; + EMU_STRUCT_POLLFD p; p.fd = GetSocketHandle(); p.events = Events; p.revents = 0; diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp index 0c8caf7d6..66ab85016 100644 --- a/lib/win32/emu.cpp +++ b/lib/win32/emu.cpp @@ -1234,7 +1234,7 @@ int closedir(DIR *dp) // Created: 25th October 2004 // // -------------------------------------------------------------------------- -int poll (struct pollfd *ufds, unsigned long nfds, int timeout) +int poll(EMU_STRUCT_POLLFD *ufds, unsigned long nfds, int timeout) { try { @@ -1259,7 +1259,7 @@ int poll (struct pollfd *ufds, unsigned long nfds, int timeout) for (unsigned long i = 0; i < nfds; i++) { - struct pollfd* ufd = &(ufds[i]); + EMU_STRUCT_POLLFD* ufd = &(ufds[i]); if (ufd->events & POLLIN) { @@ -1285,7 +1285,7 @@ int poll (struct pollfd *ufds, unsigned long nfds, int timeout) { // int errval = WSAGetLastError(); - struct pollfd* pufd = ufds; + EMU_STRUCT_POLLFD* pufd = ufds; for (unsigned long i = 0; i < nfds; i++) { pufd->revents = POLLERR; @@ -1297,7 +1297,7 @@ int poll (struct pollfd *ufds, unsigned long nfds, int timeout) { for (unsigned long i = 0; i < nfds; i++) { - struct pollfd *ufd = &(ufds[i]); + EMU_STRUCT_POLLFD *ufd = &(ufds[i]); if (FD_ISSET(ufd->fd, &readfd)) { diff --git a/lib/win32/emu.h b/lib/win32/emu.h index d2d8cef5e..bdf12aea5 100644 --- a/lib/win32/emu.h +++ b/lib/win32/emu.h @@ -10,6 +10,7 @@ #ifdef WIN32 #define EMU_STRUCT_STAT struct emu_stat + #define EMU_STRUCT_POLLFD struct emu_pollfd #define EMU_STAT emu_stat #define EMU_FSTAT emu_fstat #define EMU_LSTAT emu_stat @@ -17,6 +18,7 @@ #define EMU_UNLINK emu_unlink #else #define EMU_STRUCT_STAT struct stat + #define EMU_STRUCT_POLLFD struct pollfd #define EMU_STAT ::stat #define EMU_FSTAT ::fstat #define EMU_LSTAT ::lstat @@ -320,7 +322,7 @@ extern "C" inline unsigned int sleep(unsigned int secs) #define SHUT_RD SD_RECEIVE #define SHUT_WR SD_SEND -struct pollfd +EMU_STRUCT_POLLFD { SOCKET fd; short int events; @@ -397,7 +399,7 @@ int emu_rename (const char* pOldName, const char* pNewName); int statfs(const char * name, struct statfs * s); -int poll(struct pollfd *ufds, unsigned long nfds, int timeout); +int poll(EMU_STRUCT_POLLFD *ufds, unsigned long nfds, int timeout); struct iovec { void *iov_base; /* Starting address */ diff --git a/lib/win32/emu_winver.h b/lib/win32/emu_winver.h index 92060150f..4a7e90746 100644 --- a/lib/win32/emu_winver.h +++ b/lib/win32/emu_winver.h @@ -11,10 +11,6 @@ // We need WINVER at least 0x0500 to use GetFileSizeEx on Cygwin/MinGW, // and 0x0501 for FindFirstFile(W) for opendir/readdir. -// -// WIN32_WINNT versions 0x0600 (Vista) and higher enable WSAPoll() in -// winsock2.h, whose struct pollfd conflicts with ours below, so for -// now we just set it lower than that, to Windows XP (0x0501). #ifdef WINVER # if WINVER != 0x0501 @@ -26,12 +22,12 @@ #define WINVER 0x0501 #ifdef _WIN32_WINNT -# if _WIN32_WINNT != 0x0501 +# if _WIN32_WINNT != 0x0600 // provoke a redefinition warning to track down the offender -# define _WIN32_WINNT 0x0501 +# define _WIN32_WINNT 0x0600 # error Must include emu.h before setting _WIN32_WINNT # endif #endif -#define _WIN32_WINNT 0x0501 +#define _WIN32_WINNT 0x0600 #endif // _EMU_WINVER_H