Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I41cd58617d6df6de7942a541fb6dc9519c70bef0
Merged-In: I41cd58617d6df6de7942a541fb6dc9519c70bef0
diff --git a/keystore/user_state.cpp b/keystore/user_state.cpp
index 5f9cd5f..b70de4c 100644
--- a/keystore/user_state.cpp
+++ b/keystore/user_state.cpp
@@ -155,7 +155,7 @@
if (length > SALT_SIZE && rawBlob.info == SALT_SIZE) {
salt = (uint8_t*)&rawBlob + length - SALT_SIZE;
} else {
- salt = NULL;
+ salt = nullptr;
}
uint8_t passwordKey[MASTER_KEY_SIZE_BYTES];
generateKeyFromPassword(passwordKey, MASTER_KEY_SIZE_BYTES, pw, salt);
@@ -166,7 +166,7 @@
}
if (response == ResponseCode::NO_ERROR && masterKeyBlob.getLength() == MASTER_KEY_SIZE_BYTES) {
// If salt was missing, generate one and write a new master key file with the salt.
- if (salt == NULL) {
+ if (salt == nullptr) {
if (!generateSalt(entropy)) {
return ResponseCode::SYSTEM_ERROR;
}
@@ -209,7 +209,7 @@
}
struct dirent* file;
- while ((file = readdir(dir)) != NULL) {
+ while ((file = readdir(dir)) != nullptr) {
// skip . and ..
if (!strcmp(".", file->d_name) || !strcmp("..", file->d_name)) {
continue;
@@ -224,7 +224,7 @@
void UserState::generateKeyFromPassword(uint8_t* key, ssize_t keySize, const android::String8& pw,
uint8_t* salt) {
size_t saltSize;
- if (salt != NULL) {
+ if (salt != nullptr) {
saltSize = SALT_SIZE;
} else {
// Pre-gingerbread used this hardwired salt, readMasterKey will rewrite these when found