summaryrefslogtreecommitdiff
path: root/base/big_endian.h
diff options
context:
space:
mode:
authorCronet Mainline Eng <cronet-mainline-eng+copybara@google.com>2024-05-28 13:59:50 +0900
committerMotomu Utsumi <motomuman@google.com>2024-05-28 14:11:54 +0900
commit168f7e285114554eb2ac9bc22343cca461355b50 (patch)
treec65ccc97fb3dc01e329951c1c7c7901aef7b7a2a /base/big_endian.h
parent5cfdd35118d5a23349255971e97737e32895ec0f (diff)
downloadcronet-168f7e285114554eb2ac9bc22343cca461355b50.tar.gz
Import Cronet version 122.0.6261.43
FolderOrigin-RevId: /tmp/copybara-origin/src Change-Id: Ifb7b548cde690e10cc102366bc538e744efa902b
Diffstat (limited to 'base/big_endian.h')
-rw-r--r--base/big_endian.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/base/big_endian.h b/base/big_endian.h
index c7845fb1b..37e794738 100644
--- a/base/big_endian.h
+++ b/base/big_endian.h
@@ -84,10 +84,21 @@ class BASE_EXPORT BigEndianReader {
public:
static BigEndianReader FromStringPiece(base::StringPiece string_piece);
- BigEndianReader(const uint8_t* buf, size_t len);
explicit BigEndianReader(base::span<const uint8_t> buf);
+ // TODO(crbug.com/1490484): Remove this overload.
+ BigEndianReader(const uint8_t* buf, size_t len);
+
+ // Returns a span over all unread bytes.
+ span<const uint8_t> remaining_bytes() const {
+ // SAFETY: The cast value is non-negative because `ptr_` is never moved past
+ // `end_`.
+ return make_span(ptr_, static_cast<size_t>(end_ - ptr_));
+ }
+
+ // TODO(crbug.com/1490484): Remove this method.
const uint8_t* ptr() const { return ptr_; }
+ // TODO(crbug.com/1490484): Remove this method.
size_t remaining() const { return static_cast<size_t>(end_ - ptr_); }
bool Skip(size_t len);