From 685533ba500786e80aa97640ffd9cfb1c7d31288 Mon Sep 17 00:00:00 2001 From: yhirose Date: Mon, 16 Mar 2020 13:58:09 -0400 Subject: [PATCH] Fixed warnings on Windows due to max/min macro --- httplib.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/httplib.h b/httplib.h index 9a9c9a2..1e2ad17 100644 --- a/httplib.h +++ b/httplib.h @@ -41,7 +41,7 @@ #endif #ifndef CPPHTTPLIB_PAYLOAD_MAX_LENGTH -#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH (std::numeric_limits::max()) +#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH ((std::numeric_limits::max)()) #endif #ifndef CPPHTTPLIB_RECV_BUFSIZ @@ -50,7 +50,7 @@ #ifndef 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 /* @@ -1785,7 +1785,7 @@ inline bool read_content_with_length(Stream &strm, uint64_t len, uint64_t r = 0; while (r < len) { auto read_len = static_cast(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 (!out(buf, static_cast(n))) { return false; } @@ -1805,7 +1805,7 @@ inline void skip_content_with_length(Stream &strm, uint64_t len) { uint64_t r = 0; while (r < len) { auto read_len = static_cast(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; } r += static_cast(n); } @@ -4005,7 +4005,7 @@ inline bool Client::process_request(Stream &strm, const Request &req, } int dummy_status; - if (!detail::read_content(strm, res, std::numeric_limits::max(), + if (!detail::read_content(strm, res, (std::numeric_limits::max)(), dummy_status, req.progress, out)) { return false; } @@ -4022,7 +4022,7 @@ inline bool Client::process_and_close_socket( std::function 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, read_timeout_sec_, read_timeout_usec_, callback);