From 463c887c0531e9caa706bbe5e0463dc6917847c4 Mon Sep 17 00:00:00 2001 From: Pavel P Date: Fri, 29 Nov 2024 22:33:49 +0200 Subject: [PATCH] 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') ``` --- httplib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/httplib.h b/httplib.h index b4f89d6183..a4f8f05dc7 100644 --- a/httplib.h +++ b/httplib.h @@ -7999,8 +7999,8 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req, if (res.has_header("Content-Length")) { if (!req.content_receiver) { - auto len = std::min(res.get_header_value_u64("Content-Length"), - res.body.max_size()); + auto contentLength = (size_t)res.get_header_value_u64("Content-Length"); + auto len = std::min(contentLength, res.body.max_size()); if (len > 0) { res.body.reserve(len); } } }