[binder] Replace NULL/0 with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
clang-tidy -checks=modernize-use-nullptr -p compile_commands.json -fix
...
Test: m
Bug: 68236239
Change-Id: I3181bc5683796423a98b0f9b94daf30880c07bdc
Merged-In: I3181bc5683796423a98b0f9b94daf30880c07bdc
(cherry picked from commit 91635563b8a1bf7a31e4ceb439728dacb79abd76)
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index a81f44e..1bd7c4f 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -43,17 +43,17 @@
sp<IInterface> IBinder::queryLocalInterface(const String16& /*descriptor*/)
{
- return NULL;
+ return nullptr;
}
BBinder* IBinder::localBinder()
{
- return NULL;
+ return nullptr;
}
BpBinder* IBinder::remoteBinder()
{
- return NULL;
+ return nullptr;
}
bool IBinder::checkSubclass(const void* /*subclassID*/) const
@@ -76,8 +76,8 @@
for (size_t i = 0; i < numArgs; i++) {
send.writeString16(args[i]);
}
- send.writeStrongBinder(callback != NULL ? IInterface::asBinder(callback) : NULL);
- send.writeStrongBinder(resultReceiver != NULL ? IInterface::asBinder(resultReceiver) : NULL);
+ send.writeStrongBinder(callback != nullptr ? IInterface::asBinder(callback) : nullptr);
+ send.writeStrongBinder(resultReceiver != nullptr ? IInterface::asBinder(resultReceiver) : nullptr);
return target->transact(SHELL_COMMAND_TRANSACTION, send, &reply);
}
@@ -130,7 +130,7 @@
break;
}
- if (reply != NULL) {
+ if (reply != nullptr) {
reply->setDataPosition(0);
}
@@ -171,7 +171,7 @@
delete e;
e = expected; // Filled in by CAS
}
- if (e == 0) return; // out of memory
+ if (e == nullptr) return; // out of memory
}
AutoMutex _l(e->mLock);
@@ -181,7 +181,7 @@
void* BBinder::findObject(const void* objectID) const
{
Extras* e = mExtras.load(std::memory_order_acquire);
- if (!e) return NULL;
+ if (!e) return nullptr;
AutoMutex _l(e->mLock);
return e->mObjects.find(objectID);
@@ -246,7 +246,7 @@
(void)out;
(void)err;
- if (resultReceiver != NULL) {
+ if (resultReceiver != nullptr) {
resultReceiver->send(INVALID_OPERATION);
}
@@ -273,7 +273,7 @@
};
BpRefBase::BpRefBase(const sp<IBinder>& o)
- : mRemote(o.get()), mRefs(NULL), mState(0)
+ : mRemote(o.get()), mRefs(nullptr), mState(0)
{
extendObjectLifetime(OBJECT_LIFETIME_WEAK);