summaryrefslogtreecommitdiff
path: root/lib/cpp
diff options
context:
space:
mode:
authorMario Emmenlauer <mario@emmenlauer.de>2020-05-21 23:04:12 +0200
committerMario Emmenlauer <memmenlauer@biodataanalysis.de>2021-09-02 08:53:36 +0200
commit034c9359e978d2465f0ce8530f62c146ef18e935 (patch)
treee346bf2014f67a438c0744ae8b6edca1c313ce30 /lib/cpp
parentb8069cbe9c83a2ac094a91c5bc59a545caabb652 (diff)
downloadthrift-034c9359e978d2465f0ce8530f62c146ef18e935.tar.gz
Reduce the usage of Windows.h, and add macros to slim Windows.h
Diffstat (limited to 'lib/cpp')
-rw-r--r--lib/cpp/src/thrift/transport/TPipeServer.cpp1
-rw-r--r--lib/cpp/src/thrift/transport/TPipeServer.h3
-rw-r--r--lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h1
-rw-r--r--lib/cpp/src/thrift/windows/Sync.h6
4 files changed, 7 insertions, 4 deletions
diff --git a/lib/cpp/src/thrift/transport/TPipeServer.cpp b/lib/cpp/src/thrift/transport/TPipeServer.cpp
index 1d7577fbe..e4234b180 100644
--- a/lib/cpp/src/thrift/transport/TPipeServer.cpp
+++ b/lib/cpp/src/thrift/transport/TPipeServer.cpp
@@ -26,6 +26,7 @@
#ifdef _WIN32
#include <thrift/windows/OverlappedSubmissionThread.h>
+#include <thrift/windows/Sync.h>
#include <AccCtrl.h>
#include <Aclapi.h>
#include <sddl.h>
diff --git a/lib/cpp/src/thrift/transport/TPipeServer.h b/lib/cpp/src/thrift/transport/TPipeServer.h
index 67c5d51a7..249591e09 100644
--- a/lib/cpp/src/thrift/transport/TPipeServer.h
+++ b/lib/cpp/src/thrift/transport/TPipeServer.h
@@ -25,9 +25,6 @@
#ifndef _WIN32
#include <thrift/transport/TServerSocket.h>
#endif
-#ifdef _WIN32
-#include <thrift/windows/Sync.h>
-#endif
#define TPIPE_SERVER_MAX_CONNS_DEFAULT PIPE_UNLIMITED_INSTANCES
diff --git a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
index 6cecfc357..057f623b9 100644
--- a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
+++ b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
@@ -26,7 +26,6 @@
#include <thrift/windows/Sync.h>
#include <thrift/TNonCopyable.h>
-#include <Windows.h>
/*
*** Why does this class exist?
diff --git a/lib/cpp/src/thrift/windows/Sync.h b/lib/cpp/src/thrift/windows/Sync.h
index b1c83ee45..f5b8a052d 100644
--- a/lib/cpp/src/thrift/windows/Sync.h
+++ b/lib/cpp/src/thrift/windows/Sync.h
@@ -27,7 +27,13 @@
#include <thrift/concurrency/Exception.h>
#include <thrift/TNonCopyable.h>
+// Including Windows.h can conflict with Winsock2 usage, and also
+// adds problematic macros like min() and max(). Try to work around:
+#define NOMINMAX
+#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
+#undef NOMINMAX
+#undef WIN32_LEAN_AND_MEAN
/*
Lightweight synchronization objects that only make sense on Windows. For cross-platform