The clang C++ compiler is more strict about the C++11 language standard.
With these errors fixed, libbitcoin now compiles on clang as well.
---
include/bitcoin/constants.hpp | 8 +--
include/bitcoin/error.hpp | 1 +
src/block.cpp | 8 +--
src/blockchain/organizer.cpp | 2 +-
src/network/handshake.cpp | 10 ++--
src/script.cpp | 4 +-
src/utility/big_number.cpp | 4 +-
src/validate.cpp | 136 +++++++++++++++++++++---------------------
8 files changed, 87 insertions(+), 86 deletions(-)
diff --git a/include/bitcoin/constants.hpp b/include/bitcoin/constants.hpp
index 42b5735..8bff60c 100644
--- a/include/bitcoin/constants.hpp
+++ b/include/bitcoin/constants.hpp
@@ -61,10 +61,10 @@ constexpr uint64_t max_money()
return reward_interval * max_money_recursive(coin_price(block_reward));
}
-const hash_digest null_hash{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-const short_hash null_short_hash{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+const hash_digest null_hash{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
+const short_hash null_short_hash{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
constexpr uint32_t max_bits = 0x1d00ffff;
big_number max_target();
diff --git a/include/bitcoin/error.hpp b/include/bitcoin/error.hpp
index 2416206..49aa769 100644
--- a/include/bitcoin/error.hpp
+++ b/include/bitcoin/error.hpp
@@ -21,6 +21,7 @@
#define LIBBITCOIN_STORAGE_ERRORS_HPP
#include <system_error>
+#include <string>
namespace libbitcoin {
diff --git a/src/block.cpp b/src/block.cpp
index f9d9b2d..fa33476 100644
--- a/src/block.cpp
+++ b/src/block.cpp
@@ -85,10 +85,10 @@ block_type genesis_block()
header.version = 1;
header.previous_block_hash = null_hash;
header.merkle =
- hash_digest{0x4a, 0x5e, 0x1e, 0x4b, 0xaa, 0xb8, 0x9f, 0x3a,
- 0x32, 0x51, 0x8a, 0x88, 0xc3, 0x1b, 0xc8, 0x7f,
- 0x61, 0x8f, 0x76, 0x67, 0x3e, 0x2c, 0xc7, 0x7a,
- 0xb2, 0x12, 0x7b, 0x7a, 0xfd, 0xed, 0xa3, 0x3b};
+ hash_digest{{0x4a, 0x5e, 0x1e, 0x4b, 0xaa, 0xb8, 0x9f, 0x3a,
+ 0x32, 0x51, 0x8a, 0x88, 0xc3, 0x1b, 0xc8, 0x7f,
+ 0x61, 0x8f, 0x76, 0x67, 0x3e, 0x2c, 0xc7, 0x7a,
+ 0xb2, 0x12, 0x7b, 0x7a, 0xfd, 0xed, 0xa3, 0x3b}};
header.bits = 0x1d00ffff;
#ifdef ENABLE_TESTNET
header.timestamp = 1296688602;
diff --git a/src/blockchain/organizer.cpp b/src/blockchain/organizer.cpp
index 447378a..8db6467 100644
--- a/src/blockchain/organizer.cpp
+++ b/src/blockchain/organizer.cpp
@@ -215,7 +215,7 @@ void organizer::replace_chain(int fork_index,
// if will fail to find it. I would rather not add an exception
// there so that problems will show earlier.
// All arrival_blocks should be blocks from the pool.
- int arrival_index = fork_index;
+ size_t arrival_index = fork_index;
for (block_detail_ptr arrival_block: orphan_chain)
{
orphans_->remove(arrival_block);
diff --git a/src/network/handshake.cpp b/src/network/handshake.cpp
index 36c7d84..23f0edc 100644
--- a/src/network/handshake.cpp
+++ b/src/network/handshake.cpp
@@ -44,9 +44,9 @@ handshake::handshake(threadpool& pool)
template_version_.address_me.ip = localhost_ip();
template_version_.address_me.port = protocol_port;
template_version_.address_you.services = template_version_.services;
- template_version_.address_you.ip =
- ip_address_type{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01};
+ template_version_.address_you.ip =
+ ip_address_type{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01}};
template_version_.address_you.port = protocol_port;
template_version_.user_agent = "/libbitcoin:" LIBBITCOIN_LIB_VERSION "/";
template_version_.start_height = 0;
@@ -161,8 +161,8 @@ bool handshake::lookup_external(const std::string& website,
ip_address_type handshake::localhost_ip()
{
- return ip_address_type{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01};
+ return ip_address_type{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x01}};
}
void handshake::do_discover_external_ip(discover_ip_handler handle_discover)
diff --git a/src/script.cpp b/src/script.cpp
index 0493a29..afe4cfe 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -892,8 +892,8 @@ inline void nullify_input_sequences(
inline hash_digest one_hash()
{
- return hash_digest{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
+ return hash_digest{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}};
}
hash_digest script_type::generate_signature_hash(
diff --git a/src/utility/big_number.cpp b/src/utility/big_number.cpp
index 080e58c..9e9e0df 100644
--- a/src/utility/big_number.cpp
+++ b/src/utility/big_number.cpp
@@ -150,8 +150,8 @@ void big_number::set_hash(hash_digest load_hash)
hash_digest big_number::hash() const
{
- hash_digest repr{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ hash_digest repr{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
data_chunk copy_data = data();
if (copy_data.size() < 4)
return repr;
diff --git a/src/validate.cpp b/src/validate.cpp
index a387edf..e8980e3 100644
--- a/src/validate.cpp
+++ b/src/validate.cpp
@@ -581,124 +581,124 @@ bool validate_block::passes_checkpoints()
#ifdef ENABLE_TESTNET
if (height_ == 546 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x2a, 0x93, 0x6c, 0xa7,
- 0x63, 0x90, 0x4c, 0x3c, 0x35, 0xfc, 0xe2, 0xf3,
- 0x55, 0x6c, 0x55, 0x9c, 0x02, 0x14, 0x34, 0x5d,
- 0x31, 0xb1, 0xbc, 0xeb, 0xf7, 0x6a, 0xcb, 0x70})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x2a, 0x93, 0x6c, 0xa7,
+ 0x63, 0x90, 0x4c, 0x3c, 0x35, 0xfc, 0xe2, 0xf3,
+ 0x55, 0x6c, 0x55, 0x9c, 0x02, 0x14, 0x34, 0x5d,
+ 0x31, 0xb1, 0xbc, 0xeb, 0xf7, 0x6a, 0xcb, 0x70}})
return false;
return true;
#else
if (height_ == 11111 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x69, 0xe2, 0x44, 0xf7,
- 0x3d, 0x78, 0xe8, 0xfd, 0x29, 0xba, 0x2f, 0xd2,
- 0xed, 0x61, 0x8b, 0xd6, 0xfa, 0x2e, 0xe9, 0x25,
- 0x59, 0xf5, 0x42, 0xfd, 0xb2, 0x6e, 0x7c, 0x1d})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x69, 0xe2, 0x44, 0xf7,
+ 0x3d, 0x78, 0xe8, 0xfd, 0x29, 0xba, 0x2f, 0xd2,
+ 0xed, 0x61, 0x8b, 0xd6, 0xfa, 0x2e, 0xe9, 0x25,
+ 0x59, 0xf5, 0x42, 0xfd, 0xb2, 0x6e, 0x7c, 0x1d}})
return false;
if (height_ == 33333 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x2d, 0xd5, 0x58, 0x8a,
- 0x74, 0x78, 0x4e, 0xaa, 0x7a, 0xb0, 0x50, 0x7a,
- 0x18, 0xad, 0x16, 0xa2, 0x36, 0xe7, 0xb1, 0xce,
- 0x69, 0xf0, 0x0d, 0x7d, 0xdf, 0xb5, 0xd0, 0xa6})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x2d, 0xd5, 0x58, 0x8a,
+ 0x74, 0x78, 0x4e, 0xaa, 0x7a, 0xb0, 0x50, 0x7a,
+ 0x18, 0xad, 0x16, 0xa2, 0x36, 0xe7, 0xb1, 0xce,
+ 0x69, 0xf0, 0x0d, 0x7d, 0xdf, 0xb5, 0xd0, 0xa6}})
return false;
if (height_ == 68555 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1b, 0x49,
- 0x03, 0x55, 0x0a, 0x0b, 0x96, 0xe9, 0xa9, 0x40,
- 0x5c, 0x8a, 0x95, 0xf3, 0x87, 0x16, 0x2e, 0x49,
- 0x44, 0xe8, 0xd9, 0xfb, 0xe5, 0x01, 0xcd, 0x6a})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1b, 0x49,
+ 0x03, 0x55, 0x0a, 0x0b, 0x96, 0xe9, 0xa9, 0x40,
+ 0x5c, 0x8a, 0x95, 0xf3, 0x87, 0x16, 0x2e, 0x49,
+ 0x44, 0xe8, 0xd9, 0xfb, 0xe5, 0x01, 0xcd, 0x6a}})
return false;
if (height_ == 70567 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x49, 0xb1,
- 0x4b, 0xcf, 0x27, 0x46, 0x20, 0x68, 0xf1, 0x26,
- 0x4c, 0x96, 0x1f, 0x11, 0xfa, 0x2e, 0x0e, 0xdd,
- 0xd2, 0xbe, 0x07, 0x91, 0xe1, 0xd4, 0x12, 0x4a})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x49, 0xb1,
+ 0x4b, 0xcf, 0x27, 0x46, 0x20, 0x68, 0xf1, 0x26,
+ 0x4c, 0x96, 0x1f, 0x11, 0xfa, 0x2e, 0x0e, 0xdd,
+ 0xd2, 0xbe, 0x07, 0x91, 0xe1, 0xd4, 0x12, 0x4a}})
return false;
if (height_ == 74000 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x39, 0x93,
- 0xa3, 0xc9, 0xe4, 0x1c, 0xe3, 0x44, 0x71, 0xc0,
- 0x79, 0xdc, 0xf5, 0xf5, 0x2a, 0x0e, 0x82, 0x4a,
- 0x81, 0xe7, 0xf9, 0x53, 0xb8, 0x66, 0x1a, 0x20})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x39, 0x93,
+ 0xa3, 0xc9, 0xe4, 0x1c, 0xe3, 0x44, 0x71, 0xc0,
+ 0x79, 0xdc, 0xf5, 0xf5, 0x2a, 0x0e, 0x82, 0x4a,
+ 0x81, 0xe7, 0xf9, 0x53, 0xb8, 0x66, 0x1a, 0x20}})
return false;
if (height_ == 105000 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x91, 0xce,
- 0x28, 0x02, 0x7f, 0xae, 0xa3, 0x20, 0xc8, 0xd2,
- 0xb0, 0x54, 0xb2, 0xe0, 0xfe, 0x44, 0xa7, 0x73,
- 0xf3, 0xee, 0xfb, 0x15, 0x1d, 0x6b, 0xdc, 0x97})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x91, 0xce,
+ 0x28, 0x02, 0x7f, 0xae, 0xa3, 0x20, 0xc8, 0xd2,
+ 0xb0, 0x54, 0xb2, 0xe0, 0xfe, 0x44, 0xa7, 0x73,
+ 0xf3, 0xee, 0xfb, 0x15, 0x1d, 0x6b, 0xdc, 0x97}})
return false;
if (height_ == 118000 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x4a,
- 0x7f, 0x8a, 0x7a, 0x12, 0xdc, 0x90, 0x6d, 0xdb,
- 0x9e, 0x17, 0xe7, 0x5d, 0x68, 0x4f, 0x15, 0xe0,
- 0x0f, 0x87, 0x67, 0xf9, 0xe8, 0xf3, 0x65, 0x53})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x4a,
+ 0x7f, 0x8a, 0x7a, 0x12, 0xdc, 0x90, 0x6d, 0xdb,
+ 0x9e, 0x17, 0xe7, 0x5d, 0x68, 0x4f, 0x15, 0xe0,
+ 0x0f, 0x87, 0x67, 0xf9, 0xe8, 0xf3, 0x65, 0x53}})
return false;
if (height_ == 134444 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xb1,
- 0x2f, 0xfd, 0x4c, 0xd3, 0x15, 0xcd, 0x34, 0xff,
- 0xd4, 0xa5, 0x94, 0xf4, 0x30, 0xac, 0x81, 0x4c,
- 0x91, 0x18, 0x4a, 0x0d, 0x42, 0xd2, 0xb0, 0xfe})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xb1,
+ 0x2f, 0xfd, 0x4c, 0xd3, 0x15, 0xcd, 0x34, 0xff,
+ 0xd4, 0xa5, 0x94, 0xf4, 0x30, 0xac, 0x81, 0x4c,
+ 0x91, 0x18, 0x4a, 0x0d, 0x42, 0xd2, 0xb0, 0xfe}})
return false;
if (height_ == 140700 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3b,
- 0x51, 0x20, 0x28, 0xab, 0xb9, 0x0e, 0x16, 0x26,
- 0xd8, 0xb3, 0x46, 0xfd, 0x0e, 0xd5, 0x98, 0xac,
- 0x0a, 0x3c, 0x37, 0x11, 0x38, 0xdc, 0xe2, 0xbd})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3b,
+ 0x51, 0x20, 0x28, 0xab, 0xb9, 0x0e, 0x16, 0x26,
+ 0xd8, 0xb3, 0x46, 0xfd, 0x0e, 0xd5, 0x98, 0xac,
+ 0x0a, 0x3c, 0x37, 0x11, 0x38, 0xdc, 0xe2, 0xbd}})
return false;
if (height_ == 168000 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x9e,
- 0x61, 0xea, 0x72, 0x01, 0x5e, 0x79, 0x63, 0x2f,
- 0x21, 0x6f, 0xe6, 0xcb, 0x33, 0xd7, 0x89, 0x9a,
- 0xcb, 0x35, 0xb7, 0x5c, 0x83, 0x03, 0xb7, 0x63})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x9e,
+ 0x61, 0xea, 0x72, 0x01, 0x5e, 0x79, 0x63, 0x2f,
+ 0x21, 0x6f, 0xe6, 0xcb, 0x33, 0xd7, 0x89, 0x9a,
+ 0xcb, 0x35, 0xb7, 0x5c, 0x83, 0x03, 0xb7, 0x63}})
return false;
if (height_ == 193000 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x9f,
- 0x45, 0x2a, 0x5f, 0x73, 0x40, 0xde, 0x66, 0x82,
- 0xa9, 0x77, 0x38, 0x7c, 0x17, 0x01, 0x0f, 0xf6,
- 0xe6, 0xc3, 0xbd, 0x83, 0xca, 0x8b, 0x13, 0x17})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x9f,
+ 0x45, 0x2a, 0x5f, 0x73, 0x40, 0xde, 0x66, 0x82,
+ 0xa9, 0x77, 0x38, 0x7c, 0x17, 0x01, 0x0f, 0xf6,
+ 0xe6, 0xc3, 0xbd, 0x83, 0xca, 0x8b, 0x13, 0x17}})
return false;
if (height_ == 210000 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x8b,
- 0x95, 0x34, 0x7e, 0x83, 0x19, 0x2f, 0x69, 0xcf,
- 0x03, 0x66, 0x07, 0x63, 0x36, 0xc6, 0x39, 0xf9,
- 0xb7, 0x22, 0x8e, 0x9b, 0xa1, 0x71, 0x34, 0x2e})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x8b,
+ 0x95, 0x34, 0x7e, 0x83, 0x19, 0x2f, 0x69, 0xcf,
+ 0x03, 0x66, 0x07, 0x63, 0x36, 0xc6, 0x39, 0xf9,
+ 0xb7, 0x22, 0x8e, 0x9b, 0xa1, 0x71, 0x34, 0x2e}})
return false;
if (height_ == 216116 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb4,
- 0xf4, 0xb4, 0x33, 0xe8, 0x1e, 0xe4, 0x64, 0x94,
- 0xaf, 0x94, 0x5c, 0xf9, 0x60, 0x14, 0x81, 0x6a,
- 0x4e, 0x23, 0x70, 0xf1, 0x1b, 0x23, 0xdf, 0x4e})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb4,
+ 0xf4, 0xb4, 0x33, 0xe8, 0x1e, 0xe4, 0x64, 0x94,
+ 0xaf, 0x94, 0x5c, 0xf9, 0x60, 0x14, 0x81, 0x6a,
+ 0x4e, 0x23, 0x70, 0xf1, 0x1b, 0x23, 0xdf, 0x4e}})
return false;
if (height_ == 225430 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc1,
- 0x08, 0x38, 0x43, 0x50, 0xf7, 0x40, 0x90, 0x43,
- 0x3e, 0x7f, 0xcf, 0x79, 0xa6, 0x06, 0xb8, 0xe7,
- 0x97, 0xf0, 0x65, 0xb1, 0x30, 0x57, 0x59, 0x32})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc1,
+ 0x08, 0x38, 0x43, 0x50, 0xf7, 0x40, 0x90, 0x43,
+ 0x3e, 0x7f, 0xcf, 0x79, 0xa6, 0x06, 0xb8, 0xe7,
+ 0x97, 0xf0, 0x65, 0xb1, 0x30, 0x57, 0x59, 0x32}})
return false;
if (height_ == 250000 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
- 0x87, 0xdf, 0x1f, 0x29, 0x02, 0x4b, 0x06, 0xfc,
- 0x22, 0x00, 0xb5, 0x5f, 0x8a, 0xf8, 0xf3, 0x54,
- 0x53, 0xd7, 0xbe, 0x29, 0x4d, 0xf2, 0xd2, 0x14})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
+ 0x87, 0xdf, 0x1f, 0x29, 0x02, 0x4b, 0x06, 0xfc,
+ 0x22, 0x00, 0xb5, 0x5f, 0x8a, 0xf8, 0xf3, 0x54,
+ 0x53, 0xd7, 0xbe, 0x29, 0x4d, 0xf2, 0xd2, 0x14}})
return false;
if (height_ == 278702 && block_hash !=
- hash_digest{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
- 0xe1, 0xb1, 0xe1, 0x19, 0x05, 0x3e, 0xd2, 0x4f,
- 0xb2, 0x36, 0xba, 0x4a, 0xda, 0x09, 0xea, 0x5b,
- 0x77, 0xc3, 0x67, 0xdc, 0x96, 0x96, 0x19, 0x7c})
+ hash_digest{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0xe1, 0xb1, 0xe1, 0x19, 0x05, 0x3e, 0xd2, 0x4f,
+ 0xb2, 0x36, 0xba, 0x4a, 0xda, 0x09, 0xea, 0x5b,
+ 0x77, 0xc3, 0x67, 0xdc, 0x96, 0x96, 0x19, 0x7c}})
return false;
return true;
--
1.8.5.4