summaryrefslogtreecommitdiff
path: root/core/crypto
diff options
context:
space:
mode:
authorlupoDharkael <izhe@hotmail.es>2020-04-02 01:20:12 +0200
committerlupoDharkael <izhe@hotmail.es>2020-04-02 13:38:00 +0200
commit95a1400a2ac9de1a29fa305f45b928ce8e3044bd (patch)
treebe0cd59e5a90926e9d653fed9f3b1b77e735ca2f /core/crypto
parent5f11e1557156617366d2c316a97716172103980d (diff)
Replace NULL with nullptr
Diffstat (limited to 'core/crypto')
-rw-r--r--core/crypto/crypto.cpp18
-rw-r--r--core/crypto/crypto.h2
-rw-r--r--core/crypto/hashing_context.cpp16
3 files changed, 18 insertions, 18 deletions
diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp
index 793bf719b7..ab8548e3ba 100644
--- a/core/crypto/crypto.cpp
+++ b/core/crypto/crypto.cpp
@@ -36,11 +36,11 @@
/// Resources
-CryptoKey *(*CryptoKey::_create)() = NULL;
+CryptoKey *(*CryptoKey::_create)() = nullptr;
CryptoKey *CryptoKey::create() {
if (_create)
return _create();
- return NULL;
+ return nullptr;
}
void CryptoKey::_bind_methods() {
@@ -48,11 +48,11 @@ void CryptoKey::_bind_methods() {
ClassDB::bind_method(D_METHOD("load", "path"), &CryptoKey::load);
}
-X509Certificate *(*X509Certificate::_create)() = NULL;
+X509Certificate *(*X509Certificate::_create)() = nullptr;
X509Certificate *X509Certificate::create() {
if (_create)
return _create();
- return NULL;
+ return nullptr;
}
void X509Certificate::_bind_methods() {
@@ -62,8 +62,8 @@ void X509Certificate::_bind_methods() {
/// Crypto
-void (*Crypto::_load_default_certificates)(String p_path) = NULL;
-Crypto *(*Crypto::_create)() = NULL;
+void (*Crypto::_load_default_certificates)(String p_path) = nullptr;
+Crypto *(*Crypto::_create)() = nullptr;
Crypto *Crypto::create() {
if (_create)
return _create();
@@ -87,11 +87,11 @@ PackedByteArray Crypto::generate_random_bytes(int p_bytes) {
}
Ref<CryptoKey> Crypto::generate_rsa(int p_bytes) {
- ERR_FAIL_V_MSG(NULL, "generate_rsa is not available when mbedtls module is disabled.");
+ ERR_FAIL_V_MSG(nullptr, "generate_rsa is not available when mbedtls module is disabled.");
}
Ref<X509Certificate> Crypto::generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after) {
- ERR_FAIL_V_MSG(NULL, "generate_self_signed_certificate is not available when mbedtls module is disabled.");
+ ERR_FAIL_V_MSG(nullptr, "generate_self_signed_certificate is not available when mbedtls module is disabled.");
}
Crypto::Crypto() {
@@ -113,7 +113,7 @@ RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_origi
key->load(p_path);
return key;
}
- return NULL;
+ return nullptr;
}
void ResourceFormatLoaderCrypto::get_recognized_extensions(List<String> *p_extensions) const {
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h
index 3279c0620f..e515367de5 100644
--- a/core/crypto/crypto.h
+++ b/core/crypto/crypto.h
@@ -87,7 +87,7 @@ class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
GDCLASS(ResourceFormatLoaderCrypto, ResourceFormatLoader);
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/core/crypto/hashing_context.cpp b/core/crypto/hashing_context.cpp
index a4d8a93c8a..af43bc9bad 100644
--- a/core/crypto/hashing_context.cpp
+++ b/core/crypto/hashing_context.cpp
@@ -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(PackedByteArray 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);
const uint8_t *r = p_chunk.ptr();
@@ -64,7 +64,7 @@ Error HashingContext::update(PackedByteArray p_chunk) {
}
PackedByteArray HashingContext::finish() {
- ERR_FAIL_COND_V(ctx == NULL, PackedByteArray());
+ ERR_FAIL_COND_V(ctx == nullptr, PackedByteArray());
PackedByteArray 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;
}
}
@@ -116,7 +116,7 @@ void HashingContext::_delete_ctx() {
memdelete((CryptoCore::SHA256Context *)ctx);
break;
}
- ctx = NULL;
+ ctx = nullptr;
}
void HashingContext::_bind_methods() {
@@ -129,10 +129,10 @@ void HashingContext::_bind_methods() {
}
HashingContext::HashingContext() {
- ctx = NULL;
+ ctx = nullptr;
}
HashingContext::~HashingContext() {
- if (ctx != NULL)
+ if (ctx != nullptr)
_delete_ctx();
}