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/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 63560c4..d2b472b 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -81,7 +81,7 @@
/*static*/ sp<ISurfaceComposer> ComposerService::getComposerService() {
ComposerService& instance = ComposerService::getInstance();
Mutex::Autolock _l(instance.mLock);
- if (instance.mComposerService == NULL) {
+ if (instance.mComposerService == nullptr) {
ComposerService::getInstance().connectLocked();
assert(instance.mComposerService != NULL);
ALOGD("ComposerService reconnected");
@@ -92,8 +92,8 @@
void ComposerService::composerServiceDied()
{
Mutex::Autolock _l(mLock);
- mComposerService = NULL;
- mDeathObserver = NULL;
+ mComposerService = nullptr;
+ mDeathObserver = nullptr;
}
// ---------------------------------------------------------------------------
@@ -571,12 +571,12 @@
void SurfaceComposerClient::onFirstRef() {
sp<ISurfaceComposer> sf(ComposerService::getComposerService());
- if (sf != 0 && mStatus == NO_INIT) {
+ if (sf != nullptr && mStatus == NO_INIT) {
auto rootProducer = mParent.promote();
sp<ISurfaceComposerClient> conn;
conn = (rootProducer != nullptr) ? sf->createScopedConnection(rootProducer) :
sf->createConnection();
- if (conn != 0) {
+ if (conn != nullptr) {
mClient = conn;
mStatus = NO_ERROR;
}
@@ -606,7 +606,7 @@
// this can be called more than once.
sp<ISurfaceComposerClient> client;
Mutex::Autolock _lm(mLock);
- if (mClient != 0) {
+ if (mClient != nullptr) {
client = mClient; // hold ref while lock is held
mClient.clear();
}
@@ -766,7 +766,7 @@
bool useIdentityTransform, uint32_t rotation,
sp<GraphicBuffer>* outBuffer) {
sp<ISurfaceComposer> s(ComposerService::getComposerService());
- if (s == NULL) return NO_INIT;
+ if (s == nullptr) return NO_INIT;
status_t ret = s->captureScreen(display, outBuffer, sourceCrop, reqWidth, reqHeight, minLayerZ,
maxLayerZ, useIdentityTransform,
static_cast<ISurfaceComposer::Rotation>(rotation));
@@ -779,7 +779,7 @@
status_t ScreenshotClient::captureLayers(const sp<IBinder>& layerHandle, Rect sourceCrop,
float frameScale, sp<GraphicBuffer>* outBuffer) {
sp<ISurfaceComposer> s(ComposerService::getComposerService());
- if (s == NULL) return NO_INIT;
+ if (s == nullptr) return NO_INIT;
status_t ret = s->captureLayers(layerHandle, outBuffer, sourceCrop, frameScale,
false /* childrenOnly */);
return ret;
@@ -788,7 +788,7 @@
status_t ScreenshotClient::captureChildLayers(const sp<IBinder>& layerHandle, Rect sourceCrop,
float frameScale, sp<GraphicBuffer>* outBuffer) {
sp<ISurfaceComposer> s(ComposerService::getComposerService());
- if (s == NULL) return NO_INIT;
+ if (s == nullptr) return NO_INIT;
status_t ret = s->captureLayers(layerHandle, outBuffer, sourceCrop, frameScale,
true /* childrenOnly */);
return ret;