Add WriteUVarint to ByteBufferWriter and ReadUVarint to ByteBufferReader
Methods to write/read a varint as described by
https://developers.google.com/protocol-buffers/docs/encoding#varints
that will be used for a QUIC data channel.
Split from CL https://codereview.webrtc.org/1844803002/.
Review URL: https://codereview.webrtc.org/1844333006
Cr-Commit-Position: refs/heads/master@{#12322}
diff --git a/webrtc/base/bytebuffer.h b/webrtc/base/bytebuffer.h
index 8fd0863..cd7b2c6 100644
--- a/webrtc/base/bytebuffer.h
+++ b/webrtc/base/bytebuffer.h
@@ -57,6 +57,7 @@
void WriteUInt24(uint32_t val);
void WriteUInt32(uint32_t val);
void WriteUInt64(uint64_t val);
+ void WriteUVarint(uint64_t val);
void WriteString(const std::string& val);
void WriteBytes(const char* val, size_t len);
@@ -110,6 +111,7 @@
bool ReadUInt24(uint32_t* val);
bool ReadUInt32(uint32_t* val);
bool ReadUInt64(uint64_t* val);
+ bool ReadUVarint(uint64_t* val);
bool ReadBytes(char* val, size_t len);
// Appends next |len| bytes from the buffer to |val|. Returns false