Fix integer warnings in 64-bit Windows build

This commit is contained in:
Vinnie Falco
2016-08-26 07:54:20 -04:00
parent 2c4bdf933e
commit e75fb7a4d4
3 changed files with 14 additions and 11 deletions

View File

@@ -15,6 +15,7 @@
#include <beast/core/placeholders.hpp>
#include <beast/core/streambuf.hpp>
#include <boost/asio.hpp>
#include <cstddef>
#include <cstdio>
#include <iostream>
#include <memory>
@@ -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(); });
}

View File

@@ -124,7 +124,7 @@ template <class = void>
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;

View File

@@ -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<std::uint8_t*>(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<std::uint8_t>(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<std::uint8_t*>(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<std::uint8_t>(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;
}