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/binderAllocationLimits.cpp b/libs/binder/tests/binderAllocationLimits.cpp
index 7e0b594..c0c0aae 100644
--- a/libs/binder/tests/binderAllocationLimits.cpp
+++ b/libs/binder/tests/binderAllocationLimits.cpp
@@ -114,12 +114,12 @@
{
const auto on_malloc = OnMalloc([&](size_t bytes) {
mallocs++;
- EXPECT_EQ(bytes, 40);
+ EXPECT_EQ(bytes, 40u);
});
imaginary_use = new int[10];
}
- EXPECT_EQ(mallocs, 1);
+ EXPECT_EQ(mallocs, 1u);
}
@@ -196,9 +196,9 @@
// Happens to be SM package length. We could switch to forking
// and registering our own service if it became an issue.
#if defined(__LP64__)
- EXPECT_EQ(bytes, 78);
+ EXPECT_EQ(bytes, 78u);
#else
- EXPECT_EQ(bytes, 70);
+ EXPECT_EQ(bytes, 70u);
#endif
});
@@ -206,7 +206,7 @@
a_binder->getInterfaceDescriptor();
a_binder->getInterfaceDescriptor();
- EXPECT_EQ(mallocs, 1);
+ EXPECT_EQ(mallocs, 1u);
}
TEST(BinderAllocation, SmallTransaction) {
@@ -217,11 +217,11 @@
const auto on_malloc = OnMalloc([&](size_t bytes) {
mallocs++;
// Parcel should allocate a small amount by default
- EXPECT_EQ(bytes, 128);
+ EXPECT_EQ(bytes, 128u);
});
manager->checkService(empty_descriptor);
- EXPECT_EQ(mallocs, 1);
+ EXPECT_EQ(mallocs, 1u);
}
TEST(RpcBinderAllocation, SetupRpcServer) {
@@ -250,8 +250,8 @@
});
ASSERT_EQ(OK, remoteBinder->pingBinder());
}
- EXPECT_EQ(mallocs, 1);
- EXPECT_EQ(totalBytes, 40);
+ EXPECT_EQ(mallocs, 1u);
+ EXPECT_EQ(totalBytes, 40u);
}
int main(int argc, char** argv) {