From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- third_party/libwebrtc/api/transport/stun.cc | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'third_party/libwebrtc/api/transport/stun.cc') diff --git a/third_party/libwebrtc/api/transport/stun.cc b/third_party/libwebrtc/api/transport/stun.cc index 35a65fd8e8..7ef6852260 100644 --- a/third_party/libwebrtc/api/transport/stun.cc +++ b/third_party/libwebrtc/api/transport/stun.cc @@ -41,7 +41,9 @@ uint32_t ReduceTransactionId(absl::string_view transaction_id) { RTC_DCHECK(transaction_id.length() == cricket::kStunTransactionIdLength || transaction_id.length() == cricket::kStunLegacyTransactionIdLength) << transaction_id.length(); - ByteBufferReader reader(transaction_id.data(), transaction_id.size()); + ByteBufferReader reader(rtc::MakeArrayView( + reinterpret_cast(transaction_id.data()), + transaction_id.size())); uint32_t result = 0; uint32_t next; while (reader.ReadUInt32(&next)) { @@ -912,7 +914,8 @@ bool StunAddressAttribute::Read(ByteBufferReader* buf) { if (length() != SIZE_IP4) { return false; } - if (!buf->ReadBytes(reinterpret_cast(&v4addr), sizeof(v4addr))) { + if (!buf->ReadBytes(rtc::MakeArrayView(reinterpret_cast(&v4addr), + sizeof(v4addr)))) { return false; } rtc::IPAddress ipaddr(v4addr); @@ -922,7 +925,8 @@ bool StunAddressAttribute::Read(ByteBufferReader* buf) { if (length() != SIZE_IP6) { return false; } - if (!buf->ReadBytes(reinterpret_cast(&v6addr), sizeof(v6addr))) { + if (!buf->ReadBytes(rtc::MakeArrayView(reinterpret_cast(&v6addr), + sizeof(v6addr)))) { return false; } rtc::IPAddress ipaddr(v6addr); @@ -1128,13 +1132,13 @@ StunAttributeValueType StunByteStringAttribute::value_type() const { } void StunByteStringAttribute::CopyBytes(absl::string_view bytes) { - char* new_bytes = new char[bytes.size()]; + uint8_t* new_bytes = new uint8_t[bytes.size()]; memcpy(new_bytes, bytes.data(), bytes.size()); SetBytes(new_bytes, bytes.size()); } void StunByteStringAttribute::CopyBytes(const void* bytes, size_t length) { - char* new_bytes = new char[length]; + uint8_t* new_bytes = new uint8_t[length]; memcpy(new_bytes, bytes, length); SetBytes(new_bytes, length); } @@ -1142,7 +1146,7 @@ void StunByteStringAttribute::CopyBytes(const void* bytes, size_t length) { uint8_t StunByteStringAttribute::GetByte(size_t index) const { RTC_DCHECK(bytes_ != NULL); RTC_DCHECK(index < length()); - return static_cast(bytes_[index]); + return bytes_[index]; } void StunByteStringAttribute::SetByte(size_t index, uint8_t value) { @@ -1152,8 +1156,8 @@ void StunByteStringAttribute::SetByte(size_t index, uint8_t value) { } bool StunByteStringAttribute::Read(ByteBufferReader* buf) { - bytes_ = new char[length()]; - if (!buf->ReadBytes(bytes_, length())) { + bytes_ = new uint8_t[length()]; + if (!buf->ReadBytes(rtc::ArrayView(bytes_, length()))) { return false; } @@ -1166,12 +1170,12 @@ bool StunByteStringAttribute::Write(ByteBufferWriter* buf) const { if (!LengthValid(type(), length())) { return false; } - buf->WriteBytes(bytes_, length()); + buf->WriteBytes(reinterpret_cast(bytes_), length()); WritePadding(buf); return true; } -void StunByteStringAttribute::SetBytes(char* bytes, size_t length) { +void StunByteStringAttribute::SetBytes(uint8_t* bytes, size_t length) { delete[] bytes_; bytes_ = bytes; SetLength(static_cast(length)); -- cgit v1.2.3