Address PR feedback

This commit is contained in:
Jason Rhinelander 2020-07-02 12:50:37 -03:00
parent ec331e6199
commit 07293ebf60
7 changed files with 17 additions and 9 deletions

View File

@ -43,10 +43,10 @@ library archives (`.a`).
| Dep | Min. version | Vendored | Debian/Ubuntu pkg | Arch pkg | Fedora | Optional | Purpose |
| ------------ | ------------- | -------- | --------------------- | ------------ | ------------------- | -------- | ---------------- |
| GCC | 7.1.0 | NO | `g++` | `base-devel` | `gcc` | NO | |
| GCC | 8.1.0 | NO | `g++`[1] | `base-devel` | `gcc` | NO | |
| CMake | 3.10 | NO | `cmake` | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | `pkgconf` | NO | |
| Boost | 1.65 | NO | `libboost-all-dev`[1] | `boost` | `boost-devel` | NO | C++ libraries |
| Boost | 1.65 | NO | `libboost-all-dev`[2] | `boost` | `boost-devel` | NO | C++ libraries |
| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `openssl-devel` | NO | sha256 sum |
| libzmq | 4.3.0 | YES | `libzmq3-dev` | `zeromq` | `zeromq-devel` | NO | ZeroMQ library |
| sqlite3 | ? | YES | `libsqlite3-dev` | `sqlite` | `sqlite-devel` | NO | Loki Name System |
@ -66,7 +66,10 @@ library archives (`.a`).
| protoc | ? | NO | `protobuf-compiler` | `protobuf` | `protobuf-compiler` | YES | Hardware wallet |
[1] libboost-all-dev includes a lot of unnecessary packages; see the apt command below for a
[1] On Ubuntu Bionic you will need the g++-8 package instead of g++ (which is version 7) and will
need to run `export CC=gcc-8 CXX=g++-8` before running `make` or `cmake`.
[2] libboost-all-dev includes a lot of unnecessary packages; see the apt command below for a
breakdown of the minimum set of required boost packages.
Install all dependencies at once on Debian/Ubuntu:

View File

@ -46,6 +46,7 @@
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/asio/steady_timer.hpp>
#include "net_utils_base.h"
#include "connection_basic.hpp"
#include "network_throttle-detail.hpp"

View File

@ -34,7 +34,7 @@ std::vector<std::string_view> split(std::string_view str, const std::string_view
std::vector<std::string_view> split_any(std::string_view str, const std::string_view delims, bool trim)
{
if (delims.empty())
return split(str, delims);
return split(str, delims, trim);
std::vector<std::string_view> results;
for (size_t pos = str.find_first_of(delims); pos != std::string_view::npos; pos = str.find_first_of(delims))
{

View File

@ -150,7 +150,7 @@ namespace tools {
auto write_varint(const OutputIt& it_, T i) { return write_varint(OutputIt{it_}, i); }
template <typename It, typename T, std::enable_if_t<std::is_integral_v<T> && std::is_unsigned_v<T>, int> = 0>
auto read_varint(const It& it_, const It& end, T i) { return read_varint(It{it_}, end, i); }
auto read_varint(const It& it_, const It& end, T& i) { return read_varint(It{it_}, end, i); }
/*! \brief reads the varint from an encoded string into `write`. Returns the number of bytes

View File

@ -31,6 +31,7 @@
#include <atomic>
#include <boost/algorithm/string.hpp>
#include <limits>
#include <lokimq/hex.h>
#include <variant>
#include "wipeable_string.h"
@ -402,7 +403,11 @@ namespace cryptonote
// TODO: get rid of the user-configurable default_decimal_point nonsense and just multiply
// this value by the `COIN` constant.
for (size_t i = 0; i < decimal_point; i++)
{
if (amount > std::numeric_limits<uint64_t>::max() / 10)
return false; // would overflow
amount *= 10;
}
}
if (parts.size() == 1)

View File

@ -39,7 +39,7 @@ namespace net
{
std::pair<std::string_view, std::string_view> get_network_address_host_and_port(std::string_view address)
{
std::pair<std::string, std::string> result;
std::pair<std::string_view, std::string_view> result;
auto& [host, port] = result;
// require ipv6 address format "[addr:addr:addr:...:addr]:port"
if (address.find(']') != std::string_view::npos)
@ -66,7 +66,7 @@ namespace net
{
bool ipv6 = false;
auto [host_str, port_str] = get_network_address_host_and_port(std::string(address));
auto [host_str, port_str] = get_network_address_host_and_port(address);
if (host_str.empty())
return make_error_code(net::error::invalid_host);
@ -79,7 +79,7 @@ namespace net
#if BOOST_VERSION >= 106600
auto v6 = boost::asio::ip::make_address_v6(host_str, ec);
#else
auto v6 = boost::asio::ip::address_v6::from_string(host_str, ec);
auto v6 = boost::asio::ip::address_v6::from_string(std::string{host_str}, ec);
#endif
ipv6 = !ec;

View File

@ -85,7 +85,6 @@ template <class Archive, typename C, std::enable_if_t<Archive::is_deserializer,
void serialize_container(Archive& ar, C& v)
{
using T = std::remove_cv_t<typename C::value_type>;
constexpr bool VarintSerialization = std::is_same_v<T, uint32_t> || std::is_same_v<T, uint64_t>;
size_t cnt;
auto arr = ar.begin_array(cnt);