diff options
author | 2018-06-07 17:52:27 -0700 | |
---|---|---|
committer | 2018-06-07 17:54:21 -0700 | |
commit | fdd8da9e3f79be25b91293e22114c177c3b3fd8d (patch) | |
tree | cbc9fea00e9b67d631bde2bbb70de5b151dfcadc /libs/binder/IServiceManager.cpp | |
parent | a160f5a70ffba3715c8a92f4f469922d59635356 (diff) |
[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)
Diffstat (limited to 'libs/binder/IServiceManager.cpp')
-rw-r--r-- | libs/binder/IServiceManager.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index c7a0f43a9d..001dc9e6cd 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -33,14 +33,14 @@ namespace android { sp<IServiceManager> defaultServiceManager() { - if (gDefaultServiceManager != NULL) return gDefaultServiceManager; + if (gDefaultServiceManager != nullptr) return gDefaultServiceManager; { AutoMutex _l(gDefaultServiceManagerLock); - while (gDefaultServiceManager == NULL) { + while (gDefaultServiceManager == nullptr) { gDefaultServiceManager = interface_cast<IServiceManager>( - ProcessState::self()->getContextObject(NULL)); - if (gDefaultServiceManager == NULL) + ProcessState::self()->getContextObject(nullptr)); + if (gDefaultServiceManager == nullptr) sleep(1); } } @@ -50,7 +50,7 @@ sp<IServiceManager> defaultServiceManager() bool checkCallingPermission(const String16& permission) { - return checkCallingPermission(permission, NULL, NULL); + return checkCallingPermission(permission, nullptr, nullptr); } static String16 _permission("permission"); @@ -76,7 +76,7 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid) int64_t startTime = 0; while (true) { - if (pc != NULL) { + if (pc != nullptr) { bool res = pc->checkPermission(permission, pid, uid); if (res) { if (startTime != 0) { @@ -97,14 +97,14 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid) // Object is dead! gDefaultServiceManagerLock.lock(); if (gPermissionController == pc) { - gPermissionController = NULL; + gPermissionController = nullptr; } gDefaultServiceManagerLock.unlock(); } // Need to retrieve the permission controller. sp<IBinder> binder = defaultServiceManager()->checkService(_permission); - if (binder == NULL) { + if (binder == nullptr) { // Wait for the permission controller to come back... if (startTime == 0) { startTime = uptimeMillis(); @@ -146,9 +146,9 @@ public: sleep(1); } sp<IBinder> svc = checkService(name); - if (svc != NULL) return svc; + if (svc != nullptr) return svc; } - return NULL; + return nullptr; } virtual sp<IBinder> checkService( const String16& name) const |