diff --git a/src/bip324.cpp b/src/bip324.cpp index f579a25193a..89766098f1f 100644 --- a/src/bip324.cpp +++ b/src/bip324.cpp @@ -22,8 +22,8 @@ #include #include -BIP324Cipher::BIP324Cipher(const CKey& key, Span ent32) noexcept : - m_key(key) +BIP324Cipher::BIP324Cipher(const CKey& key, std::span ent32) noexcept + : m_key(key) { m_our_pubkey = m_key.EllSwiftCreate(ent32); } diff --git a/src/bip324.h b/src/bip324.h index 28e7c411eaa..dd537ecec1d 100644 --- a/src/bip324.h +++ b/src/bip324.h @@ -45,7 +45,7 @@ public: BIP324Cipher() = delete; /** Initialize a BIP324 cipher with specified key and encoding entropy (testing only). */ - BIP324Cipher(const CKey& key, Span ent32) noexcept; + BIP324Cipher(const CKey& key, std::span ent32) noexcept; /** Initialize a BIP324 cipher with specified key (testing only). */ BIP324Cipher(const CKey& key, const EllSwiftPubKey& pubkey) noexcept; diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 8fb366515af..d48c725c069 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -402,12 +402,12 @@ void CDBIterator::SeekImpl(Span key) m_impl_iter->iter->Seek(slKey); } -Span CDBIterator::GetKeyImpl() const +std::span CDBIterator::GetKeyImpl() const { return MakeByteSpan(m_impl_iter->iter->key()); } -Span CDBIterator::GetValueImpl() const +std::span CDBIterator::GetValueImpl() const { return MakeByteSpan(m_impl_iter->iter->value()); } diff --git a/src/dbwrapper.h b/src/dbwrapper.h index dd5daa7a1fc..7a2c9291772 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -130,8 +130,8 @@ private: const std::unique_ptr m_impl_iter; void SeekImpl(Span key); - Span GetKeyImpl() const; - Span GetValueImpl() const; + std::span GetKeyImpl() const; + std::span GetValueImpl() const; public: diff --git a/src/pubkey.cpp b/src/pubkey.cpp index fb25ebd4ca7..cf2cb138a48 100644 --- a/src/pubkey.cpp +++ b/src/pubkey.cpp @@ -353,7 +353,7 @@ bool CPubKey::Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChi return true; } -EllSwiftPubKey::EllSwiftPubKey(Span ellswift) noexcept +EllSwiftPubKey::EllSwiftPubKey(std::span ellswift) noexcept { assert(ellswift.size() == SIZE); std::copy(ellswift.begin(), ellswift.end(), m_pubkey.begin()); diff --git a/src/pubkey.h b/src/pubkey.h index b4666aad228..b802c69ba80 100644 --- a/src/pubkey.h +++ b/src/pubkey.h @@ -317,7 +317,7 @@ public: EllSwiftPubKey() noexcept = default; /** Construct a new ellswift public key from a given serialization. */ - EllSwiftPubKey(Span ellswift) noexcept; + EllSwiftPubKey(std::span ellswift) noexcept; /** Decode to normal compressed CPubKey (for debugging purposes). */ CPubKey Decode() const; diff --git a/src/span.h b/src/span.h index 93718f61895..69baaf2708e 100644 --- a/src/span.h +++ b/src/span.h @@ -266,14 +266,14 @@ Span AsWritableBytes(Span s) noexcept } template -Span MakeByteSpan(V&& v) noexcept +auto MakeByteSpan(const V& v) noexcept { - return AsBytes(Span{std::forward(v)}); + return std::as_bytes(std::span{v}); } template -Span MakeWritableByteSpan(V&& v) noexcept +auto MakeWritableByteSpan(V&& v) noexcept { - return AsWritableBytes(Span{std::forward(v)}); + return std::as_writable_bytes(std::span{std::forward(v)}); } // Helper functions to safely cast basic byte pointers to unsigned char pointers. diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 4cacbd1151f..6ac6d30d6c5 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE(util_HexStr) constexpr std::string_view out_exp{"04678afdb0"}; constexpr std::span in_s{HEX_PARSE_OUTPUT, out_exp.size() / 2}; const Span in_u{MakeUCharSpan(in_s)}; - const Span in_b{MakeByteSpan(in_s)}; + const std::span in_b{MakeByteSpan(in_s)}; BOOST_CHECK_EQUAL(HexStr(in_u), out_exp); BOOST_CHECK_EQUAL(HexStr(in_s), out_exp);