Parcourir la source

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.
yhirose il y a 2 jours
Parent
commit
3b9931a85c
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      httplib.h

+ 2 - 2
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<std::chrono::microseconds>(