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/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp
index 0749fde..3693d2c 100644
--- a/libs/gui/IGraphicBufferProducer.cpp
+++ b/libs/gui/IGraphicBufferProducer.cpp
@@ -190,10 +190,10 @@
virtual status_t detachNextBuffer(sp<GraphicBuffer>* outBuffer,
sp<Fence>* outFence) {
- if (outBuffer == NULL) {
+ if (outBuffer == nullptr) {
ALOGE("detachNextBuffer: outBuffer must not be NULL");
return BAD_VALUE;
- } else if (outFence == NULL) {
+ } else if (outFence == nullptr) {
ALOGE("detachNextBuffer: outFence must not be NULL");
return BAD_VALUE;
}
@@ -301,7 +301,7 @@
int api, bool producerControlledByApp, QueueBufferOutput* output) {
Parcel data, reply;
data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
- if (listener != NULL) {
+ if (listener != nullptr) {
data.writeInt32(1);
data.writeStrongBinder(IInterface::asBinder(listener));
} else {
@@ -738,8 +738,8 @@
int bufferIdx = data.readInt32();
sp<GraphicBuffer> buffer;
int result = requestBuffer(bufferIdx, &buffer);
- reply->writeInt32(buffer != 0);
- if (buffer != 0) {
+ reply->writeInt32(buffer != nullptr);
+ if (buffer != nullptr) {
reply->write(*buffer);
}
reply->writeInt32(result);
@@ -797,12 +797,12 @@
int32_t result = detachNextBuffer(&buffer, &fence);
reply->writeInt32(result);
if (result == NO_ERROR) {
- reply->writeInt32(buffer != NULL);
- if (buffer != NULL) {
+ reply->writeInt32(buffer != nullptr);
+ if (buffer != nullptr) {
reply->write(*buffer);
}
- reply->writeInt32(fence != NULL);
- if (fence != NULL) {
+ reply->writeInt32(fence != nullptr);
+ if (fence != nullptr) {
reply->write(*fence);
}
}