Browse Source

Fixed warnings on Windows due to max/min macro

yhirose 5 years ago
parent
commit
685533ba50
1 changed files with 6 additions and 6 deletions
  1. 6 6
      httplib.h

+ 6 - 6
httplib.h

@@ -41,7 +41,7 @@
 #endif
 #endif
 
 
 #ifndef CPPHTTPLIB_PAYLOAD_MAX_LENGTH
 #ifndef CPPHTTPLIB_PAYLOAD_MAX_LENGTH
-#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH (std::numeric_limits<size_t>::max())
+#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH ((std::numeric_limits<size_t>::max)())
 #endif
 #endif
 
 
 #ifndef CPPHTTPLIB_RECV_BUFSIZ
 #ifndef CPPHTTPLIB_RECV_BUFSIZ
@@ -50,7 +50,7 @@
 
 
 #ifndef CPPHTTPLIB_THREAD_POOL_COUNT
 #ifndef CPPHTTPLIB_THREAD_POOL_COUNT
 #define CPPHTTPLIB_THREAD_POOL_COUNT                                           \
 #define CPPHTTPLIB_THREAD_POOL_COUNT                                           \
-  (std::max(1u, std::thread::hardware_concurrency() - 1))
+  ((std::max)(1u, std::thread::hardware_concurrency() - 1))
 #endif
 #endif
 
 
 /*
 /*
@@ -1785,7 +1785,7 @@ inline bool read_content_with_length(Stream &strm, uint64_t len,
   uint64_t r = 0;
   uint64_t r = 0;
   while (r < len) {
   while (r < len) {
     auto read_len = static_cast<size_t>(len - r);
     auto read_len = static_cast<size_t>(len - r);
-    auto n = strm.read(buf, std::min(read_len, CPPHTTPLIB_RECV_BUFSIZ));
+    auto n = strm.read(buf, (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ));
     if (n <= 0) { return false; }
     if (n <= 0) { return false; }
 
 
     if (!out(buf, static_cast<size_t>(n))) { return false; }
     if (!out(buf, static_cast<size_t>(n))) { return false; }
@@ -1805,7 +1805,7 @@ inline void skip_content_with_length(Stream &strm, uint64_t len) {
   uint64_t r = 0;
   uint64_t r = 0;
   while (r < len) {
   while (r < len) {
     auto read_len = static_cast<size_t>(len - r);
     auto read_len = static_cast<size_t>(len - r);
-    auto n = strm.read(buf, std::min(read_len, CPPHTTPLIB_RECV_BUFSIZ));
+    auto n = strm.read(buf, (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ));
     if (n <= 0) { return; }
     if (n <= 0) { return; }
     r += static_cast<uint64_t>(n);
     r += static_cast<uint64_t>(n);
   }
   }
@@ -4005,7 +4005,7 @@ inline bool Client::process_request(Stream &strm, const Request &req,
     }
     }
 
 
     int dummy_status;
     int dummy_status;
-    if (!detail::read_content(strm, res, std::numeric_limits<size_t>::max(),
+    if (!detail::read_content(strm, res, (std::numeric_limits<size_t>::max)(),
                               dummy_status, req.progress, out)) {
                               dummy_status, req.progress, out)) {
       return false;
       return false;
     }
     }
@@ -4022,7 +4022,7 @@ inline bool Client::process_and_close_socket(
     std::function<bool(Stream &strm, bool last_connection,
     std::function<bool(Stream &strm, bool last_connection,
                        bool &connection_close)>
                        bool &connection_close)>
         callback) {
         callback) {
-  request_count = std::min(request_count, keep_alive_max_count_);
+  request_count = (std::min)(request_count, keep_alive_max_count_);
   return detail::process_and_close_socket(true, sock, request_count,
   return detail::process_and_close_socket(true, sock, request_count,
                                           read_timeout_sec_, read_timeout_usec_,
                                           read_timeout_sec_, read_timeout_usec_,
                                           callback);
                                           callback);