mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
scripted-diff: Use std::span over Span
-BEGIN VERIFY SCRIPT-
ren() { sed -i "s!\<$1\>!$2!g" $( git grep -l "$1" -- "./src" ":(exclude)src/span.h" ":(exclude)src/leveldb/db/log_test.cc" ) ; }
ren Span std::span
ren AsBytes std::as_bytes
ren AsWritableBytes std::as_writable_bytes
sed -i 's!SpanPopBack(Span!SpanPopBack(std::span!g' ./src/span.h
-END VERIFY SCRIPT-
This commit is contained in:
@@ -86,7 +86,7 @@ static const int8_t mapBase58[256] = {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string EncodeBase58(Span<const unsigned char> input)
|
||||
std::string EncodeBase58(std::span<const unsigned char> input)
|
||||
{
|
||||
// Skip & count leading zeroes.
|
||||
int zeroes = 0;
|
||||
@@ -134,7 +134,7 @@ bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vchRet, in
|
||||
return DecodeBase58(str.c_str(), vchRet, max_ret_len);
|
||||
}
|
||||
|
||||
std::string EncodeBase58Check(Span<const unsigned char> input)
|
||||
std::string EncodeBase58Check(std::span<const unsigned char> input)
|
||||
{
|
||||
// add 4-byte hash check to the end
|
||||
std::vector<unsigned char> vch(input.begin(), input.end());
|
||||
@@ -151,7 +151,7 @@ std::string EncodeBase58Check(Span<const unsigned char> input)
|
||||
return false;
|
||||
}
|
||||
// re-calculate the checksum, ensure it matches the included 4-byte checksum
|
||||
uint256 hash = Hash(Span{vchRet}.first(vchRet.size() - 4));
|
||||
uint256 hash = Hash(std::span{vchRet}.first(vchRet.size() - 4));
|
||||
if (memcmp(&hash, &vchRet[vchRet.size() - 4], 4) != 0) {
|
||||
vchRet.clear();
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user