[cr133] base::make_span deleted

All uses of `base::make_span` can be just `span{}`.

Chromium change:
https://chromium-review.googlesource.com/c/chromium/src/+/6066402

commit b394ea77c33ed427269ad91712467c2da6e12e7e
Author: Peter Kasting <pkasting@chromium.org>
Date:   Tue Dec 3 23:04:42 2024 +0000

    Remove make_span.

    This is no longer used.

    Bug: 341907909
This commit is contained in:
Claudio DeSouza
2025-01-27 09:41:08 -05:00
committed by Max Karolinskiy
parent 9ea0ff8e65
commit 23aabf0fe1
8 changed files with 12 additions and 10 deletions
@@ -66,7 +66,7 @@ std::wstring HashString(base::wcstring_view input) {
// there's nothing for us to do with small strings.
return std::wstring();
}
auto bytes = base::as_bytes(base::make_span(input.data(), input.size() + 1));
auto bytes = base::as_bytes(base::span(input.data(), input.size() + 1));
// Compute an MD5 hash. md5[0] and md5[1] will be used as constant multipliers
// in the scramble below.
+1 -1
View File
@@ -32,7 +32,7 @@ class StackObjectCopy {
//
// Can't use `byte_span_from_ref` because `T` might be an abstract class.
auto original_object_memory = UNSAFE_BUFFERS(
make_span(reinterpret_cast<const uint8_t*>(original), kSize));
span(reinterpret_cast<const uint8_t*>(original), kSize));
span(buffer_).copy_from(std::move(original_object_memory));
} else {
ranges::fill(buffer_, 0);
@@ -85,7 +85,7 @@ std::unique_ptr<HDKey> HDKey::GenerateFromSeed(base::span<const uint8_t> seed) {
DCHECK(out_len == kSHA512Length);
std::unique_ptr<HDKey> hdkey = std::make_unique<HDKey>();
auto hmac_span = base::make_span(hmac);
auto hmac_span = base::span(hmac);
hdkey->SetPrivateKey(hmac_span.first<kSecp256k1PrivateKeySize>());
hdkey->SetChainCode(hmac_span.last<kSecp256k1ChainCodeSize>());
return hdkey;
@@ -281,7 +281,7 @@ std::unique_ptr<HDKey> HDKey::DeriveChild(const DerivationIndex& index) {
}
DCHECK(out_len == kSHA512Length);
auto hmac_span = base::make_span(hmac);
auto hmac_span = base::span(hmac);
std::unique_ptr<HDKey> hdkey = std::make_unique<HDKey>();
hdkey->SetChainCode(hmac_span.last<kSecp256k1ChainCodeSize>());
@@ -75,7 +75,7 @@ std::vector<DerivationIndex> ParsePath(std::string_view path) {
}
std::vector<DerivationIndex> result;
for (auto entry : base::span(entries).subspan(1)) {
for (auto entry : base::span(entries).subspan(1u)) {
bool is_hardened = entry.length() > 1 && entry.back() == '\'';
if (is_hardened) {
entry.remove_suffix(1);
@@ -35,7 +35,7 @@ std::vector<uint8_t> RLPEncodeLength(size_t length, uint8_t offset) {
result[0] =
base::CheckAdd(length_encoded.size(), offset, kSingleByteLengthLimit)
.ValueOrDie<uint8_t>();
base::span(result).subspan(1).copy_from(length_encoded);
base::span(result).subspan(1u).copy_from(length_encoded);
return result;
}
@@ -155,7 +155,7 @@ FilAddress FilAddress::FromBytes(const std::string& chain_id,
mojom::FilecoinAddressProtocol protocol =
static_cast<mojom::FilecoinAddressProtocol>(bytes.front());
return FilAddress::FromPayload(bytes.subspan(1), protocol, chain_id);
return FilAddress::FromPayload(bytes.subspan(1u), protocol, chain_id);
}
// Creates FilAddress from SECP256K uncompressed public key
@@ -71,7 +71,7 @@ NSString* decode_asn1_string(bssl::der::Input value) {
if (type == V_ASN1_IA5STRING) {
std::string result;
if (bssl::der::ParseIA5String(bssl::der::Input(base::make_span(
if (bssl::der::ParseIA5String(bssl::der::Input(base::span(
data, static_cast<std::size_t>(length))),
&result)) {
return base::SysUTF8ToNSString(result);
@@ -326,7 +326,7 @@ bool pkcs7_get_signed_content(
}
for (auto&& octet : result) {
auto receipt_input_ = bssl::der::Input(base::make_span(
auto receipt_input_ = bssl::der::Input(base::span(
ASN1_STRING_data(octet.get()),
static_cast<std::size_t>(ASN1_STRING_length(octet.get()))));
+3 -1
View File
@@ -301,7 +301,9 @@ class RedirectCC {
#define main wmain
#endif // BUILDFLAG(IS_WIN)
int main(int argc, base::FilePath::CharType* argv[]) {
// SAFETY: These are runtime-provided pointers that are guaranteed to be
// valid.
RedirectCC redirect_cc(
UNSAFE_BUFFERS(base::make_span(argv, static_cast<size_t>(argc))));
UNSAFE_BUFFERS(base::span(argv, static_cast<size_t>(argc))));
return redirect_cc.Run();
}