Fix or suppress tidy warnings-as-errors.
Use std::map instead of KeyedVector (deprecated) in order to avoid
unnecessary (and implicit) initialization of the value type. KeyedVector
does it even when only the key is neeed (e.g. indexOfKey). std::map
doesn't have such a problem.
Bug: 222775179
Test: unset WITH_TIDY; CLANG_ANALYZER_CHECKS=1 make -k
tidy-frameworks-native-libs-binder
Change-Id: I548fc96a34bac9c7135e206983150948dbca57d4
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index 0970ca5..01b25d3 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -19,6 +19,7 @@
#include <atomic>
#include <set>
+#include <android-base/logging.h>
#include <android-base/unique_fd.h>
#include <binder/BpBinder.h>
#include <binder/IInterface.h>
@@ -281,9 +282,11 @@
err = pingBinder();
break;
case EXTENSION_TRANSACTION:
+ CHECK(reply != nullptr);
err = reply->writeStrongBinder(getExtension());
break;
case DEBUG_PID_TRANSACTION:
+ CHECK(reply != nullptr);
err = reply->writeInt32(getDebugPid());
break;
case SET_RPC_CLIENT_TRANSACTION: {
@@ -590,6 +593,7 @@
{
switch (code) {
case INTERFACE_TRANSACTION:
+ CHECK(reply != nullptr);
reply->writeString16(getInterfaceDescriptor());
return NO_ERROR;