From 3b9931a85cf95dda0557ed55b5bcac661004f7cf Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 17 Oct 2026 00:32:29 -0400 Subject: [PATCH] Keep time_point::max() clear of the Windows max macro windows.h defines max() as a macro, which broke the Windows builds at the two time_point::max() calls the handshake deadline added. Wrap them in parentheses, as the other max() calls are. --- httplib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/httplib.h b/httplib.h index 4cf7157e..3548e720 100644 --- a/httplib.h +++ b/httplib.h @@ -6692,7 +6692,7 @@ inline ssize_t select_write(socket_t sock, time_t sec, time_t usec) { // comes, as a negative timeout waits forever in select_impl(). inline std::chrono::steady_clock::time_point deadline_after(time_t sec, time_t usec) { - if (sec < 0) { return std::chrono::steady_clock::time_point::max(); } + if (sec < 0) { return (std::chrono::steady_clock::time_point::max)(); } return std::chrono::steady_clock::now() + std::chrono::seconds(sec) + std::chrono::microseconds(usec); } @@ -6701,7 +6701,7 @@ inline std::chrono::steady_clock::time_point deadline_after(time_t sec, // TLS handshake come out of a single timeout. inline ssize_t select_until(socket_t sock, short events, std::chrono::steady_clock::time_point deadline) { - if (deadline == std::chrono::steady_clock::time_point::max()) { + if (deadline == (std::chrono::steady_clock::time_point::max)()) { return select_impl(sock, events, -1, 0); } auto left = std::chrono::duration_cast(