Update BitBuffer methods to style guide

Specifically, use reference instead of pointer for out parameter
and place the out parameter last, for the following methods

ReadUInt8
ReadUInt16
ReadUInt32
ReadBits
PeekBits
ReadNonSymmetric
ReadSignedExponentialGolomb
ReadExponentialGolomb

Bug: webrtc:11933
Change-Id: I3f1efe3e29155985277b0cd18700ddea25fe7914
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/218504
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34037}
This commit is contained in:
Björn Terelius
2021-05-17 17:20:53 +02:00
committed by WebRTC LUCI CQ
parent 7c286c062c
commit a77e16ca2c
12 changed files with 289 additions and 261 deletions

View File

@ -52,7 +52,7 @@ class BitstreamReader {
std::function<bool()> f_true,
std::function<bool()> f_false = [] { return true; }) {
uint32_t val;
if (!buffer_->ReadBits(&val, 1)) {
if (!buffer_->ReadBits(1, val)) {
return false;
}
if (val != 0) {
@ -63,7 +63,7 @@ class BitstreamReader {
absl::optional<bool> ReadBoolean() {
uint32_t val;
if (!buffer_->ReadBits(&val, 1)) {
if (!buffer_->ReadBits(1, val)) {
return {};
}
return {val != 0};
@ -76,7 +76,7 @@ class BitstreamReader {
// logged as warning, if provided.
bool VerifyNextBooleanIs(bool expected_val, absl::string_view error_msg) {
uint32_t val;
if (!buffer_->ReadBits(&val, 1)) {
if (!buffer_->ReadBits(1, val)) {
return false;
}
if ((val != 0) != expected_val) {
@ -100,7 +100,7 @@ class BitstreamReader {
RTC_DCHECK_LE(bits, 32);
RTC_DCHECK_LE(bits, sizeof(T) * 8);
uint32_t val;
if (!buffer_->ReadBits(&val, bits)) {
if (!buffer_->ReadBits(bits, val)) {
return {};
}
return (static_cast<T>(val));
@ -115,7 +115,7 @@ class BitstreamReader {
uint32_t expected_val,
absl::string_view error_msg) {
uint32_t val;
if (!buffer_->ReadBits(&val, num_bits)) {
if (!buffer_->ReadBits(num_bits, val)) {
return false;
}
if (val != expected_val) {
@ -134,11 +134,11 @@ class BitstreamReader {
template <typename T>
absl::optional<T> ReadSigned(int bits = sizeof(T) * 8) {
uint32_t sign;
if (!buffer_->ReadBits(&sign, 1)) {
if (!buffer_->ReadBits(1, sign)) {
return {};
}
uint32_t val;
if (!buffer_->ReadBits(&val, bits)) {
if (!buffer_->ReadBits(bits, val)) {
return {};
}
int64_t sign_val = val;