OSDN Git Service

libbufferhub: Fix compiler warning with printf format mismatch
authorAlex Vakulenko <avakulenko@google.com>
Fri, 31 Mar 2017 15:29:28 +0000 (08:29 -0700)
committerAlex Vakulenko <avakulenko@google.com>
Fri, 31 Mar 2017 17:45:52 +0000 (10:45 -0700)
commita1336cf0decf0bafeae874dfcb1521339165a9b9
tree55ab61d58ebb70a3e03c1be04fe118fb3045a28e
parent4782814b340bb55a0fbff9f7b6cfd4d27cffd85a
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
libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp