Switch from NULL -> nullptr.
Test: Builds.
Change-Id: Idcdd337e6576d612aa6c18a431b3dfe0215efde0
diff --git a/base/HidlInternal.cpp b/base/HidlInternal.cpp
index 51f42f6..b41c0b9 100644
--- a/base/HidlInternal.cpp
+++ b/base/HidlInternal.cpp
@@ -105,7 +105,7 @@
}
struct dirent *file;
- while ((file = readdir(dir)) != NULL) {
+ while ((file = readdir(dir)) != nullptr) {
if (!isInstrumentationLib(file))
continue;
@@ -141,7 +141,7 @@
}
auto cb = (cbFun)dlsym(handle, ("HIDL_INSTRUMENTATION_FUNCTION_"
+ package + "_" + mInterfaceName).c_str());
- if ((error = dlerror()) != NULL) {
+ if ((error = dlerror()) != nullptr) {
LOG(WARNING)
<< "couldn't find symbol: HIDL_INSTRUMENTATION_FUNCTION_"
<< package << "_" << mInterfaceName << ", error: " << error;
diff --git a/base/Status.cpp b/base/Status.cpp
index 3b31ee6..1ba91c3 100644
--- a/base/Status.cpp
+++ b/base/Status.cpp
@@ -53,7 +53,7 @@
}
std::string str = std::to_string(s);
char *err = strerror(-s);
- if (err != NULL) {
+ if (err != nullptr) {
str.append(1, ' ').append(err);
}
return str;
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index 6e37229..b878423 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -284,7 +284,7 @@
template<typename T>
struct hidl_vec {
hidl_vec()
- : mBuffer(NULL),
+ : mBuffer(nullptr),
mSize(0),
mOwnsBuffer(true) {
static_assert(hidl_vec<T>::kOffsetOfBuffer == 0, "wrong offset");
@@ -342,7 +342,7 @@
if (mOwnsBuffer) {
delete[] mBuffer;
}
- mBuffer = NULL;
+ mBuffer = nullptr;
}
// Reference an existing array, optionally taking ownership. It is the
@@ -531,7 +531,7 @@
mBuffer[i] = data[i];
}
} else {
- mBuffer = NULL;
+ mBuffer = nullptr;
}
}
};
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index 4c0f0fb..3327477 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -139,7 +139,7 @@
sp<IServiceManager1_1> defaultServiceManager1_1() {
{
AutoMutex _l(details::gDefaultServiceManagerLock);
- if (details::gDefaultServiceManager != NULL) {
+ if (details::gDefaultServiceManager != nullptr) {
return details::gDefaultServiceManager;
}
@@ -151,11 +151,11 @@
waitForHwServiceManager();
- while (details::gDefaultServiceManager == NULL) {
+ while (details::gDefaultServiceManager == nullptr) {
details::gDefaultServiceManager =
fromBinder<IServiceManager1_1, BpHwServiceManager, BnHwServiceManager>(
- ProcessState::self()->getContextObject(NULL));
- if (details::gDefaultServiceManager == NULL) {
+ ProcessState::self()->getContextObject(nullptr));
+ if (details::gDefaultServiceManager == nullptr) {
LOG(ERROR) << "Waited for hwservicemanager, but got nullptr.";
sleep(1);
}
@@ -225,7 +225,7 @@
if (!dir) return;
dirent* dp;
while ((dp = readdir(dir.get())) != nullptr) {
- pid_t pid = strtoll(dp->d_name, NULL, 0);
+ pid_t pid = strtoll(dp->d_name, nullptr, 0);
if (pid == 0) continue;
std::string mapsPath = proc + dp->d_name + "/maps";
std::ifstream ifs{mapsPath};
diff --git a/transport/token/1.0/utils/include/hidl/HybridInterface.h b/transport/token/1.0/utils/include/hidl/HybridInterface.h
index 8c3e742..984555e 100644
--- a/transport/token/1.0/utils/include/hidl/HybridInterface.h
+++ b/transport/token/1.0/utils/include/hidl/HybridInterface.h
@@ -125,13 +125,13 @@
HalInterface* getBaseInterface() { return mBase.get(); }
virtual status_t linkToDeath(
const sp<IBinder::DeathRecipient>& recipient,
- void* cookie = NULL,
+ void* cookie = nullptr,
uint32_t flags = 0);
virtual status_t unlinkToDeath(
const wp<IBinder::DeathRecipient>& recipient,
- void* cookie = NULL,
+ void* cookie = nullptr,
uint32_t flags = 0,
- wp<IBinder::DeathRecipient>* outRecipient = NULL);
+ wp<IBinder::DeathRecipient>* outRecipient = nullptr);
protected:
sp<HalInterface> mBase;
@@ -215,11 +215,11 @@
const ::android::sp<::android::IBinder>& obj) \
{ \
::android::sp<I##INTERFACE> intr; \
- if (obj != NULL) { \
+ if (obj != nullptr) { \
intr = static_cast<I##INTERFACE*>( \
obj->queryLocalInterface( \
I##INTERFACE::descriptor).get()); \
- if (intr == NULL) { \
+ if (intr == nullptr) { \
intr = new Hp##INTERFACE(obj); \
} \
} \
@@ -262,8 +262,8 @@
linkToDeath(
const sp<IBinder::DeathRecipient>& recipient,
void* cookie, uint32_t flags) {
- LOG_ALWAYS_FATAL_IF(recipient == NULL,
- "linkToDeath(): recipient must be non-NULL");
+ LOG_ALWAYS_FATAL_IF(recipient == nullptr,
+ "linkToDeath(): recipient must be non-nullptr");
{
std::lock_guard<std::mutex> lock(mObituariesLock);
mObituaries.push_back(new Obituary(recipient, cookie, flags, this));