diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /third_party/libwebrtc/api/transport/stun.h | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/api/transport/stun.h')
-rw-r--r-- | third_party/libwebrtc/api/transport/stun.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/third_party/libwebrtc/api/transport/stun.h b/third_party/libwebrtc/api/transport/stun.h index 4a04db33cf..62d98f71e0 100644 --- a/third_party/libwebrtc/api/transport/stun.h +++ b/third_party/libwebrtc/api/transport/stun.h @@ -519,13 +519,22 @@ class StunByteStringAttribute : public StunAttribute { StunAttributeValueType value_type() const override; - const char* bytes() const { return bytes_; } + [[deprecated("Use array_view")]] const char* bytes() const { + return reinterpret_cast<const char*>(bytes_); + } + // Returns the attribute value as a string. + // Use this for attributes that are text or text-compatible. absl::string_view string_view() const { - return absl::string_view(bytes_, length()); + return absl::string_view(reinterpret_cast<const char*>(bytes_), length()); + } + // Returns the attribute value as an uint8_t view. + // Use this function for values that are not text. + rtc::ArrayView<uint8_t> array_view() const { + return rtc::MakeArrayView(bytes_, length()); } [[deprecated]] std::string GetString() const { - return std::string(bytes_, length()); + return std::string(reinterpret_cast<const char*>(bytes_), length()); } void CopyBytes(const void* bytes, size_t length); @@ -538,9 +547,9 @@ class StunByteStringAttribute : public StunAttribute { bool Write(rtc::ByteBufferWriter* buf) const override; private: - void SetBytes(char* bytes, size_t length); + void SetBytes(uint8_t* bytes, size_t length); - char* bytes_; + uint8_t* bytes_; }; // Implements STUN attributes that record an error code. |