From 30e6426db5541a20d2a3ecda65297f6376ae1f16 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sat, 17 Jun 2017 13:04:01 -0700 Subject: [PATCH] Tidy up some integer conversion warnings --- CHANGELOG.md | 1 + example/server-framework/file_body.hpp | 3 ++- test/core/buffer_bench.cpp | 2 +- test/websocket/websocket_sync_echo_server.hpp | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55a4f753..36ce0255 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Version 61: * Remove Spirit dependency * Use generic_cateogry for errno * Reorganize SSL examples +* Tidy up some integer conversion warnings -------------------------------------------------------------------------------- diff --git a/example/server-framework/file_body.hpp b/example/server-framework/file_body.hpp index 345a1fa2..96bf80fa 100644 --- a/example/server-framework/file_body.hpp +++ b/example/server-framework/file_body.hpp @@ -204,7 +204,8 @@ get(beast::error_code& ec) -> { // Calculate the smaller of our buffer size, // or the amount of unread data in the file. - auto const amount = std::min(remain_, sizeof(buf_)); + auto const amount = remain_ > sizeof(buf_) ? + sizeof(buf_) : static_cast(remain_); // Check for an empty file if(amount == 0) diff --git a/test/core/buffer_bench.cpp b/test/core/buffer_bench.cpp index a18fae4f..cf02edfe 100644 --- a/test/core/buffer_bench.cpp +++ b/test/core/buffer_bench.cpp @@ -51,7 +51,7 @@ public: inline size_type throughput(std::chrono::duration< - double> const& elapsed, std::size_t items) + double> const& elapsed, size_type items) { using namespace std::chrono; return static_cast( diff --git a/test/websocket/websocket_sync_echo_server.hpp b/test/websocket/websocket_sync_echo_server.hpp index e20dd41c..ab4384e9 100644 --- a/test/websocket/websocket_sync_echo_server.hpp +++ b/test/websocket/websocket_sync_echo_server.hpp @@ -209,7 +209,7 @@ private: void fail(std::string what, error_code ec, - int id, endpoint_type const& ep) + std::size_t id, endpoint_type const& ep) { if(log_) if(ec != beast::websocket::error::closed)