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: I3a8e982ba40f9b029bafef78437b146a878f56a9
diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp
index d70e142..3837c3e 100644
--- a/libs/gui/BufferQueueConsumer.cpp
+++ b/libs/gui/BufferQueueConsumer.cpp
@@ -255,7 +255,7 @@
// mGraphicBuffer to NULL to avoid unnecessarily remapping this buffer
// on the consumer side
if (outBuffer->mAcquireCalled) {
- outBuffer->mGraphicBuffer = NULL;
+ outBuffer->mGraphicBuffer = nullptr;
}
mCore->mQueue.erase(front);
@@ -272,7 +272,7 @@
VALIDATE_CONSISTENCY();
}
- if (listener != NULL) {
+ if (listener != nullptr) {
for (int i = 0; i < numDroppedBuffers; ++i) {
listener->onBufferReleased();
}
@@ -321,10 +321,10 @@
const sp<android::GraphicBuffer>& buffer) {
ATRACE_CALL();
- if (outSlot == NULL) {
+ if (outSlot == nullptr) {
BQ_LOGE("attachBuffer: outSlot must not be NULL");
return BAD_VALUE;
- } else if (buffer == NULL) {
+ } else if (buffer == nullptr) {
BQ_LOGE("attachBuffer: cannot attach NULL buffer");
return BAD_VALUE;
}
@@ -413,7 +413,7 @@
ATRACE_BUFFER_INDEX(slot);
if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS ||
- releaseFence == NULL) {
+ releaseFence == nullptr) {
BQ_LOGE("releaseBuffer: slot %d out of range or fence %p NULL", slot,
releaseFence.get());
return BAD_VALUE;
@@ -465,7 +465,7 @@
} // Autolock scope
// Call back without lock held
- if (listener != NULL) {
+ if (listener != nullptr) {
listener->onBufferReleased();
}
@@ -476,7 +476,7 @@
const sp<IConsumerListener>& consumerListener, bool controlledByApp) {
ATRACE_CALL();
- if (consumerListener == NULL) {
+ if (consumerListener == nullptr) {
BQ_LOGE("connect: consumerListener may not be NULL");
return BAD_VALUE;
}
@@ -504,13 +504,13 @@
Mutex::Autolock lock(mCore->mMutex);
- if (mCore->mConsumerListener == NULL) {
+ if (mCore->mConsumerListener == nullptr) {
BQ_LOGE("disconnect: no consumer is connected");
return BAD_VALUE;
}
mCore->mIsAbandoned = true;
- mCore->mConsumerListener = NULL;
+ mCore->mConsumerListener = nullptr;
mCore->mQueue.clear();
mCore->freeAllBuffersLocked();
mCore->mSharedBufferSlot = BufferQueueCore::INVALID_BUFFER_SLOT;
@@ -521,7 +521,7 @@
status_t BufferQueueConsumer::getReleasedBuffers(uint64_t *outSlotMask) {
ATRACE_CALL();
- if (outSlotMask == NULL) {
+ if (outSlotMask == nullptr) {
BQ_LOGE("getReleasedBuffers: outSlotMask may not be NULL");
return BAD_VALUE;
}
@@ -673,7 +673,7 @@
}
}
// Call back without lock held
- if (listener != NULL) {
+ if (listener != nullptr) {
listener->onBuffersReleased();
}
@@ -772,7 +772,7 @@
if (uid != shellUid) {
#endif
android_errorWriteWithInfoLog(0x534e4554, "27046057",
- static_cast<int32_t>(uid), NULL, 0);
+ static_cast<int32_t>(uid), nullptr, 0);
return PERMISSION_DENIED;
}