This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 47d4a00  Deprecated WinXP and Server2003 methods Client: cpp Patch: 
Mario Emmenlauer
47d4a00 is described below

commit 47d4a00f51de56d409fe016c5aa78d763128cbca
Author: Mario Emmenlauer <[email protected]>
AuthorDate: Thu May 21 19:45:48 2020 +0200

    Deprecated WinXP and Server2003 methods
    Client: cpp
    Patch: Mario Emmenlauer
    
    This closes #2165
---
 CHANGES.md                                    |  1 +
 lib/cpp/src/thrift/transport/PlatformSocket.h | 14 +++-----
 lib/cpp/src/thrift/windows/WinFcntl.cpp       | 51 ---------------------------
 lib/cpp/src/thrift/windows/WinFcntl.h         |  9 -----
 4 files changed, 5 insertions(+), 70 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index be0286a..65ed07f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -16,6 +16,7 @@
 - [THRIFT-5186](https://issues.apache.org/jira/browse/THRIFT-5186) - cpp: use 
all getaddrinfo() results when retrying failed bind() in 
T{Nonblocking,}ServerSocket
 - [THRIFT-5233](https://issues.apache.org/jira/browse/THRIFT-5233) - go: Now 
all Read*, Write* and Skip functions in TProtocol accept context arg
 - [THRIFT-5152](https://issues.apache.org/jira/browse/THRIFT-5152) - go: 
TSocket and TSSLSocket now have separated connect timeout and socket timeout
+- c++: dropped support for Windows XP
 
 ### Java
 
diff --git a/lib/cpp/src/thrift/transport/PlatformSocket.h 
b/lib/cpp/src/thrift/transport/PlatformSocket.h
index 9591058..10df944 100644
--- a/lib/cpp/src/thrift/transport/PlatformSocket.h
+++ b/lib/cpp/src/thrift/transport/PlatformSocket.h
@@ -70,16 +70,10 @@
 #  define THRIFT_SLEEP_USEC thrift_usleep
 #  define THRIFT_TIMESPEC thrift_timespec
 #  define THRIFT_CTIME_R thrift_ctime_r
-#  define THRIFT_POLL thrift_poll
-#  if WINVER <= 0x0502 //XP, Server2003
-#    define THRIFT_POLLFD  thrift_pollfd
-#    define THRIFT_POLLIN  0x0300
-#    define THRIFT_POLLOUT 0x0010
-#  else //Vista, Win7...
-#    define THRIFT_POLLFD  pollfd
-#    define THRIFT_POLLIN  POLLIN
-#    define THRIFT_POLLOUT POLLOUT
-#  endif //WINVER
+#  define THRIFT_POLL WSAPoll
+#  define THRIFT_POLLFD  pollfd
+#  define THRIFT_POLLIN  POLLIN
+#  define THRIFT_POLLOUT POLLOUT
 #  define THRIFT_SHUT_RDWR SD_BOTH
 #  if !defined(AI_ADDRCONFIG)
 #    define AI_ADDRCONFIG 0x00000400
diff --git a/lib/cpp/src/thrift/windows/WinFcntl.cpp 
b/lib/cpp/src/thrift/windows/WinFcntl.cpp
index 292ddfc..cec2f67 100644
--- a/lib/cpp/src/thrift/windows/WinFcntl.cpp
+++ b/lib/cpp/src/thrift/windows/WinFcntl.cpp
@@ -42,57 +42,6 @@ int thrift_fcntl(THRIFT_SOCKET fd, int cmd, int flags) {
   return res;
 }
 
-#if WINVER <= 0x0502 // XP, Server2003
-int thrift_poll(THRIFT_POLLFD* fdArray, ULONG nfds, INT timeout) {
-  fd_set read_fds, write_fds;
-  fd_set* read_fds_ptr = nullptr;
-  fd_set* write_fds_ptr = nullptr;
-
-  FD_ZERO(&read_fds);
-  FD_ZERO(&write_fds);
-
-  for (ULONG i = 0; i < nfds; i++) {
-    // Read (in) socket
-    if ((fdArray[i].events & THRIFT_POLLIN) == THRIFT_POLLIN) {
-      read_fds_ptr = &read_fds;
-      FD_SET(fdArray[i].fd, &read_fds);
-    }
-    // Write (out) socket
-    else if ((fdArray[i].events & THRIFT_POLLOUT) == THRIFT_POLLOUT) {
-      write_fds_ptr = &write_fds;
-      FD_SET(fdArray[i].fd, &write_fds);
-    }
-  }
-
-  timeval time_out;
-  timeval* time_out_ptr = nullptr;
-  if (timeout >= 0) {
-    time_out.tv_sec = timeout / 1000;
-    time_out.tv_usec = (timeout % 1000) * 1000;
-    time_out_ptr = &time_out;
-  } else { // to avoid compiler warnings
-    (void)time_out;
-    (void)timeout;
-  }
-
-  int sktready = select(1, read_fds_ptr, write_fds_ptr, nullptr, time_out_ptr);
-  if (sktready > 0) {
-    for (ULONG i = 0; i < nfds; i++) {
-      fdArray[i].revents = 0;
-      if (FD_ISSET(fdArray[i].fd, &read_fds))
-        fdArray[i].revents |= THRIFT_POLLIN;
-      if (FD_ISSET(fdArray[i].fd, &write_fds))
-        fdArray[i].revents |= THRIFT_POLLOUT;
-    }
-  }
-  return sktready;
-}
-#else  // Vista, Win7...
-int thrift_poll(THRIFT_POLLFD* fdArray, ULONG nfds, INT timeout) {
-  return WSAPoll(fdArray, nfds, timeout);
-}
-#endif // WINVER
-
 #ifdef _WIN32_WCE
 std::string thrift_wstr2str(std::wstring ws) {
   std::string s(ws.begin(), ws.end());
diff --git a/lib/cpp/src/thrift/windows/WinFcntl.h 
b/lib/cpp/src/thrift/windows/WinFcntl.h
index 6c6be97..4816fc5 100644
--- a/lib/cpp/src/thrift/windows/WinFcntl.h
+++ b/lib/cpp/src/thrift/windows/WinFcntl.h
@@ -36,17 +36,8 @@
 #include <Winsock2.h>
 #include <thrift/transport/PlatformSocket.h>
 
-#if WINVER <= 0x0502 // XP, Server2003
-struct thrift_pollfd {
-  THRIFT_SOCKET fd;
-  SHORT events;
-  SHORT revents;
-};
-#endif
-
 extern "C" {
 int thrift_fcntl(THRIFT_SOCKET fd, int cmd, int flags);
-int thrift_poll(THRIFT_POLLFD* fdArray, ULONG nfds, INT timeout);
 }
 
 #ifdef _WIN32_WCE

Reply via email to