diff --git a/src/base64.cpp b/src/base64.cpp index 9a8d329feef6ebf98176d11225fb909ba0d00b40..04d7aba8aa4b06cf0bfa4b272eae7c360476188f 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -17,8 +17,8 @@ #include "base64.h" -#include <stdint.h> -#include <stdlib.h> +#include <cstdint> +#include <cstdlib> /* Mainly based on the following stackoverflow question: * http://stackoverflow.com/questions/342409/how-do-i-base64-encode-decode-in-c diff --git a/src/crypto.cpp b/src/crypto.cpp index 0704d6883d8eb6db825b3d1aeb614235163ce3f8..7f82889cda76f15584aa3cda589791820f728b59 100644 --- a/src/crypto.cpp +++ b/src/crypto.cpp @@ -385,7 +385,7 @@ PrivateKey::getPublicKey() const return pk_ret; } -PublicKey::PublicKey(const Blob& dat) : pk(nullptr) +PublicKey::PublicKey(const Blob& dat) { unpack(dat.data(), dat.size()); } @@ -572,7 +572,7 @@ PublicKey::getLongId() const #endif } -Certificate::Certificate(const Blob& certData) : cert(nullptr) +Certificate::Certificate(const Blob& certData) { unpack(certData.data(), certData.size()); } @@ -930,7 +930,7 @@ Certificate::generate(const PrivateKey& key, const std::string& name, const Iden return {}; Certificate ret {cert}; - int64_t now = time(NULL); + int64_t now = time(nullptr); /* 2038 bug: don't allow time wrap */ auto boundTime = [](int64_t t) -> time_t { return std::min<int64_t>(t, std::numeric_limits<time_t>::max()); diff --git a/src/routing_table.cpp b/src/routing_table.cpp index 87f341d827c26d95d3b1ba6749d0b6a513cdc568..82525afef50b0ac454164c47f8d966fdb9546953 100644 --- a/src/routing_table.cpp +++ b/src/routing_table.cpp @@ -92,7 +92,7 @@ RoutingTable::middle(const RoutingTable::const_iterator& it) const throw std::out_of_range("End of table"); InfoHash id = it->first; - id.setBit(bit, 1); + id.setBit(bit, true); return id; } diff --git a/src/securedht.cpp b/src/securedht.cpp index c24b38d08f7a7133d20fc92ee326214d8d9d3ae3..251960be243ca67ec866c355acf0c154bb644a51 100644 --- a/src/securedht.cpp +++ b/src/securedht.cpp @@ -61,8 +61,7 @@ SecureDht::SecureDht(std::unique_ptr<DhtInterface> dht, SecureDht::Config conf) } } -SecureDht::~SecureDht() -{} +SecureDht::~SecureDht() = default; ValueType SecureDht::secureType(ValueType&& type) diff --git a/src/value.cpp b/src/value.cpp index 2f004e35507137554b73555db895ebf79c643061..5a77f70c561eff0e1785b5389923735fbb894eb2 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -65,8 +65,8 @@ std::ostream& operator<< (std::ostream& s, const Value& v) } else { s << "Data (type: " << v.type << " ): "; s << std::hex; - for (size_t i=0; i<v.data.size(); i++) - s << std::setfill('0') << std::setw(2) << (unsigned)v.data[i]; + for (auto i : v.data) + s << std::setfill('0') << std::setw(2) << (unsigned)i; s << std::dec; } }