Skip to content

Commit

Permalink
zookeeper: more constness (#7481)
Browse files Browse the repository at this point in the history
Spotted these while working on part 2 of the filter, but
sending them out now to keep nits separate.

Signed-off-by: Raul Gutierrez Segales <rgs@pinterest.com>
  • Loading branch information
Raúl Gutiérrez Segalés authored and mattklein123 committed Jul 8, 2019
1 parent 7032710 commit 18b8f19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions source/extensions/filters/network/zookeeper_proxy/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ namespace ZooKeeperProxy {
int32_t BufferHelper::peekInt32(Buffer::Instance& buffer, uint64_t& offset) {
ensureMaxLen(sizeof(int32_t));

int32_t val = buffer.peekBEInt<int32_t>(offset);
const int32_t val = buffer.peekBEInt<int32_t>(offset);
offset += sizeof(int32_t);
return val;
}

int64_t BufferHelper::peekInt64(Buffer::Instance& buffer, uint64_t& offset) {
ensureMaxLen(sizeof(int64_t));

int64_t val = buffer.peekBEInt<int64_t>(offset);
const int64_t val = buffer.peekBEInt<int64_t>(offset);
offset += sizeof(int64_t);
return val;
}
Expand All @@ -34,7 +34,7 @@ bool BufferHelper::peekBool(Buffer::Instance& buffer, uint64_t& offset) {

std::string BufferHelper::peekString(Buffer::Instance& buffer, uint64_t& offset) {
std::string val;
uint32_t len = peekInt32(buffer, offset);
const uint32_t len = peekInt32(buffer, offset);

if (len == 0) {
return val;
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/filters/network/zookeeper_proxy/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BufferHelper : public Logger::Loggable<Logger::Id::filter> {
private:
void ensureMaxLen(uint32_t size);

uint32_t max_len_;
const uint32_t max_len_;
uint32_t current_{};
};

Expand Down

0 comments on commit 18b8f19

Please sign in to comment.