diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /third_party/libwebrtc/rtc_base/byte_buffer.cc | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/rtc_base/byte_buffer.cc')
-rw-r--r-- | third_party/libwebrtc/rtc_base/byte_buffer.cc | 22 |
1 files changed, 9 insertions, 13 deletions
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<const uint8_t> bytes) { Construct(bytes.data(), bytes.size()); } -ByteBufferReader::ByteBufferReader(const char* bytes, size_t len) { - Construct(reinterpret_cast<const uint8_t*>(bytes), len); -} - -ByteBufferReader::ByteBufferReader(const char* bytes) { - Construct(reinterpret_cast<const uint8_t*>(bytes), strlen(bytes)); -} - ByteBufferReader::ByteBufferReader(const ByteBufferWriter& buf) { Construct(reinterpret_cast<const uint8_t*>(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<const char*>(bytes_ + start_), len); + start_ += len; + return true; +} + bool ByteBufferReader::ReadBytes(rtc::ArrayView<uint8_t> val) { if (val.size() == 0) { return true; @@ -147,10 +147,6 @@ bool ByteBufferReader::ReadBytes(rtc::ArrayView<uint8_t> val) { return ReadBytes(val.data(), val.size()); } -bool ByteBufferReader::ReadBytes(char* val, size_t len) { - return ReadBytes(reinterpret_cast<uint8_t*>(val), len); -} - // Private function supporting the other Read* functions. bool ByteBufferReader::ReadBytes(uint8_t* val, size_t len) { if (len > Length()) { |