diff --git a/CHANGELOG.md b/CHANGELOG.md index ba8321b6..13b8449e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Version 140: + +* Fix some integer warnings in 64-bit builds + +-------------------------------------------------------------------------------- + Version 139: * Revisit boost library min/max guidance diff --git a/include/boost/beast/http/impl/file_body_win32.ipp b/include/boost/beast/http/impl/file_body_win32.ipp index 00bea44a..e11c443e 100644 --- a/include/boost/beast/http/impl/file_body_win32.ipp +++ b/include/boost/beast/http/impl/file_body_win32.ipp @@ -417,10 +417,10 @@ operator()() } auto& r = sr_.reader_impl(); boost::winapi::DWORD_ const nNumberOfBytesToWrite = - (std::min)( - beast::detail::clamp((std::min)( - r.body_.last_ - r.pos_, sr_.limit())), - 2147483646); + static_cast( + (std::min)( + (std::min)(r.body_.last_ - r.pos_, sr_.limit()), + (std::numeric_limits::max)())); boost::asio::windows::overlapped_ptr overlapped{ sock_.get_executor().context(), *this}; auto& ov = *overlapped.get(); @@ -514,10 +514,10 @@ write_some( if(ec) return 0; boost::winapi::DWORD_ const nNumberOfBytesToWrite = - (std::min)( - beast::detail::clamp((std::min)( - r.body_.last_ - r.pos_, sr.limit())), - 2147483646); + static_cast( + (std::min)( + (std::min)(r.body_.last_ - r.pos_, sr.limit()), + (std::numeric_limits::max)())); auto const bSuccess = ::TransmitFile( sock.native_handle(), r.body_.file_.native_handle(), diff --git a/include/boost/beast/http/string_body.hpp b/include/boost/beast/http/string_body.hpp index 7c9bb6d6..18eda414 100644 --- a/include/boost/beast/http/string_body.hpp +++ b/include/boost/beast/http/string_body.hpp @@ -93,8 +93,7 @@ public: { if(length) { - if(*length > ( - std::numeric_limits::max)()) + if(static_cast(*length) != *length) { ec = error::buffer_overflow; return; diff --git a/include/boost/beast/http/vector_body.hpp b/include/boost/beast/http/vector_body.hpp index f1729335..eb37145d 100644 --- a/include/boost/beast/http/vector_body.hpp +++ b/include/boost/beast/http/vector_body.hpp @@ -88,8 +88,7 @@ public: { if(length) { - if(*length > ( - std::numeric_limits::max)()) + if(static_cast(*length) != *length) { ec = error::buffer_overflow; return;