Fix libbinder_sdk build warnings
-Wdeprecated-declarations
-Wformat
-Wpessimizing-move
-Wsign-compare
-Wsubobject-linkage
-Wunused-result
-Wzero-as-null-pointer-constant (turned on in ag/4503295)
Bug: 285204695
Test: m libbinder_sdk
Change-Id: Id4a482c511244968e450fdeecf6b9de41bc65b04
diff --git a/libs/binder/tests/binderLibTest.cpp b/libs/binder/tests/binderLibTest.cpp
index 1f61f18..9788d9d 100644
--- a/libs/binder/tests/binderLibTest.cpp
+++ b/libs/binder/tests/binderLibTest.cpp
@@ -528,8 +528,8 @@
EXPECT_EQ(NO_ERROR, IPCThreadState::self()->getProcessFreezeInfo(pid, &sync_received,
&async_received));
- EXPECT_EQ(sync_received, 1);
- EXPECT_EQ(async_received, 0);
+ EXPECT_EQ(sync_received, 1u);
+ EXPECT_EQ(async_received, 0u);
EXPECT_EQ(NO_ERROR, IPCThreadState::self()->freeze(pid, false, 0));
EXPECT_EQ(NO_ERROR, m_server->transact(BINDER_LIB_TEST_NOP_TRANSACTION, data, &reply));
@@ -1238,13 +1238,13 @@
data.setDataCapacity(1024);
// Write a bogus object at offset 0 to get an entry in the offset table
data.writeFileDescriptor(0);
- EXPECT_EQ(data.objectsCount(), 1);
+ EXPECT_EQ(data.objectsCount(), 1u);
uint8_t *parcelData = const_cast<uint8_t*>(data.data());
// And now, overwrite it with the buffer object
memcpy(parcelData, &obj, sizeof(obj));
data.setDataSize(sizeof(obj));
- EXPECT_EQ(data.objectsCount(), 1);
+ EXPECT_EQ(data.objectsCount(), 1u);
// Either the kernel should reject this transaction (if it's correct), but
// if it's not, the server implementation should return an error if it
@@ -1269,7 +1269,7 @@
data.setDataCapacity(1024);
// Write a bogus object at offset 0 to get an entry in the offset table
data.writeFileDescriptor(0);
- EXPECT_EQ(data.objectsCount(), 1);
+ EXPECT_EQ(data.objectsCount(), 1u);
uint8_t *parcelData = const_cast<uint8_t *>(data.data());
// And now, overwrite it with the weak binder
memcpy(parcelData, &obj, sizeof(obj));
@@ -1279,7 +1279,7 @@
// test with an object that libbinder will actually try to release
EXPECT_EQ(OK, data.writeStrongBinder(sp<BBinder>::make()));
- EXPECT_EQ(data.objectsCount(), 2);
+ EXPECT_EQ(data.objectsCount(), 2u);
// send it many times, since previous error was memory corruption, make it
// more likely that the server crashes
@@ -1648,8 +1648,8 @@
EXPECT_THAT(binder->setRpcClientDebug(std::move(socket), nullptr),
Debuggable(StatusEq(UNEXPECTED_NULL)));
}
-INSTANTIATE_TEST_CASE_P(BinderLibTest, BinderLibRpcTestP, testing::Bool(),
- BinderLibRpcTestP::ParamToString);
+INSTANTIATE_TEST_SUITE_P(BinderLibTest, BinderLibRpcTestP, testing::Bool(),
+ BinderLibRpcTestP::ParamToString);
class BinderLibTestService : public BBinder {
public: