From 41decc32b9bccf9b746e5d6457b992a0b1233a8f Mon Sep 17 00:00:00 2001 From: "Chuvi.w" Date: Wed, 12 Mar 2025 19:04:08 +0300 Subject: [PATCH] Attempt to fix https://github.com/yhirose/cpp-httplib/issues/2106 --- httplib.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/httplib.h b/httplib.h index dfa6c0e821..6a73083fd1 100644 --- a/httplib.h +++ b/httplib.h @@ -194,7 +194,6 @@ using ssize_t = long; using socket_t = SOCKET; using socklen_t = int; -#define poll(fds, nfds, timeout) WSAPoll(fds, nfds, timeout) #else // not _WIN32 @@ -2660,7 +2659,9 @@ inline bool is_field_value(const std::string &s) { return is_field_content(s); } /* * Implementation that will be part of the .cc file if split into .h + .cc. */ - +#if defined(_WIN32) +#define poll(fds, nfds, timeout) WSAPoll(fds, nfds, timeout) +#endif namespace detail { inline bool is_hex(char c, int &v) { @@ -10372,13 +10373,13 @@ inline SSL_CTX *Client::ssl_context() const { return nullptr; } #endif - +#ifdef _WIN32 +#undef poll +#endif // ---------------------------------------------------------------------------- } // namespace httplib -#ifdef _WIN32 -#undef poll -#endif + #endif // CPPHTTPLIB_HTTPLIB_H