From: Roger Meier Date: Tue, 17 Jan 2012 12:25:22 +0000 (+0000) Subject: THRIFT-1490 Windows-specific header files - fixes & tweaks X-Git-Tag: 0.9.1~469 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=4749b4f66ef56aa7729e694d5d78feeedf827f61;p=common%2Fthrift.git THRIFT-1490 Windows-specific header files - fixes & tweaks Patch: Peace C git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1232397 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/cpp/src/windows/TargetVersion.h b/lib/cpp/src/windows/TargetVersion.h index c8498b13..8c392fc4 100644 --- a/lib/cpp/src/windows/TargetVersion.h +++ b/lib/cpp/src/windows/TargetVersion.h @@ -28,9 +28,8 @@ #error This is a MSVC header only. #endif -#include - +#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0601 -#include +#endif #endif //_THIRFT_WINDOWS_TARGETVERSION_H_ diff --git a/lib/cpp/src/windows/config.h b/lib/cpp/src/windows/config.h index 95a5676e..79168cf2 100644 --- a/lib/cpp/src/windows/config.h +++ b/lib/cpp/src/windows/config.h @@ -30,8 +30,6 @@ #pragma warning(disable: 4996) // Depreciated posix name. #pragma warning(disable: 4250) // Inherits via dominance. -#pragma warning(disable: 4244) // conversion from '...' to '...', possible loss of data. -#pragma warning(disable: 4267) // conversion from '...' to '...', possible loss of data. #define VERSION "0.9.0-dev" #define HAVE_GETTIMEOFDAY 1 @@ -84,7 +82,15 @@ inline int sleep(DWORD ms) #define poll(fds, nfds, timeout) \ poll_win32(fds, nfds, timeout) -inline int poll_win32(LPWSAPOLLFD fdArray, ULONG fds, INT timeout) +typedef struct pollfd { + + SOCKET fd; + SHORT events; + SHORT revents; + +} WSAPOLLFD, *PWSAPOLLFD, FAR *LPWSAPOLLFD; + +inline int poll_win32(LPWSAPOLLFD fdArray, ULONG /*fds*/, INT timeout) { fd_set read_fds; fd_set write_fds; @@ -98,7 +104,7 @@ inline int poll_win32(LPWSAPOLLFD fdArray, ULONG fds, INT timeout) FD_SET(fdArray[0].fd, &write_fds); FD_SET(fdArray[0].fd, &except_fds); - timeval time_out = {timeout * 0.001, timeout * 1000}; + timeval time_out = {timeout / 1000, timeout * 1000}; return select(1, &read_fds, &write_fds, &except_fds, &time_out); } #else