Skip to content

Commit 685533b

Browse files
committed
Fixed warnings on Windows due to max/min macro
1 parent 6e46ccb commit 685533b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

httplib.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#endif
4242

4343
#ifndef CPPHTTPLIB_PAYLOAD_MAX_LENGTH
44-
#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH (std::numeric_limits<size_t>::max())
44+
#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH ((std::numeric_limits<size_t>::max)())
4545
#endif
4646

4747
#ifndef CPPHTTPLIB_RECV_BUFSIZ
@@ -50,7 +50,7 @@
5050

5151
#ifndef CPPHTTPLIB_THREAD_POOL_COUNT
5252
#define CPPHTTPLIB_THREAD_POOL_COUNT \
53-
(std::max(1u, std::thread::hardware_concurrency() - 1))
53+
((std::max)(1u, std::thread::hardware_concurrency() - 1))
5454
#endif
5555

5656
/*
@@ -1785,7 +1785,7 @@ inline bool read_content_with_length(Stream &strm, uint64_t len,
17851785
uint64_t r = 0;
17861786
while (r < len) {
17871787
auto read_len = static_cast<size_t>(len - r);
1788-
auto n = strm.read(buf, std::min(read_len, CPPHTTPLIB_RECV_BUFSIZ));
1788+
auto n = strm.read(buf, (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ));
17891789
if (n <= 0) { return false; }
17901790

17911791
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) {
18051805
uint64_t r = 0;
18061806
while (r < len) {
18071807
auto read_len = static_cast<size_t>(len - r);
1808-
auto n = strm.read(buf, std::min(read_len, CPPHTTPLIB_RECV_BUFSIZ));
1808+
auto n = strm.read(buf, (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ));
18091809
if (n <= 0) { return; }
18101810
r += static_cast<uint64_t>(n);
18111811
}
@@ -4005,7 +4005,7 @@ inline bool Client::process_request(Stream &strm, const Request &req,
40054005
}
40064006

40074007
int dummy_status;
4008-
if (!detail::read_content(strm, res, std::numeric_limits<size_t>::max(),
4008+
if (!detail::read_content(strm, res, (std::numeric_limits<size_t>::max)(),
40094009
dummy_status, req.progress, out)) {
40104010
return false;
40114011
}
@@ -4022,7 +4022,7 @@ inline bool Client::process_and_close_socket(
40224022
std::function<bool(Stream &strm, bool last_connection,
40234023
bool &connection_close)>
40244024
callback) {
4025-
request_count = std::min(request_count, keep_alive_max_count_);
4025+
request_count = (std::min)(request_count, keep_alive_max_count_);
40264026
return detail::process_and_close_socket(true, sock, request_count,
40274027
read_timeout_sec_, read_timeout_usec_,
40284028
callback);

0 commit comments

Comments
 (0)