Skip to content

Commit 463c887

Browse files
committed
Fix casting uint64_t to size_t for 32-bit builds
This fixes the following warning: ``` D:\cpp-httplib\httplib.h(8002,61): warning C4244: 'argument': conversion from 'uint64_t' to 'const _Ty', possible loss of data D:\cpp-httplib\httplib.h(8002,61): warning C4244: with D:\cpp-httplib\httplib.h(8002,61): warning C4244: [ D:\cpp-httplib\httplib.h(8002,61): warning C4244: _Ty=size_t D:\cpp-httplib\httplib.h(8002,61): warning C4244: ] (compiling source file '../src/test/HttpRequestTest.cpp') ```
1 parent 4f5b003 commit 463c887

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

httplib.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7999,8 +7999,8 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req,
79997999

80008000
if (res.has_header("Content-Length")) {
80018001
if (!req.content_receiver) {
8002-
auto len = std::min<size_t>(res.get_header_value_u64("Content-Length"),
8003-
res.body.max_size());
8002+
auto contentLength = (size_t)res.get_header_value_u64("Content-Length");
8003+
auto len = std::min<size_t>(contentLength, res.body.max_size());
80048004
if (len > 0) { res.body.reserve(len); }
80058005
}
80068006
}

0 commit comments

Comments
 (0)