Skip to content
Commit e2dd9c02 authored by danakj's avatar danakj Committed by Chromium LUCI CQ
Browse files

Convert all BigEndianWriter use to SpanWriter

base::SpanWriter can replace all use of BigEndianWriter as well as
mixed or little endian encodings in byte spans. We don't need both
types so consolidating on the more useful one: SpanWriter.

Adding a num_written() accessor to avoid users having to write
`total_size - writer.remaining()` all the time, which is also easy to
write in the wrong order and underflow.

Fix the span deduction guide to allow deducing span<T> from a legacy
range type that provides data and size. It deduces to the dereferenced
type returned from data(). This involved introducing a second copy of
an IsPointer concept, so promote it up to a single location in a
header of its own. But that collided with base::IsPointer in PA that
is meant for matching against T* and raw_ptr<T>. So rename the PA
one to IsRawPointer.

Bug: 40284755
Change-Id: Ibbed2da1023f1fcd8c7a2d183b586780bcd38621
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5425075


Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Auto-Submit: danakj <danakj@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1283608}
parent a76e3a44
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment