diff --git a/examples/http_async_server.hpp b/examples/http_async_server.hpp index 501aa8a5..791e6bf7 100644 --- a/examples/http_async_server.hpp +++ b/examples/http_async_server.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +45,7 @@ class http_async_server public: http_async_server(endpoint_type const& ep, - int threads, std::string const& root) + std::size_t threads, std::string const& root) : acceptor_(ios_) , sock_(ios_) , root_(root) @@ -57,7 +58,7 @@ public: std::bind(&http_async_server::on_accept, this, beast::asio::placeholders::error)); thread_.reserve(threads); - for(int i = 0; i < threads; ++i) + for(std::size_t i = 0; i < threads; ++i) thread_.emplace_back( [&] { ios_.run(); }); } diff --git a/include/beast/core/detail/base64.hpp b/include/beast/core/detail/base64.hpp index 0256aa7d..5c65a1e0 100644 --- a/include/beast/core/detail/base64.hpp +++ b/include/beast/core/detail/base64.hpp @@ -124,7 +124,7 @@ template std::string base64_decode(std::string const& data) { - int in_len = data.size(); + auto in_len = data.size(); unsigned char c3[3], c4[4]; int i = 0; int j = 0; diff --git a/include/beast/websocket/detail/mask.hpp b/include/beast/websocket/detail/mask.hpp index 78f6f1f8..fb67b511 100644 --- a/include/beast/websocket/detail/mask.hpp +++ b/include/beast/websocket/detail/mask.hpp @@ -113,7 +113,7 @@ mask_inplace_general( { using boost::asio::buffer_cast; using boost::asio::buffer_size; - auto n = buffer_size(b); + auto const n = buffer_size(b); auto p = buffer_cast(b); for(auto i = n / sizeof(key); i; --i) { @@ -122,13 +122,14 @@ mask_inplace_general( *p ^= (key >>16); ++p; *p ^= (key >>24); ++p; } - n %= sizeof(key); - switch(n) + auto const m = + static_cast(n % sizeof(key)); + switch(m) { case 3: p[2] ^= (key >>16); case 2: p[1] ^= (key >> 8); case 1: p[0] ^= key; - key = ror(key, n*8); + key = ror(key, m*8); default: break; } @@ -144,7 +145,7 @@ mask_inplace_general( { using boost::asio::buffer_cast; using boost::asio::buffer_size; - auto n = buffer_size(b); + auto const n = buffer_size(b); auto p = buffer_cast(b); for(auto i = n / sizeof(key); i; --i) { @@ -157,8 +158,9 @@ mask_inplace_general( *p ^= (key >>48); ++p; *p ^= (key >>56); ++p; } - n %= sizeof(key); - switch(n) + auto const m = + static_cast(n % sizeof(key)); + switch(m) { case 7: p[6] ^= (key >>16); case 6: p[5] ^= (key >> 8); @@ -167,7 +169,7 @@ mask_inplace_general( case 3: p[2] ^= (key >>16); case 2: p[1] ^= (key >> 8); case 1: p[0] ^= key; - key = ror(key, n*8); + key = ror(key, m*8); default: break; }