From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- third_party/libwebrtc/rtc_base/byte_buffer.cc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'third_party/libwebrtc/rtc_base/byte_buffer.cc') diff --git a/third_party/libwebrtc/rtc_base/byte_buffer.cc b/third_party/libwebrtc/rtc_base/byte_buffer.cc index a076f46ecb..5674d54e21 100644 --- a/third_party/libwebrtc/rtc_base/byte_buffer.cc +++ b/third_party/libwebrtc/rtc_base/byte_buffer.cc @@ -16,21 +16,13 @@ namespace rtc { ByteBufferWriter::ByteBufferWriter() : ByteBufferWriterT() {} -ByteBufferWriter::ByteBufferWriter(const char* bytes, size_t len) +ByteBufferWriter::ByteBufferWriter(const uint8_t* bytes, size_t len) : ByteBufferWriterT(bytes, len) {} ByteBufferReader::ByteBufferReader(rtc::ArrayView bytes) { Construct(bytes.data(), bytes.size()); } -ByteBufferReader::ByteBufferReader(const char* bytes, size_t len) { - Construct(reinterpret_cast(bytes), len); -} - -ByteBufferReader::ByteBufferReader(const char* bytes) { - Construct(reinterpret_cast(bytes), strlen(bytes)); -} - ByteBufferReader::ByteBufferReader(const ByteBufferWriter& buf) { Construct(reinterpret_cast(buf.Data()), buf.Length()); } @@ -140,6 +132,14 @@ bool ByteBufferReader::ReadString(std::string* val, size_t len) { } } +bool ByteBufferReader::ReadStringView(absl::string_view* val, size_t len) { + if (!val || len > Length()) + return false; + *val = absl::string_view(reinterpret_cast(bytes_ + start_), len); + start_ += len; + return true; +} + bool ByteBufferReader::ReadBytes(rtc::ArrayView val) { if (val.size() == 0) { return true; @@ -147,10 +147,6 @@ bool ByteBufferReader::ReadBytes(rtc::ArrayView val) { return ReadBytes(val.data(), val.size()); } -bool ByteBufferReader::ReadBytes(char* val, size_t len) { - return ReadBytes(reinterpret_cast(val), len); -} - // Private function supporting the other Read* functions. bool ByteBufferReader::ReadBytes(uint8_t* val, size_t len) { if (len > Length()) { -- cgit v1.2.3