Skip to content

Commit

Permalink
Merge pull request #37338 from lupoDharkael/nullprt
Browse files Browse the repository at this point in the history
Replace NULL with nullptr
  • Loading branch information
akien-mga committed Apr 2, 2020
2 parents 5f11e15 + 95a1400 commit 058a0af
Show file tree
Hide file tree
Showing 755 changed files with 5,745 additions and 5,745 deletions.
4 changes: 2 additions & 2 deletions core/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void Array::_unref() const {
if (_p->refcount.unref()) {
memdelete(_p);
}
_p = NULL;
_p = nullptr;
}

Variant &Array::operator[](int p_idx) {
Expand Down Expand Up @@ -467,7 +467,7 @@ const void *Array::id() const {

Array::Array(const Array &p_from) {

_p = NULL;
_p = nullptr;
_ref(p_from);
}

Expand Down
38 changes: 19 additions & 19 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static const unsigned int MONTH_DAYS_TABLE[2][12] = {
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
};

_ResourceLoader *_ResourceLoader::singleton = NULL;
_ResourceLoader *_ResourceLoader::singleton = nullptr;

Error _ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads) {

Expand Down Expand Up @@ -173,7 +173,7 @@ Vector<String> _ResourceSaver::get_recognized_extensions(const RES &p_resource)
return ret;
}

_ResourceSaver *_ResourceSaver::singleton = NULL;
_ResourceSaver *_ResourceSaver::singleton = nullptr;

void _ResourceSaver::_bind_methods() {

Expand Down Expand Up @@ -778,7 +778,7 @@ Vector<String> _OS::get_granted_permissions() const {
String _OS::get_unique_id() const {
return OS::get_singleton()->get_unique_id();
}
_OS *_OS::singleton = NULL;
_OS *_OS::singleton = nullptr;

void _OS::_bind_methods() {

Expand Down Expand Up @@ -916,7 +916,7 @@ _OS::_OS() {

///////////////////// GEOMETRY

_Geometry *_Geometry::singleton = NULL;
_Geometry *_Geometry::singleton = nullptr;

_Geometry *_Geometry::get_singleton() {

Expand Down Expand Up @@ -1363,11 +1363,11 @@ void _File::close() {

if (f)
memdelete(f);
f = NULL;
f = nullptr;
}
bool _File::is_open() const {

return f != NULL;
return f != nullptr;
}
String _File::get_path() const {

Expand Down Expand Up @@ -1630,7 +1630,7 @@ void _File::store_var(const Variant &p_var, bool p_full_objects) {

ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
int len;
Error err = encode_variant(p_var, NULL, len, p_full_objects);
Error err = encode_variant(p_var, nullptr, len, p_full_objects);
ERR_FAIL_COND_MSG(err != OK, "Error when trying to encode Variant.");

Vector<uint8_t> buff;
Expand All @@ -1654,7 +1654,7 @@ Variant _File::get_var(bool p_allow_objects) const {
const uint8_t *r = buff.ptr();

Variant v;
Error err = decode_variant(v, &r[0], len, NULL, p_allow_objects);
Error err = decode_variant(v, &r[0], len, nullptr, p_allow_objects);
ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to encode Variant.");

return v;
Expand Down Expand Up @@ -1733,7 +1733,7 @@ void _File::_bind_methods() {

_File::_File() {

f = NULL;
f = nullptr;
eswap = false;
}

Expand Down Expand Up @@ -1934,7 +1934,7 @@ _Directory::~_Directory() {
memdelete(d);
}

_Marshalls *_Marshalls::singleton = NULL;
_Marshalls *_Marshalls::singleton = nullptr;

_Marshalls *_Marshalls::get_singleton() {
return singleton;
Expand All @@ -1943,7 +1943,7 @@ _Marshalls *_Marshalls::get_singleton() {
String _Marshalls::variant_to_base64(const Variant &p_var, bool p_full_objects) {

int len;
Error err = encode_variant(p_var, NULL, len, p_full_objects);
Error err = encode_variant(p_var, nullptr, len, p_full_objects);
ERR_FAIL_COND_V_MSG(err != OK, "", "Error when trying to encode Variant.");

Vector<uint8_t> buff;
Expand Down Expand Up @@ -1972,7 +1972,7 @@ Variant _Marshalls::base64_to_variant(const String &p_str, bool p_allow_objects)
ERR_FAIL_COND_V(CryptoCore::b64_decode(&w[0], buf.size(), &len, (unsigned char *)cstr.get_data(), strlen) != OK, Variant());

Variant v;
Error err = decode_variant(v, &w[0], len, NULL, p_allow_objects);
Error err = decode_variant(v, &w[0], len, nullptr, p_allow_objects);
ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to decode Variant.");

return v;
Expand Down Expand Up @@ -2151,7 +2151,7 @@ Error _Thread::start(Object *p_instance, const StringName &p_method, const Varia
if (!thread) {
active = false;
target_method = StringName();
target_instance = NULL;
target_instance = nullptr;
userdata = Variant();
return ERR_CANT_CREATE;
}
Expand Down Expand Up @@ -2179,11 +2179,11 @@ Variant _Thread::wait_to_finish() {
Variant r = ret;
active = false;
target_method = StringName();
target_instance = NULL;
target_instance = nullptr;
userdata = Variant();
if (thread)
memdelete(thread);
thread = NULL;
thread = nullptr;

return r;
}
Expand All @@ -2202,8 +2202,8 @@ void _Thread::_bind_methods() {
_Thread::_Thread() {

active = false;
thread = NULL;
target_instance = NULL;
thread = nullptr;
target_instance = nullptr;
}

_Thread::~_Thread() {
Expand Down Expand Up @@ -2581,7 +2581,7 @@ void _Engine::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
}

_Engine *_Engine::singleton = NULL;
_Engine *_Engine::singleton = nullptr;

_Engine::_Engine() {
singleton = this;
Expand Down Expand Up @@ -2657,7 +2657,7 @@ Ref<JSONParseResult> _JSON::parse(const String &p_json) {
return result;
}

_JSON *_JSON::singleton = NULL;
_JSON *_JSON::singleton = nullptr;

_JSON::_JSON() {
singleton = this;
Expand Down
2 changes: 1 addition & 1 deletion core/bind/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ class _Marshalls : public Object {
String base64_to_utf8(const String &p_str);

_Marshalls() { singleton = this; }
~_Marshalls() { singleton = NULL; }
~_Marshalls() { singleton = nullptr; }
};

class _Mutex : public Reference {
Expand Down
2 changes: 1 addition & 1 deletion core/callable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ StringName Callable::get_method() const {
}

CallableCustom *Callable::get_custom() const {
ERR_FAIL_COND_V_MSG(!is_custom(), NULL,
ERR_FAIL_COND_V_MSG(!is_custom(), nullptr,
vformat("Can't get custom on non-CallableCustom \"%s\".", operator String()));
return custom;
}
Expand Down
Loading

0 comments on commit 058a0af

Please sign in to comment.