libbufferhub: Fix compiler warning with printf format mismatch
std::vector<bool>::at() does not return bool& but a special reference
proxy class. Passing this class on the stack for "%d" printf specifier
is unsafe.
Compiler throws a warning to indicate this problem:
format specifies type 'int' but the argument has type 'reference'
(aka '__bit_reference<std::__1::vector<bool, std::__1::allocator<bool>>>')
Fixed by explicitly casting to int before pushing the value onto the stack.
Bug: None
Test: `m -j32` = no more warning
Change-Id: I7b3bc4908e4932c25be60fc350e0e0b439842b66
diff --git a/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
index bd6511d..031401a 100644
--- a/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
+++ b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
@@ -146,7 +146,7 @@
ALOGW(
"Receives EPOLLHUP at slot: %zu, buffer event fd: %d, EPOLLHUP "
"pending: %d",
- slot, buffer->event_fd(), epollhup_pending_[slot]);
+ slot, buffer->event_fd(), int{epollhup_pending_[slot]});
if (epollhup_pending_[slot]) {
epollhup_pending_[slot] = false;
} else {