mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-26 06:31:50 +08:00
Make use of base::fixed_extent<>
.
Bug: none Change-Id: Ia07ebfdd5927e545e3c19b98dc545e7f75ef46ac Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6091638 Commit-Queue: Peter Kasting <pkasting@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
4826f5a3b0
commit
6419a2e697
@ -60,12 +60,12 @@ void UUID::InitializeToZero() {
|
|||||||
void UUID::InitializeFromBytes(const uint8_t* bytes_ptr) {
|
void UUID::InitializeFromBytes(const uint8_t* bytes_ptr) {
|
||||||
// TODO(crbug.com/40284755): This span construction is unsound. The caller
|
// TODO(crbug.com/40284755): This span construction is unsound. The caller
|
||||||
// should provide a span instead of an unbounded pointer.
|
// should provide a span instead of an unbounded pointer.
|
||||||
base::span<const uint8_t, sizeof(UUID)> bytes(bytes_ptr, sizeof(UUID));
|
base::span bytes(bytes_ptr, base::fixed_extent<sizeof(UUID)>());
|
||||||
data_1 = base::numerics::U32FromBigEndian(bytes.subspan<0u, 4u>());
|
data_1 = base::numerics::U32FromBigEndian(bytes.subspan<0u, 4u>());
|
||||||
data_2 = base::numerics::U16FromBigEndian(bytes.subspan<4u, 2u>());
|
data_2 = base::numerics::U16FromBigEndian(bytes.subspan<4u, 2u>());
|
||||||
data_3 = base::numerics::U16FromBigEndian(bytes.subspan<6u, 2u>());
|
data_3 = base::numerics::U16FromBigEndian(bytes.subspan<6u, 2u>());
|
||||||
std::ranges::copy(bytes.subspan<8u, 2u>(), data_4);
|
std::ranges::copy(bytes.subspan<8, 2>(), data_4);
|
||||||
std::ranges::copy(bytes.subspan<10u, 6u>(), data_5);
|
std::ranges::copy(bytes.subspan<10, 6>(), data_5);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UUID::InitializeFromString(const base::StringPiece& string) {
|
bool UUID::InitializeFromString(const base::StringPiece& string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user