Style: Replaces uses of 0/NULL by nullptr (C++11)

Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
This commit is contained in:
Rémi Verschelde
2021-05-04 16:00:45 +02:00
parent 2b429b24b5
commit a828398655
633 changed files with 4454 additions and 4410 deletions

View File

@@ -33,9 +33,9 @@
#include "core/crypto/crypto_core.h"
Error HashingContext::start(HashType p_type) {
ERR_FAIL_COND_V(ctx != NULL, ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(ctx != nullptr, ERR_ALREADY_IN_USE);
_create_ctx(p_type);
ERR_FAIL_COND_V(ctx == NULL, ERR_UNAVAILABLE);
ERR_FAIL_COND_V(ctx == nullptr, ERR_UNAVAILABLE);
switch (type) {
case HASH_MD5:
return ((CryptoCore::MD5Context *)ctx)->start();
@@ -48,7 +48,7 @@ Error HashingContext::start(HashType p_type) {
}
Error HashingContext::update(PoolByteArray p_chunk) {
ERR_FAIL_COND_V(ctx == NULL, ERR_UNCONFIGURED);
ERR_FAIL_COND_V(ctx == nullptr, ERR_UNCONFIGURED);
size_t len = p_chunk.size();
ERR_FAIL_COND_V(len == 0, FAILED);
PoolByteArray::Read r = p_chunk.read();
@@ -64,7 +64,7 @@ Error HashingContext::update(PoolByteArray p_chunk) {
}
PoolByteArray HashingContext::finish() {
ERR_FAIL_COND_V(ctx == NULL, PoolByteArray());
ERR_FAIL_COND_V(ctx == nullptr, PoolByteArray());
PoolByteArray out;
Error err = FAILED;
switch (type) {
@@ -99,7 +99,7 @@ void HashingContext::_create_ctx(HashType p_type) {
ctx = memnew(CryptoCore::SHA256Context);
break;
default:
ctx = NULL;
ctx = nullptr;
}
}
@@ -115,7 +115,7 @@ void HashingContext::_delete_ctx() {
memdelete((CryptoCore::SHA256Context *)ctx);
break;
}
ctx = NULL;
ctx = nullptr;
}
void HashingContext::_bind_methods() {
@@ -128,10 +128,10 @@ void HashingContext::_bind_methods() {
}
HashingContext::HashingContext() {
ctx = NULL;
ctx = nullptr;
}
HashingContext::~HashingContext() {
if (ctx != NULL)
if (ctx != nullptr)
_delete_ctx();
}