fix clang-tidy warnings

This commit is contained in:
Adrien Béraud committed 2019-03-17 19:22:28 -04:00
1 parent 4401e47002
commit 5e92777702
5 files changed
+9 -10

No files matched your search

+2 -2
View File
@@ -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
+3 -3
View File
@@ -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());
+1 -1
View File
@@ -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;
}
+1 -2
View File
@@ -61,8 +61,7 @@ SecureDht::SecureDht(std::unique_ptr<DhtInterface> dht, SecureDht::Config conf)
}
}
SecureDht::~SecureDht()
{}
SecureDht::~SecureDht() = default;
ValueType
SecureDht::secureType(ValueType&& type)
+2 -2
View File
@@ -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;
}
}