diff --git a/include/opendht/dht.h b/include/opendht/dht.h index 72a194a215577ea758cacdfc7bddd3887a04ab80..f60898e131f01b08f785a716bddf49316897180a 100644 --- a/include/opendht/dht.h +++ b/include/opendht/dht.h @@ -713,7 +713,7 @@ private: }; struct TransPrefix : public std::array<uint8_t, 2> { - TransPrefix(const std::string& str) : std::array<uint8_t, 2>({(uint8_t)str[0], (uint8_t)str[1]}) {} + TransPrefix(const std::string& str) : std::array<uint8_t, 2>({{(uint8_t)str[0], (uint8_t)str[1]}}) {} static const TransPrefix PING; static const TransPrefix FIND_NODE; static const TransPrefix GET_VALUES; diff --git a/src/crypto.cpp b/src/crypto.cpp index 122d3fb0074ab1a347ff124e36fa712db374b8d9..4735fd3514851041921f864e858ca448ff630361 100644 --- a/src/crypto.cpp +++ b/src/crypto.cpp @@ -86,7 +86,7 @@ static gnutls_digest_algorithm_t get_dig(gnutls_x509_crt_t crt) namespace dht { namespace crypto { -static constexpr std::array<size_t, 3> AES_LENGTHS {128/8, 192/8, 256/8}; +static constexpr std::array<size_t, 3> AES_LENGTHS {{128/8, 192/8, 256/8}}; size_t aesKeySize(size_t max) { diff --git a/src/default_types.cpp b/src/default_types.cpp index a8521d0a09551dccdb043df29601e0b19b592e94..ebe57b1bea3bd9170bde4731e2d4d5155edc9be6 100644 --- a/src/default_types.cpp +++ b/src/default_types.cpp @@ -103,18 +103,18 @@ const ValueType IceCandidates::TYPE = {5, "ICE candidates", std::chrono::minutes const std::array<std::reference_wrapper<const ValueType>, 5> DEFAULT_TYPES -{ +{{ ValueType::USER_DATA, DhtMessage::TYPE, ImMessage::TYPE, IceCandidates::TYPE, TrustRequest::TYPE -}; +}}; const std::array<std::reference_wrapper<const ValueType>, 1> DEFAULT_INSECURE_TYPES -{ +{{ IpServiceAnnouncement::TYPE -}; +}}; } diff --git a/src/dht.cpp b/src/dht.cpp index 787ad4517195f632ed2c79e3260a874fca09baa7..fa8c0a35a9610f3cd7cf1bff14ec3d58fc794e59 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -143,11 +143,11 @@ const Dht::TransPrefix Dht::TransPrefix::LISTEN = {"lt"}; const std::string Dht::my_v = "RNG1"; static constexpr InfoHash zeroes {}; -static constexpr InfoHash ones = {std::array<uint8_t, HASH_LEN>{ +static constexpr InfoHash ones = {std::array<uint8_t, HASH_LEN>{{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF -}}; +}}}; constexpr std::chrono::minutes Node::NODE_EXPIRE_TIME; constexpr std::chrono::minutes Node::NODE_GOOD_TIME; @@ -3283,9 +3283,9 @@ Dht::ParsedMessage::msgpack_unpack(msgpack::object msg) query = q->as<std::string>(); } - auto& req = a ? *a : (r ? *r : *e); - if (not &req) + if (!a && !r && !e) throw msgpack::type_error(); + auto& req = a ? *a : (r ? *r : *e); if (e) { if (e->type != msgpack::type::ARRAY)