From 5d2fdc2e8c8b3d95c0a82f7f910ab63cec00cbbb Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 1 Feb 2019 15:00:54 +0100 Subject: [PATCH 1/3] serialization: Use pos_type instead of streampos According to [1], the ios_base::streampos member type is deprecated, and removed in C++17. This type was an alias for pos_type, which this commit uses instead. [1]: https://en.cppreference.com/w/cpp/io/ios_base --- src/serialization/binary_archive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/serialization/binary_archive.h b/src/serialization/binary_archive.h index f47a4494d..242b8fd68 100644 --- a/src/serialization/binary_archive.h +++ b/src/serialization/binary_archive.h @@ -99,7 +99,7 @@ struct binary_archive : public binary_archive_base { explicit binary_archive(stream_type &s) : base_type(s) { - stream_type::streampos pos = stream_.tellg(); + stream_type::pos_type pos = stream_.tellg(); stream_.seekg(0, std::ios_base::end); eof_pos_ = stream_.tellg(); stream_.seekg(pos); From 9bf0e5375134a0d230bc966f439f69a09c1556cb Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 1 Feb 2019 15:02:39 +0100 Subject: [PATCH 2/3] cryptonote: Add const-qualifier on comparison functor The original code did not compile with GCC 8.2.1 in C++17 mode, since comparison functions for std::set's must be invocable as const. --- src/cryptonote_core/tx_pool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index 670d70d77..8dd0337f0 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -61,7 +61,7 @@ namespace cryptonote class txCompare { public: - bool operator()(const tx_by_fee_and_receive_time_entry& a, const tx_by_fee_and_receive_time_entry& b) + bool operator()(const tx_by_fee_and_receive_time_entry& a, const tx_by_fee_and_receive_time_entry& b) const { // sort by greatest first, not least if (a.first.first > b.first.first) return true; From fec359a641986784c1f0e99ae215bcae9f4380bc Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 1 Feb 2019 15:20:13 +0100 Subject: [PATCH 3/3] cryptonote: Fix enum check in expand_transaction_2 This was noticed because GCC warned about using an enum value in a boolean context. --- src/cryptonote_core/blockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 41357e72e..09b67a64b 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2600,7 +2600,7 @@ bool Blockchain::expand_transaction_2(transaction &tx, const crypto::hash &tx_pr for (size_t n = 0; n < tx.vin.size(); ++n) rv.p.MGs[0].II[n] = rct::ki2rct(boost::get(tx.vin[n]).k_image); } - else if (rv.type == rct::RCTTypeSimple || rv.type == rct::RCTTypeBulletproof || rct::RCTTypeBulletproof2) + else if (rv.type == rct::RCTTypeSimple || rv.type == rct::RCTTypeBulletproof || rv.type == rct::RCTTypeBulletproof2) { CHECK_AND_ASSERT_MES(rv.p.MGs.size() == tx.vin.size(), false, "Bad MGs size"); for (size_t n = 0; n < tx.vin.size(); ++n)