diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 17:21:03 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 16:25:15 +0000 |
commit | c551f43206405019121bd2b2c93714319a0a3300 (patch) | |
tree | 1f48c30631c421fd4bbb3c36da20183c8a2ed7d7 /chromium/base/big_endian.h | |
parent | 7961cea6d1041e3e454dae6a1da660b453efd238 (diff) |
BASELINE: Update Chromium to 79.0.3945.139
Change-Id: I336b7182fab9bca80b709682489c07db112eaca5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/base/big_endian.h')
-rw-r--r-- | chromium/base/big_endian.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/chromium/base/big_endian.h b/chromium/base/big_endian.h index 8fea64f248d..96650a6955f 100644 --- a/chromium/base/big_endian.h +++ b/chromium/base/big_endian.h @@ -67,10 +67,26 @@ class BASE_EXPORT BigEndianReader { bool ReadU32(uint32_t* value); bool ReadU64(uint64_t* value); + // Reads a length-prefixed region: + // 1. reads a big-endian length L from the buffer; + // 2. sets |*out| to a StringPiece over the next L many bytes + // of the buffer (beyond the end of the bytes encoding the length); and + // 3. skips the main reader past this L-byte substring. + // + // Fails if reading a U8 or U16 fails, or if the parsed length is greater + // than the number of bytes remaining in the stream. + // + // On failure, leaves the stream at the same position + // as before the call. + bool ReadU8LengthPrefixed(base::StringPiece* out); + bool ReadU16LengthPrefixed(base::StringPiece* out); + private: // Hidden to promote type safety. template<typename T> bool Read(T* v); + template <typename T> + bool ReadLengthPrefixed(base::StringPiece* out); const char* ptr_; const char* end_; |