Fix a bunch of int to unsigned int conversion warnings

This commit is contained in:
louiz’
2018-08-23 20:31:31 +02:00
parent 0b51e38281
commit b1564e4ddc
8 changed files with 28 additions and 28 deletions
+1 -2
View File
@@ -21,9 +21,8 @@ static const std::vector<std::string> default_cert_files = {
Botan::Certificate_Store_In_Memory BasicCredentialsManager::certificate_store;
bool BasicCredentialsManager::certs_loaded = false;
BasicCredentialsManager::BasicCredentialsManager(const TCPSocketHandler* const socket_handler):
BasicCredentialsManager::BasicCredentialsManager():
Botan::Credentials_Manager(),
socket_handler(socket_handler),
trusted_fingerprint{}
{
BasicCredentialsManager::load_certs();
+1 -2
View File
@@ -25,7 +25,7 @@ void check_tls_certificate(const std::vector<Botan::X509_Certificate>& certs,
class BasicCredentialsManager: public Botan::Credentials_Manager
{
public:
BasicCredentialsManager(const TCPSocketHandler* const socket_handler);
BasicCredentialsManager();
BasicCredentialsManager(BasicCredentialsManager&&) = delete;
BasicCredentialsManager(const BasicCredentialsManager&) = delete;
@@ -38,7 +38,6 @@ public:
const std::string& get_trusted_fingerprint() const;
private:
const TCPSocketHandler* const socket_handler;
static bool try_to_open_one_ca_bundle(const std::vector<std::string>& paths);
static void load_certs();
+9 -7
View File
@@ -50,7 +50,7 @@ TCPSocketHandler::TCPSocketHandler(std::shared_ptr<Poller>& poller):
SocketHandler(poller, -1),
use_tls(false)
#ifdef BOTAN_FOUND
,credential_manager(this)
,credential_manager()
#endif
{}
@@ -84,10 +84,11 @@ void TCPSocketHandler::plain_recv()
if (recv_buf == nullptr)
recv_buf = buf;
const ssize_t size = this->do_recv(recv_buf, buf_size);
const ssize_t ssize = this->do_recv(recv_buf, buf_size);
if (size > 0)
if (ssize > 0)
{
auto size = static_cast<std::size_t>(ssize);
if (buf == recv_buf)
{
// data needs to be placed in the in_buf string, because no buffer
@@ -149,21 +150,22 @@ void TCPSocketHandler::on_send()
}
else
{
auto size = static_cast<std::size_t>(res);
// remove all the strings that were successfully sent.
auto it = this->out_buf.begin();
while (it != this->out_buf.end())
{
if (static_cast<size_t>(res) >= it->size())
if (size >= it->size())
{
res -= it->size();
size -= it->size();
++it;
}
else
{
// If one string has partially been sent, we use substr to
// crop it
if (res > 0)
*it = it->substr(res, std::string::npos);
if (size > 0)
*it = it->substr(size, std::string::npos);
break;
}
}