From 5e265505e90264749ce29267f3dbbe1d5a14da40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Wed, 4 Nov 2015 00:50:08 -0500
Subject: [PATCH] fix some clang warnings

---
 include/opendht/dht.h | 2 +-
 src/crypto.cpp        | 2 +-
 src/default_types.cpp | 8 ++++----
 src/dht.cpp           | 8 ++++----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/opendht/dht.h b/include/opendht/dht.h
index 72a194a2..f60898e1 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 122d3fb0..4735fd35 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 a8521d0a..ebe57b1b 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 787ad451..fa8c0a35 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)
-- 
GitLab