Explorar el Código

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
Rémi Verschelde hace 4 años
padre
commit
a828398655
Se han modificado 100 ficheros con 668 adiciones y 624 borrados
  1. 44 0
      .clang-tidy
  2. 2 2
      core/array.cpp
  3. 16 16
      core/bind/core_bind.cpp
  4. 1 1
      core/bind/core_bind.h
  5. 37 37
      core/class_db.cpp
  6. 10 10
      core/class_db.h
  7. 1 1
      core/command_queue_mt.cpp
  8. 5 5
      core/command_queue_mt.h
  9. 1 1
      core/core_string_names.cpp
  10. 1 1
      core/core_string_names.h
  11. 7 7
      core/cowdata.h
  12. 8 8
      core/crypto/crypto.cpp
  13. 1 1
      core/crypto/crypto.h
  14. 8 8
      core/crypto/hashing_context.cpp
  15. 7 7
      core/dictionary.cpp
  16. 1 1
      core/dictionary.h
  17. 3 3
      core/engine.cpp
  18. 1 1
      core/engine.h
  19. 2 2
      core/error_macros.cpp
  20. 3 3
      core/error_macros.h
  21. 24 24
      core/hash_map.h
  22. 28 28
      core/image.cpp
  23. 11 11
      core/input_map.cpp
  24. 2 2
      core/input_map.h
  25. 1 1
      core/io/config_file.cpp
  26. 2 2
      core/io/dtls_server.cpp
  27. 8 8
      core/io/file_access_compressed.cpp
  28. 5 5
      core/io/file_access_encrypted.cpp
  29. 5 5
      core/io/file_access_memory.cpp
  30. 3 3
      core/io/file_access_network.cpp
  31. 5 5
      core/io/file_access_pack.cpp
  32. 3 3
      core/io/file_access_pack.h
  33. 13 13
      core/io/file_access_zip.cpp
  34. 1 1
      core/io/image_loader.cpp
  35. 2 2
      core/io/image_loader.h
  36. 4 4
      core/io/ip.cpp
  37. 2 2
      core/io/logger.cpp
  38. 2 2
      core/io/marshalls.cpp
  39. 1 1
      core/io/marshalls.h
  40. 14 14
      core/io/multiplayer_api.cpp
  41. 2 2
      core/io/net_socket.cpp
  42. 2 2
      core/io/packet_peer.cpp
  43. 2 2
      core/io/packet_peer_dtls.cpp
  44. 4 4
      core/io/pck_packer.cpp
  45. 3 3
      core/io/resource_format_binary.cpp
  46. 1 1
      core/io/resource_format_binary.h
  47. 3 3
      core/io/resource_importer.cpp
  48. 3 3
      core/io/resource_importer.h
  49. 9 9
      core/io/resource_loader.cpp
  50. 5 5
      core/io/resource_loader.h
  51. 2 2
      core/io/resource_saver.cpp
  52. 2 2
      core/io/stream_peer.cpp
  53. 2 2
      core/io/stream_peer_ssl.cpp
  54. 1 1
      core/io/translation_loader_po.h
  55. 4 4
      core/io/xml_parser.cpp
  56. 2 2
      core/io/zip_io.cpp
  57. 21 21
      core/list.h
  58. 21 21
      core/map.h
  59. 4 4
      core/math/a_star.cpp
  60. 2 2
      core/math/aabb.h
  61. 39 39
      core/math/expression.cpp
  62. 2 2
      core/math/expression.h
  63. 2 2
      core/math/face3.h
  64. 6 6
      core/math/geometry.h
  65. 28 28
      core/math/octree_definition.inc
  66. 1 1
      core/math/plane.h
  67. 3 3
      core/math/quick_hull.cpp
  68. 4 4
      core/math/quick_hull.h
  69. 1 1
      core/math/rect2.h
  70. 6 6
      core/message_queue.cpp
  71. 1 1
      core/method_bind.cpp
  72. 1 1
      core/method_bind.h
  73. 6 6
      core/node_path.cpp
  74. 2 2
      core/oa_hash_map.h
  75. 23 23
      core/object.cpp
  76. 10 10
      core/object.h
  77. 9 9
      core/ordered_hash_map.h
  78. 5 5
      core/os/dir_access.cpp
  79. 2 2
      core/os/dir_access.h
  80. 6 6
      core/os/file_access.cpp
  81. 4 4
      core/os/file_access.h
  82. 1 1
      core/os/input.cpp
  83. 14 14
      core/os/input_event.cpp
  84. 1 1
      core/os/keyboard.cpp
  85. 6 6
      core/os/memory.cpp
  86. 2 2
      core/os/memory.h
  87. 1 1
      core/os/midi_driver.cpp
  88. 9 9
      core/os/os.cpp
  89. 2 2
      core/os/os.h
  90. 2 2
      core/packed_data_container.cpp
  91. 2 2
      core/packed_data_container.h
  92. 15 15
      core/pool_allocator.cpp
  93. 5 5
      core/pool_vector.cpp
  94. 14 14
      core/pool_vector.h
  95. 3 3
      core/print_string.cpp
  96. 3 3
      core/print_string.h
  97. 6 6
      core/project_settings.cpp
  98. 15 15
      core/reference.h
  99. 9 9
      core/register_core_types.cpp
  100. 7 7
      core/resource.cpp

+ 44 - 0
.clang-tidy

@@ -0,0 +1,44 @@
+---
+Checks:          'clang-diagnostic-*,clang-analyzer-*,-*,modernize-use-nullptr'
+WarningsAsErrors: ''
+HeaderFilterRegex: '.*'
+AnalyzeTemporaryDtors: false
+FormatStyle:     none
+CheckOptions:
+CheckOptions:
+  - key:             cert-dcl16-c.NewSuffixes
+    value:           'L;LL;LU;LLU'
+  - key:             cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
+    value:           '0'
+  - key:             cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
+    value:           '1'
+  - key:             cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
+    value:           '1'
+  - key:             google-readability-function-size.StatementThreshold
+    value:           '800'
+  - key:             google-readability-namespace-comments.ShortNamespaceLines
+    value:           '10'
+  - key:             google-readability-namespace-comments.SpacesBeforeComments
+    value:           '2'
+  - key:             modernize-loop-convert.MaxCopySize
+    value:           '16'
+  - key:             modernize-loop-convert.MinConfidence
+    value:           reasonable
+  - key:             modernize-loop-convert.NamingStyle
+    value:           CamelCase
+  - key:             modernize-pass-by-value.IncludeStyle
+    value:           llvm
+  - key:             modernize-replace-auto-ptr.IncludeStyle
+    value:           llvm
+  - key:             modernize-use-bool-literals.IgnoreMacros
+    value:           '0'
+  - key:             modernize-use-default-member-init.IgnoreMacros
+    value:           '0'
+  - key:             modernize-use-default-member-init.UseAssignment
+    value:           '1'
+  - key:             modernize-use-nullptr.NullMacros
+    value:           'NULL'
+  - key:             readability-braces-around-statements.ShortStatementLines
+    value:           '0'
+...
+

+ 2 - 2
core/array.cpp

@@ -65,7 +65,7 @@ void Array::_unref() const {
 	if (_p->refcount.unref()) {
 	if (_p->refcount.unref()) {
 		memdelete(_p);
 		memdelete(_p);
 	}
 	}
-	_p = NULL;
+	_p = nullptr;
 }
 }
 
 
 Variant &Array::operator[](int p_idx) {
 Variant &Array::operator[](int p_idx) {
@@ -419,7 +419,7 @@ const void *Array::id() const {
 }
 }
 
 
 Array::Array(const Array &p_from) {
 Array::Array(const Array &p_from) {
-	_p = NULL;
+	_p = nullptr;
 	_ref(p_from);
 	_ref(p_from);
 }
 }
 
 

+ 16 - 16
core/bind/core_bind.cpp

@@ -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 }
 	{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
 };
 };
 
 
-_ResourceLoader *_ResourceLoader::singleton = NULL;
+_ResourceLoader *_ResourceLoader::singleton = nullptr;
 
 
 Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String &p_path, const String &p_type_hint) {
 Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String &p_path, const String &p_type_hint) {
 	return ResourceLoader::load_interactive(p_path, p_type_hint);
 	return ResourceLoader::load_interactive(p_path, p_type_hint);
@@ -152,7 +152,7 @@ PoolVector<String> _ResourceSaver::get_recognized_extensions(const RES &p_resour
 	return ret;
 	return ret;
 }
 }
 
 
-_ResourceSaver *_ResourceSaver::singleton = NULL;
+_ResourceSaver *_ResourceSaver::singleton = nullptr;
 
 
 void _ResourceSaver::_bind_methods() {
 void _ResourceSaver::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("save", "path", "resource", "flags"), &_ResourceSaver::save, DEFVAL(0));
 	ClassDB::bind_method(D_METHOD("save", "path", "resource", "flags"), &_ResourceSaver::save, DEFVAL(0));
@@ -1147,7 +1147,7 @@ void _OS::set_current_tablet_driver(const String &p_driver) {
 	OS::get_singleton()->set_current_tablet_driver(p_driver);
 	OS::get_singleton()->set_current_tablet_driver(p_driver);
 }
 }
 
 
-_OS *_OS::singleton = NULL;
+_OS *_OS::singleton = nullptr;
 
 
 void _OS::_bind_methods() {
 void _OS::_bind_methods() {
 	//ClassDB::bind_method(D_METHOD("get_mouse_position"),&_OS::get_mouse_position);
 	//ClassDB::bind_method(D_METHOD("get_mouse_position"),&_OS::get_mouse_position);
@@ -1462,7 +1462,7 @@ _OS::_OS() {
 
 
 ///////////////////// GEOMETRY
 ///////////////////// GEOMETRY
 
 
-_Geometry *_Geometry::singleton = NULL;
+_Geometry *_Geometry::singleton = nullptr;
 
 
 _Geometry *_Geometry::get_singleton() {
 _Geometry *_Geometry::get_singleton() {
 	return singleton;
 	return singleton;
@@ -1869,10 +1869,10 @@ void _File::flush() {
 void _File::close() {
 void _File::close() {
 	if (f)
 	if (f)
 		memdelete(f);
 		memdelete(f);
-	f = NULL;
+	f = nullptr;
 }
 }
 bool _File::is_open() const {
 bool _File::is_open() const {
-	return f != NULL;
+	return f != nullptr;
 }
 }
 String _File::get_path() const {
 String _File::get_path() const {
 	ERR_FAIL_COND_V_MSG(!f, "", "File must be opened before use.");
 	ERR_FAIL_COND_V_MSG(!f, "", "File must be opened before use.");
@@ -2101,7 +2101,7 @@ bool _File::file_exists(const String &p_name) const {
 void _File::store_var(const Variant &p_var, bool p_full_objects) {
 void _File::store_var(const Variant &p_var, bool p_full_objects) {
 	ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
 	ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
 	int len;
 	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.");
 	ERR_FAIL_COND_MSG(err != OK, "Error when trying to encode Variant.");
 
 
 	PoolVector<uint8_t> buff;
 	PoolVector<uint8_t> buff;
@@ -2125,7 +2125,7 @@ Variant _File::get_var(bool p_allow_objects) const {
 	PoolVector<uint8_t>::Read r = buff.read();
 	PoolVector<uint8_t>::Read r = buff.read();
 
 
 	Variant v;
 	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.");
 	ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to encode Variant.");
 
 
 	return v;
 	return v;
@@ -2202,7 +2202,7 @@ void _File::_bind_methods() {
 }
 }
 
 
 _File::_File() {
 _File::_File() {
-	f = NULL;
+	f = nullptr;
 	eswap = false;
 	eswap = false;
 }
 }
 
 
@@ -2384,7 +2384,7 @@ _Directory::~_Directory() {
 		memdelete(d);
 		memdelete(d);
 }
 }
 
 
-_Marshalls *_Marshalls::singleton = NULL;
+_Marshalls *_Marshalls::singleton = nullptr;
 
 
 _Marshalls *_Marshalls::get_singleton() {
 _Marshalls *_Marshalls::get_singleton() {
 	return singleton;
 	return singleton;
@@ -2392,7 +2392,7 @@ _Marshalls *_Marshalls::get_singleton() {
 
 
 String _Marshalls::variant_to_base64(const Variant &p_var, bool p_full_objects) {
 String _Marshalls::variant_to_base64(const Variant &p_var, bool p_full_objects) {
 	int len;
 	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.");
 	ERR_FAIL_COND_V_MSG(err != OK, "", "Error when trying to encode Variant.");
 
 
 	PoolVector<uint8_t> buff;
 	PoolVector<uint8_t> buff;
@@ -2420,7 +2420,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());
 	ERR_FAIL_COND_V(CryptoCore::b64_decode(&w[0], buf.size(), &len, (unsigned char *)cstr.get_data(), strlen) != OK, Variant());
 
 
 	Variant v;
 	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.");
 	ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to decode Variant.");
 
 
 	return v;
 	return v;
@@ -2589,7 +2589,7 @@ Variant _Thread::wait_to_finish() {
 	thread.wait_to_finish();
 	thread.wait_to_finish();
 	Variant r = ret;
 	Variant r = ret;
 	target_method = StringName();
 	target_method = StringName();
-	target_instance = NULL;
+	target_instance = nullptr;
 	userdata = Variant();
 	userdata = Variant();
 	active.clear();
 	active.clear();
 
 
@@ -2607,7 +2607,7 @@ void _Thread::_bind_methods() {
 	BIND_ENUM_CONSTANT(PRIORITY_HIGH);
 	BIND_ENUM_CONSTANT(PRIORITY_HIGH);
 }
 }
 _Thread::_Thread() {
 _Thread::_Thread() {
-	target_instance = NULL;
+	target_instance = nullptr;
 }
 }
 
 
 _Thread::~_Thread() {
 _Thread::~_Thread() {
@@ -2951,7 +2951,7 @@ void _Engine::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::REAL, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
 	ADD_PROPERTY(PropertyInfo(Variant::REAL, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
 }
 }
 
 
-_Engine *_Engine::singleton = NULL;
+_Engine *_Engine::singleton = nullptr;
 
 
 _Engine::_Engine() {
 _Engine::_Engine() {
 	singleton = this;
 	singleton = this;
@@ -3027,7 +3027,7 @@ Ref<JSONParseResult> _JSON::parse(const String &p_json) {
 	return result;
 	return result;
 }
 }
 
 
-_JSON *_JSON::singleton = NULL;
+_JSON *_JSON::singleton = nullptr;
 
 
 _JSON::_JSON() {
 _JSON::_JSON() {
 	singleton = this;
 	singleton = this;

+ 1 - 1
core/bind/core_bind.h

@@ -644,7 +644,7 @@ public:
 	String base64_to_utf8(const String &p_str);
 	String base64_to_utf8(const String &p_str);
 
 
 	_Marshalls() { singleton = this; }
 	_Marshalls() { singleton = this; }
-	~_Marshalls() { singleton = NULL; }
+	~_Marshalls() { singleton = nullptr; }
 };
 };
 
 
 class _Mutex : public Reference {
 class _Mutex : public Reference {

+ 37 - 37
core/class_db.cpp

@@ -244,8 +244,8 @@ HashMap<StringName, StringName> ClassDB::compat_classes;
 
 
 ClassDB::ClassInfo::ClassInfo() {
 ClassDB::ClassInfo::ClassInfo() {
 	api = API_NONE;
 	api = API_NONE;
-	creation_func = NULL;
-	inherits_ptr = NULL;
+	creation_func = nullptr;
+	inherits_ptr = nullptr;
 	disabled = false;
 	disabled = false;
 	exposed = false;
 	exposed = false;
 }
 }
@@ -274,7 +274,7 @@ bool ClassDB::is_parent_class(const StringName &p_class, const StringName &p_inh
 void ClassDB::get_class_list(List<StringName> *p_classes) {
 void ClassDB::get_class_list(List<StringName> *p_classes) {
 	OBJTYPE_RLOCK;
 	OBJTYPE_RLOCK;
 
 
-	const StringName *k = NULL;
+	const StringName *k = nullptr;
 
 
 	while ((k = classes.next(k))) {
 	while ((k = classes.next(k))) {
 		p_classes->push_back(*k);
 		p_classes->push_back(*k);
@@ -286,7 +286,7 @@ void ClassDB::get_class_list(List<StringName> *p_classes) {
 void ClassDB::get_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes) {
 void ClassDB::get_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes) {
 	OBJTYPE_RLOCK;
 	OBJTYPE_RLOCK;
 
 
-	const StringName *k = NULL;
+	const StringName *k = nullptr;
 
 
 	while ((k = classes.next(k))) {
 	while ((k = classes.next(k))) {
 		if (*k != p_class && _is_parent_class(*k, p_class))
 		if (*k != p_class && _is_parent_class(*k, p_class))
@@ -297,7 +297,7 @@ void ClassDB::get_inheriters_from_class(const StringName &p_class, List<StringNa
 void ClassDB::get_direct_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes) {
 void ClassDB::get_direct_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes) {
 	OBJTYPE_RLOCK;
 	OBJTYPE_RLOCK;
 
 
-	const StringName *k = NULL;
+	const StringName *k = nullptr;
 
 
 	while ((k = classes.next(k))) {
 	while ((k = classes.next(k))) {
 		if (*k != p_class && _get_parent_class(*k) == p_class)
 		if (*k != p_class && _get_parent_class(*k) == p_class)
@@ -343,7 +343,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
 
 
 	List<StringName> names;
 	List<StringName> names;
 
 
-	const StringName *k = NULL;
+	const StringName *k = nullptr;
 
 
 	while ((k = classes.next(k))) {
 	while ((k = classes.next(k))) {
 		names.push_back(*k);
 		names.push_back(*k);
@@ -363,7 +363,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
 
 
 			List<StringName> snames;
 			List<StringName> snames;
 
 
-			k = NULL;
+			k = nullptr;
 
 
 			while ((k = t->method_map.next(k))) {
 			while ((k = t->method_map.next(k))) {
 				String name = k->operator String();
 				String name = k->operator String();
@@ -408,7 +408,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
 
 
 			List<StringName> snames;
 			List<StringName> snames;
 
 
-			k = NULL;
+			k = nullptr;
 
 
 			while ((k = t->constant_map.next(k))) {
 			while ((k = t->constant_map.next(k))) {
 				snames.push_back(*k);
 				snames.push_back(*k);
@@ -426,7 +426,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
 
 
 			List<StringName> snames;
 			List<StringName> snames;
 
 
-			k = NULL;
+			k = nullptr;
 
 
 			while ((k = t->signal_map.next(k))) {
 			while ((k = t->signal_map.next(k))) {
 				snames.push_back(*k);
 				snames.push_back(*k);
@@ -447,7 +447,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
 
 
 			List<StringName> snames;
 			List<StringName> snames;
 
 
-			k = NULL;
+			k = nullptr;
 
 
 			while ((k = t->property_setget.next(k))) {
 			while ((k = t->property_setget.next(k))) {
 				snames.push_back(*k);
 				snames.push_back(*k);
@@ -501,14 +501,14 @@ Object *ClassDB::instance(const StringName &p_class) {
 				ti = classes.getptr(compat_classes[p_class]);
 				ti = classes.getptr(compat_classes[p_class]);
 			}
 			}
 		}
 		}
-		ERR_FAIL_COND_V_MSG(!ti, NULL, "Cannot get class '" + String(p_class) + "'.");
-		ERR_FAIL_COND_V_MSG(ti->disabled, NULL, "Class '" + String(p_class) + "' is disabled.");
-		ERR_FAIL_COND_V(!ti->creation_func, NULL);
+		ERR_FAIL_COND_V_MSG(!ti, nullptr, "Cannot get class '" + String(p_class) + "'.");
+		ERR_FAIL_COND_V_MSG(ti->disabled, nullptr, "Class '" + String(p_class) + "' is disabled.");
+		ERR_FAIL_COND_V(!ti->creation_func, nullptr);
 	}
 	}
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED
 	if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) {
 	if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) {
 		ERR_PRINTS("Class '" + String(p_class) + "' can only be instantiated by editor.");
 		ERR_PRINTS("Class '" + String(p_class) + "' can only be instantiated by editor.");
-		return NULL;
+		return nullptr;
 	}
 	}
 #endif
 #endif
 	return ti->creation_func();
 	return ti->creation_func();
@@ -523,7 +523,7 @@ bool ClassDB::can_instance(const StringName &p_class) {
 		return false;
 		return false;
 	}
 	}
 #endif
 #endif
-	return (!ti->disabled && ti->creation_func != NULL);
+	return (!ti->disabled && ti->creation_func != nullptr);
 }
 }
 
 
 void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherits) {
 void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherits) {
@@ -544,7 +544,7 @@ void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherit
 		ti.inherits_ptr = &classes[ti.inherits];
 		ti.inherits_ptr = &classes[ti.inherits];
 
 
 	} else {
 	} else {
-		ti.inherits_ptr = NULL;
+		ti.inherits_ptr = nullptr;
 	}
 	}
 }
 }
 
 
@@ -625,7 +625,7 @@ MethodBind *ClassDB::get_method(StringName p_class, StringName p_name) {
 			return *method;
 			return *method;
 		type = type->inherits_ptr;
 		type = type->inherits_ptr;
 	}
 	}
-	return NULL;
+	return nullptr;
 }
 }
 
 
 void ClassDB::bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant) {
 void ClassDB::bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant) {
@@ -715,7 +715,7 @@ StringName ClassDB::get_integer_constant_enum(const StringName &p_class, const S
 	ClassInfo *type = classes.getptr(p_class);
 	ClassInfo *type = classes.getptr(p_class);
 
 
 	while (type) {
 	while (type) {
-		const StringName *k = NULL;
+		const StringName *k = nullptr;
 		while ((k = type->enum_map.next(k))) {
 		while ((k = type->enum_map.next(k))) {
 			List<StringName> &constants_list = type->enum_map.get(*k);
 			List<StringName> &constants_list = type->enum_map.get(*k);
 			const List<StringName>::Element *found = constants_list.find(p_name);
 			const List<StringName>::Element *found = constants_list.find(p_name);
@@ -738,7 +738,7 @@ void ClassDB::get_enum_list(const StringName &p_class, List<StringName> *p_enums
 	ClassInfo *type = classes.getptr(p_class);
 	ClassInfo *type = classes.getptr(p_class);
 
 
 	while (type) {
 	while (type) {
-		const StringName *k = NULL;
+		const StringName *k = nullptr;
 		while ((k = type->enum_map.next(k))) {
 		while ((k = type->enum_map.next(k))) {
 			p_enums->push_back(*k);
 			p_enums->push_back(*k);
 		}
 		}
@@ -799,7 +799,7 @@ void ClassDB::get_signal_list(StringName p_class, List<MethodInfo> *p_signals, b
 	ClassInfo *check = type;
 	ClassInfo *check = type;
 
 
 	while (check) {
 	while (check) {
-		const StringName *S = NULL;
+		const StringName *S = nullptr;
 		while ((S = check->signal_map.next(S))) {
 		while ((S = check->signal_map.next(S))) {
 			p_signals->push_back(check->signal_map[*S]);
 			p_signals->push_back(check->signal_map[*S]);
 		}
 		}
@@ -856,7 +856,7 @@ void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, cons
 
 
 	ERR_FAIL_COND(!type);
 	ERR_FAIL_COND(!type);
 
 
-	MethodBind *mb_set = NULL;
+	MethodBind *mb_set = nullptr;
 	if (p_setter) {
 	if (p_setter) {
 		mb_set = get_method(p_class, p_setter);
 		mb_set = get_method(p_class, p_setter);
 #ifdef DEBUG_METHODS_ENABLED
 #ifdef DEBUG_METHODS_ENABLED
@@ -868,7 +868,7 @@ void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, cons
 #endif
 #endif
 	}
 	}
 
 
-	MethodBind *mb_get = NULL;
+	MethodBind *mb_get = nullptr;
 	if (p_getter) {
 	if (p_getter) {
 		mb_get = get_method(p_class, p_getter);
 		mb_get = get_method(p_class, p_getter);
 #ifdef DEBUG_METHODS_ENABLED
 #ifdef DEBUG_METHODS_ENABLED
@@ -1000,9 +1000,9 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia
 			} else {
 			} else {
 				Variant::CallError ce;
 				Variant::CallError ce;
 				if (psg->_getptr) {
 				if (psg->_getptr) {
-					r_value = psg->_getptr->call(p_object, NULL, 0, ce);
+					r_value = psg->_getptr->call(p_object, nullptr, 0, ce);
 				} else {
 				} else {
-					r_value = p_object->call(psg->getter, NULL, 0, ce);
+					r_value = p_object->call(psg->getter, nullptr, 0, ce);
 				}
 				}
 			}
 			}
 			return true;
 			return true;
@@ -1137,33 +1137,33 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const c
 #endif
 #endif
 
 
 	OBJTYPE_WLOCK;
 	OBJTYPE_WLOCK;
-	ERR_FAIL_COND_V(!p_bind, NULL);
+	ERR_FAIL_COND_V(!p_bind, nullptr);
 	p_bind->set_name(mdname);
 	p_bind->set_name(mdname);
 
 
 	String instance_type = p_bind->get_instance_class();
 	String instance_type = p_bind->get_instance_class();
 
 
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
 
 
-	ERR_FAIL_COND_V_MSG(has_method(instance_type, mdname), NULL, "Class " + String(instance_type) + " already has a method " + String(mdname) + ".");
+	ERR_FAIL_COND_V_MSG(has_method(instance_type, mdname), nullptr, "Class " + String(instance_type) + " already has a method " + String(mdname) + ".");
 #endif
 #endif
 
 
 	ClassInfo *type = classes.getptr(instance_type);
 	ClassInfo *type = classes.getptr(instance_type);
 	if (!type) {
 	if (!type) {
 		memdelete(p_bind);
 		memdelete(p_bind);
-		ERR_FAIL_V_MSG(NULL, "Couldn't bind method '" + mdname + "' for instance '" + instance_type + "'.");
+		ERR_FAIL_V_MSG(nullptr, "Couldn't bind method '" + mdname + "' for instance '" + instance_type + "'.");
 	}
 	}
 
 
 	if (type->method_map.has(mdname)) {
 	if (type->method_map.has(mdname)) {
 		memdelete(p_bind);
 		memdelete(p_bind);
 		// overloading not supported
 		// overloading not supported
-		ERR_FAIL_V_MSG(NULL, "Method already bound '" + instance_type + "::" + mdname + "'.");
+		ERR_FAIL_V_MSG(nullptr, "Method already bound '" + instance_type + "::" + mdname + "'.");
 	}
 	}
 
 
 #ifdef DEBUG_METHODS_ENABLED
 #ifdef DEBUG_METHODS_ENABLED
 
 
 	if (method_name.args.size() > p_bind->get_argument_count()) {
 	if (method_name.args.size() > p_bind->get_argument_count()) {
 		memdelete(p_bind);
 		memdelete(p_bind);
-		ERR_FAIL_V_MSG(NULL, "Method definition provides more arguments than the method actually has '" + instance_type + "::" + mdname + "'.");
+		ERR_FAIL_V_MSG(nullptr, "Method definition provides more arguments than the method actually has '" + instance_type + "::" + mdname + "'.");
 	}
 	}
 
 
 	p_bind->set_argument_names(method_name.args);
 	p_bind->set_argument_names(method_name.args);
@@ -1265,7 +1265,7 @@ void ClassDB::add_resource_base_extension(const StringName &p_extension, const S
 }
 }
 
 
 void ClassDB::get_resource_base_extensions(List<String> *p_extensions) {
 void ClassDB::get_resource_base_extensions(List<String> *p_extensions) {
-	const StringName *K = NULL;
+	const StringName *K = nullptr;
 
 
 	while ((K = resource_base_extensions.next(K))) {
 	while ((K = resource_base_extensions.next(K))) {
 		p_extensions->push_back(*K);
 		p_extensions->push_back(*K);
@@ -1273,7 +1273,7 @@ void ClassDB::get_resource_base_extensions(List<String> *p_extensions) {
 }
 }
 
 
 void ClassDB::get_extensions_for_type(const StringName &p_class, List<String> *p_extensions) {
 void ClassDB::get_extensions_for_type(const StringName &p_class, List<String> *p_extensions) {
-	const StringName *K = NULL;
+	const StringName *K = nullptr;
 
 
 	while ((K = resource_base_extensions.next(K))) {
 	while ((K = resource_base_extensions.next(K))) {
 		StringName cmp = resource_base_extensions[*K];
 		StringName cmp = resource_base_extensions[*K];
@@ -1291,7 +1291,7 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
 			default_values[p_class] = HashMap<StringName, Variant>();
 			default_values[p_class] = HashMap<StringName, Variant>();
 		}
 		}
 
 
-		Object *c = NULL;
+		Object *c = nullptr;
 		bool cleanup_c = false;
 		bool cleanup_c = false;
 
 
 		if (Engine::get_singleton()->has_singleton(p_class)) {
 		if (Engine::get_singleton()->has_singleton(p_class)) {
@@ -1323,18 +1323,18 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
 	}
 	}
 
 
 	if (!default_values.has(p_class)) {
 	if (!default_values.has(p_class)) {
-		if (r_valid != NULL)
+		if (r_valid != nullptr)
 			*r_valid = false;
 			*r_valid = false;
 		return Variant();
 		return Variant();
 	}
 	}
 
 
 	if (!default_values[p_class].has(p_property)) {
 	if (!default_values[p_class].has(p_property)) {
-		if (r_valid != NULL)
+		if (r_valid != nullptr)
 			*r_valid = false;
 			*r_valid = false;
 		return Variant();
 		return Variant();
 	}
 	}
 
 
-	if (r_valid != NULL)
+	if (r_valid != nullptr)
 		*r_valid = true;
 		*r_valid = true;
 	return default_values[p_class][p_property];
 	return default_values[p_class][p_property];
 }
 }
@@ -1349,12 +1349,12 @@ void ClassDB::cleanup_defaults() {
 void ClassDB::cleanup() {
 void ClassDB::cleanup() {
 	//OBJTYPE_LOCK; hah not here
 	//OBJTYPE_LOCK; hah not here
 
 
-	const StringName *k = NULL;
+	const StringName *k = nullptr;
 
 
 	while ((k = classes.next(k))) {
 	while ((k = classes.next(k))) {
 		ClassInfo &ti = classes[*k];
 		ClassInfo &ti = classes[*k];
 
 
-		const StringName *m = NULL;
+		const StringName *m = nullptr;
 		while ((m = ti.method_map.next(m))) {
 		while ((m = ti.method_map.next(m))) {
 			memdelete(ti.method_map[*m]);
 			memdelete(ti.method_map[*m]);
 		}
 		}

+ 10 - 10
core/class_db.h

@@ -227,7 +227,7 @@ public:
 	static MethodBind *bind_method(N p_method_name, M p_method) {
 	static MethodBind *bind_method(N p_method_name, M p_method) {
 		MethodBind *bind = create_method_bind(p_method);
 		MethodBind *bind = create_method_bind(p_method);
 
 
-		return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, NULL, 0); //use static function, much smaller binary usage
+		return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, nullptr, 0); //use static function, much smaller binary usage
 	}
 	}
 
 
 	template <class N, class M>
 	template <class N, class M>
@@ -299,7 +299,7 @@ public:
 		GLOBAL_LOCK_FUNCTION;
 		GLOBAL_LOCK_FUNCTION;
 
 
 		MethodBind *bind = create_vararg_method_bind(p_method, p_info, p_return_nil_is_variant);
 		MethodBind *bind = create_vararg_method_bind(p_method, p_info, p_return_nil_is_variant);
-		ERR_FAIL_COND_V(!bind, NULL);
+		ERR_FAIL_COND_V(!bind, nullptr);
 
 
 		bind->set_name(p_name);
 		bind->set_name(p_name);
 		bind->set_default_arguments(p_default_args);
 		bind->set_default_arguments(p_default_args);
@@ -309,13 +309,13 @@ public:
 		ClassInfo *type = classes.getptr(instance_type);
 		ClassInfo *type = classes.getptr(instance_type);
 		if (!type) {
 		if (!type) {
 			memdelete(bind);
 			memdelete(bind);
-			ERR_FAIL_COND_V(!type, NULL);
+			ERR_FAIL_COND_V(!type, nullptr);
 		}
 		}
 
 
 		if (type->method_map.has(p_name)) {
 		if (type->method_map.has(p_name)) {
 			memdelete(bind);
 			memdelete(bind);
 			// overloading not supported
 			// overloading not supported
-			ERR_FAIL_V_MSG(NULL, "Method already bound: " + instance_type + "::" + p_name + ".");
+			ERR_FAIL_V_MSG(nullptr, "Method already bound: " + instance_type + "::" + p_name + ".");
 		}
 		}
 		type->method_map[p_name] = bind;
 		type->method_map[p_name] = bind;
 #ifdef DEBUG_METHODS_ENABLED
 #ifdef DEBUG_METHODS_ENABLED
@@ -335,12 +335,12 @@ public:
 	static void add_property_group(StringName p_class, const String &p_name, const String &p_prefix = "");
 	static void add_property_group(StringName p_class, const String &p_name, const String &p_prefix = "");
 	static void add_property(StringName p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1);
 	static void add_property(StringName p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1);
 	static void set_property_default_value(StringName p_class, const StringName &p_name, const Variant &p_default);
 	static void set_property_default_value(StringName p_class, const StringName &p_name, const Variant &p_default);
-	static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = NULL);
-	static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = NULL);
+	static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = nullptr);
+	static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = nullptr);
 	static bool get_property(Object *p_object, const StringName &p_property, Variant &r_value);
 	static bool get_property(Object *p_object, const StringName &p_property, Variant &r_value);
 	static bool has_property(const StringName &p_class, const StringName &p_property, bool p_no_inheritance = false);
 	static bool has_property(const StringName &p_class, const StringName &p_property, bool p_no_inheritance = false);
-	static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = NULL);
-	static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = NULL);
+	static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
+	static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
 	static StringName get_property_setter(StringName p_class, const StringName &p_property);
 	static StringName get_property_setter(StringName p_class, const StringName &p_property);
 	static StringName get_property_getter(StringName p_class, const StringName &p_property);
 	static StringName get_property_getter(StringName p_class, const StringName &p_property);
 
 
@@ -355,13 +355,13 @@ public:
 
 
 	static void bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant);
 	static void bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant);
 	static void get_integer_constant_list(const StringName &p_class, List<String> *p_constants, bool p_no_inheritance = false);
 	static void get_integer_constant_list(const StringName &p_class, List<String> *p_constants, bool p_no_inheritance = false);
-	static int get_integer_constant(const StringName &p_class, const StringName &p_name, bool *p_success = NULL);
+	static int get_integer_constant(const StringName &p_class, const StringName &p_name, bool *p_success = nullptr);
 
 
 	static StringName get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false);
 	static StringName get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false);
 	static void get_enum_list(const StringName &p_class, List<StringName> *p_enums, bool p_no_inheritance = false);
 	static void get_enum_list(const StringName &p_class, List<StringName> *p_enums, bool p_no_inheritance = false);
 	static void get_enum_constants(const StringName &p_class, const StringName &p_enum, List<StringName> *p_constants, bool p_no_inheritance = false);
 	static void get_enum_constants(const StringName &p_class, const StringName &p_enum, List<StringName> *p_constants, bool p_no_inheritance = false);
 
 
-	static Variant class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid = NULL);
+	static Variant class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid = nullptr);
 
 
 	static StringName get_category(const StringName &p_node);
 	static StringName get_category(const StringName &p_node);
 
 

+ 1 - 1
core/command_queue_mt.cpp

@@ -110,7 +110,7 @@ CommandQueueMT::CommandQueueMT(bool p_sync) {
 	if (p_sync) {
 	if (p_sync) {
 		sync = memnew(Semaphore);
 		sync = memnew(Semaphore);
 	} else {
 	} else {
-		sync = NULL;
+		sync = nullptr;
 	}
 	}
 }
 }
 
 

+ 5 - 5
core/command_queue_mt.h

@@ -329,7 +329,7 @@ class CommandQueueMT {
 		uint32_t alloc_size = ((sizeof(T) + 8 - 1) & ~(8 - 1)) + 8;
 		uint32_t alloc_size = ((sizeof(T) + 8 - 1) & ~(8 - 1)) + 8;
 
 
 		// Assert that the buffer is big enough to hold at least two messages.
 		// Assert that the buffer is big enough to hold at least two messages.
-		ERR_FAIL_COND_V(alloc_size * 2 + sizeof(uint32_t) > command_mem_size, NULL);
+		ERR_FAIL_COND_V(alloc_size * 2 + sizeof(uint32_t) > command_mem_size, nullptr);
 
 
 	tryagain:
 	tryagain:
 		uint32_t write_ptr = write_ptr_and_epoch >> 1;
 		uint32_t write_ptr = write_ptr_and_epoch >> 1;
@@ -341,7 +341,7 @@ class CommandQueueMT {
 				if (dealloc_one()) {
 				if (dealloc_one()) {
 					goto tryagain;
 					goto tryagain;
 				}
 				}
-				return NULL;
+				return nullptr;
 			}
 			}
 		} else {
 		} else {
 			// ahead of dealloc_ptr, check that there is room
 			// ahead of dealloc_ptr, check that there is room
@@ -355,11 +355,11 @@ class CommandQueueMT {
 					if (dealloc_one()) {
 					if (dealloc_one()) {
 						goto tryagain;
 						goto tryagain;
 					}
 					}
-					return NULL;
+					return nullptr;
 				}
 				}
 
 
 				// if this happens, it's a bug
 				// if this happens, it's a bug
-				ERR_FAIL_COND_V((command_mem_size - write_ptr) < 8, NULL);
+				ERR_FAIL_COND_V((command_mem_size - write_ptr) < 8, nullptr);
 				// zero means, wrap to beginning
 				// zero means, wrap to beginning
 
 
 				uint32_t *p = (uint32_t *)&command_mem[write_ptr];
 				uint32_t *p = (uint32_t *)&command_mem[write_ptr];
@@ -392,7 +392,7 @@ class CommandQueueMT {
 		lock();
 		lock();
 		T *ret;
 		T *ret;
 
 
-		while ((ret = allocate<T>()) == NULL) {
+		while ((ret = allocate<T>()) == nullptr) {
 			unlock();
 			unlock();
 			// sleep a little until fetch happened and some room is made
 			// sleep a little until fetch happened and some room is made
 			wait_for_flush();
 			wait_for_flush();

+ 1 - 1
core/core_string_names.cpp

@@ -30,7 +30,7 @@
 
 
 #include "core_string_names.h"
 #include "core_string_names.h"
 
 
-CoreStringNames *CoreStringNames::singleton = NULL;
+CoreStringNames *CoreStringNames::singleton = nullptr;
 
 
 CoreStringNames::CoreStringNames() :
 CoreStringNames::CoreStringNames() :
 		_free(StaticCString::create("free")),
 		_free(StaticCString::create("free")),

+ 1 - 1
core/core_string_names.h

@@ -40,7 +40,7 @@ class CoreStringNames {
 	static void create() { singleton = memnew(CoreStringNames); }
 	static void create() { singleton = memnew(CoreStringNames); }
 	static void free() {
 	static void free() {
 		memdelete(singleton);
 		memdelete(singleton);
-		singleton = NULL;
+		singleton = nullptr;
 	}
 	}
 
 
 	CoreStringNames();
 	CoreStringNames();

+ 7 - 7
core/cowdata.h

@@ -64,21 +64,21 @@ private:
 
 
 	_FORCE_INLINE_ SafeNumeric<uint32_t> *_get_refcount() const {
 	_FORCE_INLINE_ SafeNumeric<uint32_t> *_get_refcount() const {
 		if (!_ptr)
 		if (!_ptr)
-			return NULL;
+			return nullptr;
 
 
 		return reinterpret_cast<SafeNumeric<uint32_t> *>(_ptr) - 2;
 		return reinterpret_cast<SafeNumeric<uint32_t> *>(_ptr) - 2;
 	}
 	}
 
 
 	_FORCE_INLINE_ uint32_t *_get_size() const {
 	_FORCE_INLINE_ uint32_t *_get_size() const {
 		if (!_ptr)
 		if (!_ptr)
-			return NULL;
+			return nullptr;
 
 
 		return reinterpret_cast<uint32_t *>(_ptr) - 1;
 		return reinterpret_cast<uint32_t *>(_ptr) - 1;
 	}
 	}
 
 
 	_FORCE_INLINE_ T *_get_data() const {
 	_FORCE_INLINE_ T *_get_data() const {
 		if (!_ptr)
 		if (!_ptr)
-			return NULL;
+			return nullptr;
 		return reinterpret_cast<T *>(_ptr);
 		return reinterpret_cast<T *>(_ptr);
 	}
 	}
 
 
@@ -133,7 +133,7 @@ public:
 	}
 	}
 
 
 	_FORCE_INLINE_ void clear() { resize(0); }
 	_FORCE_INLINE_ void clear() { resize(0); }
-	_FORCE_INLINE_ bool empty() const { return _ptr == 0; }
+	_FORCE_INLINE_ bool empty() const { return _ptr == nullptr; }
 
 
 	_FORCE_INLINE_ void set(int p_index, const T &p_elem) {
 	_FORCE_INLINE_ void set(int p_index, const T &p_elem) {
 		CRASH_BAD_INDEX(p_index, size());
 		CRASH_BAD_INDEX(p_index, size());
@@ -257,7 +257,7 @@ Error CowData<T>::resize(int p_size) {
 	if (p_size == 0) {
 	if (p_size == 0) {
 		// wants to clean up
 		// wants to clean up
 		_unref(_ptr);
 		_unref(_ptr);
-		_ptr = NULL;
+		_ptr = nullptr;
 		return OK;
 		return OK;
 	}
 	}
 
 
@@ -352,7 +352,7 @@ void CowData<T>::_ref(const CowData &p_from) {
 		return; // self assign, do nothing.
 		return; // self assign, do nothing.
 
 
 	_unref(_ptr);
 	_unref(_ptr);
-	_ptr = NULL;
+	_ptr = nullptr;
 
 
 	if (!p_from._ptr)
 	if (!p_from._ptr)
 		return; //nothing to do
 		return; //nothing to do
@@ -364,7 +364,7 @@ void CowData<T>::_ref(const CowData &p_from) {
 
 
 template <class T>
 template <class T>
 CowData<T>::CowData() {
 CowData<T>::CowData() {
-	_ptr = NULL;
+	_ptr = nullptr;
 }
 }
 
 
 template <class T>
 template <class T>

+ 8 - 8
core/crypto/crypto.cpp

@@ -36,11 +36,11 @@
 
 
 /// Resources
 /// Resources
 
 
-CryptoKey *(*CryptoKey::_create)() = NULL;
+CryptoKey *(*CryptoKey::_create)() = nullptr;
 CryptoKey *CryptoKey::create() {
 CryptoKey *CryptoKey::create() {
 	if (_create)
 	if (_create)
 		return _create();
 		return _create();
-	return NULL;
+	return nullptr;
 }
 }
 
 
 void CryptoKey::_bind_methods() {
 void CryptoKey::_bind_methods() {
@@ -51,11 +51,11 @@ void CryptoKey::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("load_from_string", "string_key", "public_only"), &CryptoKey::load_from_string, DEFVAL(false));
 	ClassDB::bind_method(D_METHOD("load_from_string", "string_key", "public_only"), &CryptoKey::load_from_string, DEFVAL(false));
 }
 }
 
 
-X509Certificate *(*X509Certificate::_create)() = NULL;
+X509Certificate *(*X509Certificate::_create)() = nullptr;
 X509Certificate *X509Certificate::create() {
 X509Certificate *X509Certificate::create() {
 	if (_create)
 	if (_create)
 		return _create();
 		return _create();
-	return NULL;
+	return nullptr;
 }
 }
 
 
 void X509Certificate::_bind_methods() {
 void X509Certificate::_bind_methods() {
@@ -65,12 +65,12 @@ void X509Certificate::_bind_methods() {
 
 
 /// Crypto
 /// 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() {
 Crypto *Crypto::create() {
 	if (_create)
 	if (_create)
 		return _create();
 		return _create();
-	ERR_FAIL_V_MSG(NULL, "Crypto is not available when the mbedtls module is disabled.");
+	ERR_FAIL_V_MSG(nullptr, "Crypto is not available when the mbedtls module is disabled.");
 }
 }
 
 
 void Crypto::load_default_certificates(String p_path) {
 void Crypto::load_default_certificates(String p_path) {
@@ -111,7 +111,7 @@ RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_origi
 			key->load(p_path, true);
 			key->load(p_path, true);
 		return key;
 		return key;
 	}
 	}
-	return NULL;
+	return nullptr;
 }
 }
 
 
 void ResourceFormatLoaderCrypto::get_recognized_extensions(List<String> *p_extensions) const {
 void ResourceFormatLoaderCrypto::get_recognized_extensions(List<String> *p_extensions) const {

+ 1 - 1
core/crypto/crypto.h

@@ -94,7 +94,7 @@ public:
 
 
 class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
 class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
 public:
 public:
-	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual bool handles_type(const String &p_type) const;
 	virtual bool handles_type(const String &p_type) const;
 	virtual String get_resource_type(const String &p_path) const;
 	virtual String get_resource_type(const String &p_path) const;

+ 8 - 8
core/crypto/hashing_context.cpp

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

+ 7 - 7
core/dictionary.cpp

@@ -83,7 +83,7 @@ const Variant *Dictionary::getptr(const Variant &p_key) const {
 	OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::ConstElement E = ((const OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> *)&_p->variant_map)->find(p_key);
 	OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::ConstElement E = ((const OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> *)&_p->variant_map)->find(p_key);
 
 
 	if (!E)
 	if (!E)
-		return NULL;
+		return nullptr;
 	return &E.get();
 	return &E.get();
 }
 }
 
 
@@ -91,7 +91,7 @@ Variant *Dictionary::getptr(const Variant &p_key) {
 	OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(p_key);
 	OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(p_key);
 
 
 	if (!E)
 	if (!E)
-		return NULL;
+		return nullptr;
 	return &E.get();
 	return &E.get();
 }
 }
 
 
@@ -168,7 +168,7 @@ void Dictionary::_unref() const {
 	if (_p->refcount.unref()) {
 	if (_p->refcount.unref()) {
 		memdelete(_p);
 		memdelete(_p);
 	}
 	}
-	_p = NULL;
+	_p = nullptr;
 }
 }
 uint32_t Dictionary::hash() const {
 uint32_t Dictionary::hash() const {
 	uint32_t h = hash_djb2_one_32(Variant::DICTIONARY);
 	uint32_t h = hash_djb2_one_32(Variant::DICTIONARY);
@@ -214,17 +214,17 @@ Array Dictionary::values() const {
 }
 }
 
 
 const Variant *Dictionary::next(const Variant *p_key) const {
 const Variant *Dictionary::next(const Variant *p_key) const {
-	if (p_key == NULL) {
+	if (p_key == nullptr) {
 		// caller wants to get the first element
 		// caller wants to get the first element
 		if (_p->variant_map.front())
 		if (_p->variant_map.front())
 			return &_p->variant_map.front().key();
 			return &_p->variant_map.front().key();
-		return NULL;
+		return nullptr;
 	}
 	}
 	OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(*p_key);
 	OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(*p_key);
 
 
 	if (E && E.next())
 	if (E && E.next())
 		return &E.next().key();
 		return &E.next().key();
-	return NULL;
+	return nullptr;
 }
 }
 
 
 Dictionary Dictionary::duplicate(bool p_deep) const {
 Dictionary Dictionary::duplicate(bool p_deep) const {
@@ -246,7 +246,7 @@ const void *Dictionary::id() const {
 }
 }
 
 
 Dictionary::Dictionary(const Dictionary &p_from) {
 Dictionary::Dictionary(const Dictionary &p_from) {
-	_p = NULL;
+	_p = nullptr;
 	_ref(p_from);
 	_ref(p_from);
 }
 }
 
 

+ 1 - 1
core/dictionary.h

@@ -74,7 +74,7 @@ public:
 	uint32_t hash() const;
 	uint32_t hash() const;
 	void operator=(const Dictionary &p_dictionary);
 	void operator=(const Dictionary &p_dictionary);
 
 
-	const Variant *next(const Variant *p_key = NULL) const;
+	const Variant *next(const Variant *p_key = nullptr) const;
 
 
 	Array keys() const;
 	Array keys() const;
 	Array values() const;
 	Array values() const;

+ 3 - 3
core/engine.cpp

@@ -106,7 +106,7 @@ Dictionary Engine::get_version_info() const {
 
 
 static Array array_from_info(const char *const *info_list) {
 static Array array_from_info(const char *const *info_list) {
 	Array arr;
 	Array arr;
-	for (int i = 0; info_list[i] != NULL; i++) {
+	for (int i = 0; info_list[i] != nullptr; i++) {
 		arr.push_back(info_list[i]);
 		arr.push_back(info_list[i]);
 	}
 	}
 	return arr;
 	return arr;
@@ -185,7 +185,7 @@ void Engine::add_singleton(const Singleton &p_singleton) {
 
 
 Object *Engine::get_singleton_object(const String &p_name) const {
 Object *Engine::get_singleton_object(const String &p_name) const {
 	const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name);
 	const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name);
-	ERR_FAIL_COND_V_MSG(!E, NULL, "Failed to retrieve non-existent singleton '" + p_name + "'.");
+	ERR_FAIL_COND_V_MSG(!E, nullptr, "Failed to retrieve non-existent singleton '" + p_name + "'.");
 	return E->get();
 	return E->get();
 };
 };
 
 
@@ -198,7 +198,7 @@ void Engine::get_singletons(List<Singleton> *p_singletons) {
 		p_singletons->push_back(E->get());
 		p_singletons->push_back(E->get());
 }
 }
 
 
-Engine *Engine::singleton = NULL;
+Engine *Engine::singleton = nullptr;
 
 
 Engine *Engine::get_singleton() {
 Engine *Engine::get_singleton() {
 	return singleton;
 	return singleton;

+ 1 - 1
core/engine.h

@@ -41,7 +41,7 @@ public:
 	struct Singleton {
 	struct Singleton {
 		StringName name;
 		StringName name;
 		Object *ptr;
 		Object *ptr;
-		Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL);
+		Singleton(const StringName &p_name = StringName(), Object *p_ptr = nullptr);
 	};
 	};
 
 
 private:
 private:

+ 2 - 2
core/error_macros.cpp

@@ -34,7 +34,7 @@
 #include "core/ustring.h"
 #include "core/ustring.h"
 #include "os/os.h"
 #include "os/os.h"
 
 
-static ErrorHandlerList *error_handler_list = NULL;
+static ErrorHandlerList *error_handler_list = nullptr;
 
 
 void add_error_handler(ErrorHandlerList *p_handler) {
 void add_error_handler(ErrorHandlerList *p_handler) {
 	_global_lock();
 	_global_lock();
@@ -46,7 +46,7 @@ void add_error_handler(ErrorHandlerList *p_handler) {
 void remove_error_handler(ErrorHandlerList *p_handler) {
 void remove_error_handler(ErrorHandlerList *p_handler) {
 	_global_lock();
 	_global_lock();
 
 
-	ErrorHandlerList *prev = NULL;
+	ErrorHandlerList *prev = nullptr;
 	ErrorHandlerList *l = error_handler_list;
 	ErrorHandlerList *l = error_handler_list;
 
 
 	while (l) {
 	while (l) {

+ 3 - 3
core/error_macros.h

@@ -67,9 +67,9 @@ struct ErrorHandlerList {
 	ErrorHandlerList *next;
 	ErrorHandlerList *next;
 
 
 	ErrorHandlerList() {
 	ErrorHandlerList() {
-		errfunc = 0;
-		next = 0;
-		userdata = 0;
+		errfunc = nullptr;
+		next = nullptr;
+		userdata = nullptr;
 	}
 	}
 };
 };
 
 

+ 24 - 24
core/hash_map.h

@@ -75,7 +75,7 @@ public:
 
 
 		uint32_t hash;
 		uint32_t hash;
 		Element *next;
 		Element *next;
-		Element() { next = 0; }
+		Element() { next = nullptr; }
 		Pair pair;
 		Pair pair;
 
 
 	public:
 	public:
@@ -105,14 +105,14 @@ private:
 		hash_table_power = MIN_HASH_TABLE_POWER;
 		hash_table_power = MIN_HASH_TABLE_POWER;
 		elements = 0;
 		elements = 0;
 		for (int i = 0; i < (1 << MIN_HASH_TABLE_POWER); i++)
 		for (int i = 0; i < (1 << MIN_HASH_TABLE_POWER); i++)
-			hash_table[i] = 0;
+			hash_table[i] = nullptr;
 	}
 	}
 
 
 	void erase_hash_table() {
 	void erase_hash_table() {
 		ERR_FAIL_COND_MSG(elements, "Cannot erase hash table if there are still elements inside.");
 		ERR_FAIL_COND_MSG(elements, "Cannot erase hash table if there are still elements inside.");
 
 
 		memdelete_arr(hash_table);
 		memdelete_arr(hash_table);
-		hash_table = 0;
+		hash_table = nullptr;
 		hash_table_power = 0;
 		hash_table_power = 0;
 		elements = 0;
 		elements = 0;
 	}
 	}
@@ -147,7 +147,7 @@ private:
 		ERR_FAIL_COND_MSG(!new_hash_table, "Out of memory.");
 		ERR_FAIL_COND_MSG(!new_hash_table, "Out of memory.");
 
 
 		for (int i = 0; i < (1 << new_hash_table_power); i++) {
 		for (int i = 0; i < (1 << new_hash_table_power); i++) {
-			new_hash_table[i] = 0;
+			new_hash_table[i] = nullptr;
 		}
 		}
 
 
 		if (hash_table) {
 		if (hash_table) {
@@ -184,13 +184,13 @@ private:
 			e = e->next;
 			e = e->next;
 		}
 		}
 
 
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	Element *create_element(const TKey &p_key) {
 	Element *create_element(const TKey &p_key) {
 		/* if element doesn't exist, create it */
 		/* if element doesn't exist, create it */
 		Element *e = memnew(Element);
 		Element *e = memnew(Element);
-		ERR_FAIL_COND_V_MSG(!e, NULL, "Out of memory.");
+		ERR_FAIL_COND_V_MSG(!e, nullptr, "Out of memory.");
 		uint32_t hash = Hasher::hash(p_key);
 		uint32_t hash = Hasher::hash(p_key);
 		uint32_t index = hash & ((1 << hash_table_power) - 1);
 		uint32_t index = hash & ((1 << hash_table_power) - 1);
 		e->next = hash_table[index];
 		e->next = hash_table[index];
@@ -218,7 +218,7 @@ private:
 		elements = p_t.elements;
 		elements = p_t.elements;
 
 
 		for (int i = 0; i < (1 << p_t.hash_table_power); i++) {
 		for (int i = 0; i < (1 << p_t.hash_table_power); i++) {
-			hash_table[i] = NULL;
+			hash_table[i] = nullptr;
 
 
 			const Element *e = p_t.hash_table[i];
 			const Element *e = p_t.hash_table[i];
 
 
@@ -242,7 +242,7 @@ public:
 	}
 	}
 
 
 	Element *set(const Pair &p_pair) {
 	Element *set(const Pair &p_pair) {
-		Element *e = NULL;
+		Element *e = nullptr;
 		if (!hash_table)
 		if (!hash_table)
 			make_hash_table(); // if no table, make one
 			make_hash_table(); // if no table, make one
 		else
 		else
@@ -253,7 +253,7 @@ public:
 		if (!e) {
 		if (!e) {
 			e = create_element(p_pair.key);
 			e = create_element(p_pair.key);
 			if (!e)
 			if (!e)
-				return NULL;
+				return nullptr;
 			check_hash_table(); // perform mantenience routine
 			check_hash_table(); // perform mantenience routine
 		}
 		}
 
 
@@ -262,7 +262,7 @@ public:
 	}
 	}
 
 
 	bool has(const TKey &p_key) const {
 	bool has(const TKey &p_key) const {
-		return getptr(p_key) != NULL;
+		return getptr(p_key) != nullptr;
 	}
 	}
 
 
 	/**
 	/**
@@ -290,26 +290,26 @@ public:
 
 
 	_FORCE_INLINE_ TData *getptr(const TKey &p_key) {
 	_FORCE_INLINE_ TData *getptr(const TKey &p_key) {
 		if (unlikely(!hash_table))
 		if (unlikely(!hash_table))
-			return NULL;
+			return nullptr;
 
 
 		Element *e = const_cast<Element *>(get_element(p_key));
 		Element *e = const_cast<Element *>(get_element(p_key));
 
 
 		if (e)
 		if (e)
 			return &e->pair.data;
 			return &e->pair.data;
 
 
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	_FORCE_INLINE_ const TData *getptr(const TKey &p_key) const {
 	_FORCE_INLINE_ const TData *getptr(const TKey &p_key) const {
 		if (unlikely(!hash_table))
 		if (unlikely(!hash_table))
-			return NULL;
+			return nullptr;
 
 
 		const Element *e = const_cast<Element *>(get_element(p_key));
 		const Element *e = const_cast<Element *>(get_element(p_key));
 
 
 		if (e)
 		if (e)
 			return &e->pair.data;
 			return &e->pair.data;
 
 
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	/**
 	/**
@@ -320,7 +320,7 @@ public:
 	template <class C>
 	template <class C>
 	_FORCE_INLINE_ TData *custom_getptr(C p_custom_key, uint32_t p_custom_hash) {
 	_FORCE_INLINE_ TData *custom_getptr(C p_custom_key, uint32_t p_custom_hash) {
 		if (unlikely(!hash_table))
 		if (unlikely(!hash_table))
-			return NULL;
+			return nullptr;
 
 
 		uint32_t hash = p_custom_hash;
 		uint32_t hash = p_custom_hash;
 		uint32_t index = hash & ((1 << hash_table_power) - 1);
 		uint32_t index = hash & ((1 << hash_table_power) - 1);
@@ -337,7 +337,7 @@ public:
 			e = e->next;
 			e = e->next;
 		}
 		}
 
 
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	template <class C>
 	template <class C>
@@ -375,7 +375,7 @@ public:
 		uint32_t index = hash & ((1 << hash_table_power) - 1);
 		uint32_t index = hash & ((1 << hash_table_power) - 1);
 
 
 		Element *e = hash_table[index];
 		Element *e = hash_table[index];
-		Element *p = NULL;
+		Element *p = nullptr;
 		while (e) {
 		while (e) {
 			/* checking hash first avoids comparing key, which may take longer */
 			/* checking hash first avoids comparing key, which may take longer */
 			if (e->hash == hash && Comparator::compare(e->pair.key, p_key)) {
 			if (e->hash == hash && Comparator::compare(e->pair.key, p_key)) {
@@ -409,7 +409,7 @@ public:
 	}
 	}
 	inline TData &operator[](const TKey &p_key) { //assignment
 	inline TData &operator[](const TKey &p_key) { //assignment
 
 
-		Element *e = NULL;
+		Element *e = nullptr;
 		if (!hash_table)
 		if (!hash_table)
 			make_hash_table(); // if no table, make one
 			make_hash_table(); // if no table, make one
 		else
 		else
@@ -442,7 +442,7 @@ public:
 	*/
 	*/
 	const TKey *next(const TKey *p_key) const {
 	const TKey *next(const TKey *p_key) const {
 		if (unlikely(!hash_table))
 		if (unlikely(!hash_table))
-			return NULL;
+			return nullptr;
 
 
 		if (!p_key) { /* get the first key */
 		if (!p_key) { /* get the first key */
 
 
@@ -455,7 +455,7 @@ public:
 		} else { /* get the next key */
 		} else { /* get the next key */
 
 
 			const Element *e = get_element(*p_key);
 			const Element *e = get_element(*p_key);
-			ERR_FAIL_COND_V_MSG(!e, NULL, "Invalid key supplied.");
+			ERR_FAIL_COND_V_MSG(!e, nullptr, "Invalid key supplied.");
 			if (e->next) {
 			if (e->next) {
 				/* if there is a "next" in the list, return that */
 				/* if there is a "next" in the list, return that */
 				return &e->next->pair.key;
 				return &e->next->pair.key;
@@ -473,7 +473,7 @@ public:
 			/* nothing found, was at end */
 			/* nothing found, was at end */
 		}
 		}
 
 
-		return NULL; /* nothing found */
+		return nullptr; /* nothing found */
 	}
 	}
 
 
 	inline unsigned int size() const {
 	inline unsigned int size() const {
@@ -498,7 +498,7 @@ public:
 			memdelete_arr(hash_table);
 			memdelete_arr(hash_table);
 		}
 		}
 
 
-		hash_table = 0;
+		hash_table = nullptr;
 		hash_table_power = 0;
 		hash_table_power = 0;
 		elements = 0;
 		elements = 0;
 	}
 	}
@@ -508,7 +508,7 @@ public:
 	}
 	}
 
 
 	HashMap() {
 	HashMap() {
-		hash_table = NULL;
+		hash_table = nullptr;
 		elements = 0;
 		elements = 0;
 		hash_table_power = 0;
 		hash_table_power = 0;
 	}
 	}
@@ -539,7 +539,7 @@ public:
 	}
 	}
 
 
 	HashMap(const HashMap &p_table) {
 	HashMap(const HashMap &p_table) {
-		hash_table = NULL;
+		hash_table = nullptr;
 		elements = 0;
 		elements = 0;
 		hash_table_power = 0;
 		hash_table_power = 0;
 
 

+ 28 - 28
core/image.cpp

@@ -82,10 +82,10 @@ const char *Image::format_names[Image::FORMAT_MAX] = {
 
 
 };
 };
 
 
-SavePNGFunc Image::save_png_func = NULL;
-SaveEXRFunc Image::save_exr_func = NULL;
+SavePNGFunc Image::save_png_func = nullptr;
+SaveEXRFunc Image::save_exr_func = nullptr;
 
 
-SavePNGBufferFunc Image::save_png_buffer_func = NULL;
+SavePNGBufferFunc Image::save_png_buffer_func = nullptr;
 
 
 void Image::_put_pixelb(int p_x, int p_y, uint32_t p_pixelsize, uint8_t *p_data, const uint8_t *p_pixel) {
 void Image::_put_pixelb(int p_x, int p_y, uint32_t p_pixelsize, uint8_t *p_data, const uint8_t *p_pixel) {
 	uint32_t ofs = (p_y * width + p_x) * p_pixelsize;
 	uint32_t ofs = (p_y * width + p_x) * p_pixelsize;
@@ -2005,14 +2005,14 @@ Error Image::load(const String &p_path) {
 }
 }
 
 
 Error Image::save_png(const String &p_path) const {
 Error Image::save_png(const String &p_path) const {
-	if (save_png_func == NULL)
+	if (save_png_func == nullptr)
 		return ERR_UNAVAILABLE;
 		return ERR_UNAVAILABLE;
 
 
 	return save_png_func(p_path, Ref<Image>((Image *)this));
 	return save_png_func(p_path, Ref<Image>((Image *)this));
 }
 }
 
 
 PoolVector<uint8_t> Image::save_png_to_buffer() const {
 PoolVector<uint8_t> Image::save_png_to_buffer() const {
-	if (save_png_buffer_func == NULL) {
+	if (save_png_buffer_func == nullptr) {
 		return PoolVector<uint8_t>();
 		return PoolVector<uint8_t>();
 	}
 	}
 
 
@@ -2020,7 +2020,7 @@ PoolVector<uint8_t> Image::save_png_to_buffer() const {
 }
 }
 
 
 Error Image::save_exr(const String &p_path, bool p_grayscale) const {
 Error Image::save_exr(const String &p_path, bool p_grayscale) const {
-	if (save_exr_func == NULL)
+	if (save_exr_func == nullptr)
 		return ERR_UNAVAILABLE;
 		return ERR_UNAVAILABLE;
 
 
 	return save_exr_func(p_path, Ref<Image>((Image *)this), p_grayscale);
 	return save_exr_func(p_path, Ref<Image>((Image *)this), p_grayscale);
@@ -2402,28 +2402,28 @@ void Image::fill(const Color &c) {
 	unlock();
 	unlock();
 }
 }
 
 
-ImageMemLoadFunc Image::_png_mem_loader_func = NULL;
-ImageMemLoadFunc Image::_jpg_mem_loader_func = NULL;
-ImageMemLoadFunc Image::_webp_mem_loader_func = NULL;
-ImageMemLoadFunc Image::_tga_mem_loader_func = NULL;
-ImageMemLoadFunc Image::_bmp_mem_loader_func = NULL;
-
-void (*Image::_image_compress_bc_func)(Image *, float, Image::CompressSource) = NULL;
-void (*Image::_image_compress_bptc_func)(Image *, float, Image::CompressSource) = NULL;
-void (*Image::_image_compress_pvrtc2_func)(Image *) = NULL;
-void (*Image::_image_compress_pvrtc4_func)(Image *) = NULL;
-void (*Image::_image_compress_etc1_func)(Image *, float) = NULL;
-void (*Image::_image_compress_etc2_func)(Image *, float, Image::CompressSource) = NULL;
-void (*Image::_image_decompress_pvrtc)(Image *) = NULL;
-void (*Image::_image_decompress_bc)(Image *) = NULL;
-void (*Image::_image_decompress_bptc)(Image *) = NULL;
-void (*Image::_image_decompress_etc1)(Image *) = NULL;
-void (*Image::_image_decompress_etc2)(Image *) = NULL;
-
-PoolVector<uint8_t> (*Image::lossy_packer)(const Ref<Image> &, float) = NULL;
-Ref<Image> (*Image::lossy_unpacker)(const PoolVector<uint8_t> &) = NULL;
-PoolVector<uint8_t> (*Image::lossless_packer)(const Ref<Image> &) = NULL;
-Ref<Image> (*Image::lossless_unpacker)(const PoolVector<uint8_t> &) = NULL;
+ImageMemLoadFunc Image::_png_mem_loader_func = nullptr;
+ImageMemLoadFunc Image::_jpg_mem_loader_func = nullptr;
+ImageMemLoadFunc Image::_webp_mem_loader_func = nullptr;
+ImageMemLoadFunc Image::_tga_mem_loader_func = nullptr;
+ImageMemLoadFunc Image::_bmp_mem_loader_func = nullptr;
+
+void (*Image::_image_compress_bc_func)(Image *, float, Image::CompressSource) = nullptr;
+void (*Image::_image_compress_bptc_func)(Image *, float, Image::CompressSource) = nullptr;
+void (*Image::_image_compress_pvrtc2_func)(Image *) = nullptr;
+void (*Image::_image_compress_pvrtc4_func)(Image *) = nullptr;
+void (*Image::_image_compress_etc1_func)(Image *, float) = nullptr;
+void (*Image::_image_compress_etc2_func)(Image *, float, Image::CompressSource) = nullptr;
+void (*Image::_image_decompress_pvrtc)(Image *) = nullptr;
+void (*Image::_image_decompress_bc)(Image *) = nullptr;
+void (*Image::_image_decompress_bptc)(Image *) = nullptr;
+void (*Image::_image_decompress_etc1)(Image *) = nullptr;
+void (*Image::_image_decompress_etc2)(Image *) = nullptr;
+
+PoolVector<uint8_t> (*Image::lossy_packer)(const Ref<Image> &, float) = nullptr;
+Ref<Image> (*Image::lossy_unpacker)(const PoolVector<uint8_t> &) = nullptr;
+PoolVector<uint8_t> (*Image::lossless_packer)(const Ref<Image> &) = nullptr;
+Ref<Image> (*Image::lossless_unpacker)(const PoolVector<uint8_t> &) = nullptr;
 
 
 void Image::_set_data(const Dictionary &p_data) {
 void Image::_set_data(const Dictionary &p_data) {
 	ERR_FAIL_COND(!p_data.has("width"));
 	ERR_FAIL_COND(!p_data.has("width"));

+ 11 - 11
core/input_map.cpp

@@ -34,7 +34,7 @@
 #include "core/os/keyboard.h"
 #include "core/os/keyboard.h"
 #include "core/project_settings.h"
 #include "core/project_settings.h"
 
 
-InputMap *InputMap::singleton = NULL;
+InputMap *InputMap::singleton = nullptr;
 
 
 int InputMap::ALL_DEVICES = -1;
 int InputMap::ALL_DEVICES = -1;
 
 
@@ -124,7 +124,7 @@ List<StringName> InputMap::get_actions() const {
 }
 }
 
 
 List<Ref<InputEvent>>::Element *InputMap::_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength) const {
 List<Ref<InputEvent>>::Element *InputMap::_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength) const {
-	ERR_FAIL_COND_V(!p_event.is_valid(), NULL);
+	ERR_FAIL_COND_V(!p_event.is_valid(), nullptr);
 
 
 	for (List<Ref<InputEvent>>::Element *E = p_action.inputs.front(); E; E = E->next()) {
 	for (List<Ref<InputEvent>>::Element *E = p_action.inputs.front(); E; E = E->next()) {
 		const Ref<InputEvent> e = E->get();
 		const Ref<InputEvent> e = E->get();
@@ -140,7 +140,7 @@ List<Ref<InputEvent>>::Element *InputMap::_find_event(Action &p_action, const Re
 		}
 		}
 	}
 	}
 
 
-	return NULL;
+	return nullptr;
 }
 }
 
 
 bool InputMap::has_action(const StringName &p_action) const {
 bool InputMap::has_action(const StringName &p_action) const {
@@ -166,7 +166,7 @@ void InputMap::action_add_event(const StringName &p_action, const Ref<InputEvent
 bool InputMap::action_has_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
 bool InputMap::action_has_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
 	ERR_FAIL_COND_V_MSG(!input_map.has(p_action), false, _suggest_actions(p_action));
 	ERR_FAIL_COND_V_MSG(!input_map.has(p_action), false, _suggest_actions(p_action));
 
 
-	return (_find_event(input_map[p_action], p_event) != NULL);
+	return (_find_event(input_map[p_action], p_event) != nullptr);
 }
 }
 
 
 void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
 void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
@@ -202,7 +202,7 @@ Array InputMap::_get_action_list(const StringName &p_action) {
 const List<Ref<InputEvent>> *InputMap::get_action_list(const StringName &p_action) {
 const List<Ref<InputEvent>> *InputMap::get_action_list(const StringName &p_action) {
 	const Map<StringName, Action>::Element *E = input_map.find(p_action);
 	const Map<StringName, Action>::Element *E = input_map.find(p_action);
 	if (!E)
 	if (!E)
-		return NULL;
+		return nullptr;
 
 
 	return &E->get().inputs;
 	return &E->get().inputs;
 }
 }
@@ -217,20 +217,20 @@ bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const Str
 
 
 	Ref<InputEventAction> input_event_action = p_event;
 	Ref<InputEventAction> input_event_action = p_event;
 	if (input_event_action.is_valid()) {
 	if (input_event_action.is_valid()) {
-		if (p_pressed != NULL)
+		if (p_pressed != nullptr)
 			*p_pressed = input_event_action->is_pressed();
 			*p_pressed = input_event_action->is_pressed();
-		if (p_strength != NULL)
-			*p_strength = (p_pressed != NULL && *p_pressed) ? input_event_action->get_strength() : 0.0f;
+		if (p_strength != nullptr)
+			*p_strength = (p_pressed != nullptr && *p_pressed) ? input_event_action->get_strength() : 0.0f;
 		return input_event_action->get_action() == p_action;
 		return input_event_action->get_action() == p_action;
 	}
 	}
 
 
 	bool pressed;
 	bool pressed;
 	float strength;
 	float strength;
 	List<Ref<InputEvent>>::Element *event = _find_event(E->get(), p_event, &pressed, &strength);
 	List<Ref<InputEvent>>::Element *event = _find_event(E->get(), p_event, &pressed, &strength);
-	if (event != NULL) {
-		if (p_pressed != NULL)
+	if (event != nullptr) {
+		if (p_pressed != nullptr)
 			*p_pressed = pressed;
 			*p_pressed = pressed;
-		if (p_strength != NULL)
+		if (p_strength != nullptr)
 			*p_strength = strength;
 			*p_strength = strength;
 		return true;
 		return true;
 	} else {
 	} else {

+ 2 - 2
core/input_map.h

@@ -54,7 +54,7 @@ private:
 
 
 	mutable Map<StringName, Action> input_map;
 	mutable Map<StringName, Action> input_map;
 
 
-	List<Ref<InputEvent>>::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed = NULL, float *p_strength = NULL) const;
+	List<Ref<InputEvent>>::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed = nullptr, float *p_strength = nullptr) const;
 
 
 	Array _get_action_list(const StringName &p_action);
 	Array _get_action_list(const StringName &p_action);
 	Array _get_actions();
 	Array _get_actions();
@@ -79,7 +79,7 @@ public:
 
 
 	const List<Ref<InputEvent>> *get_action_list(const StringName &p_action);
 	const List<Ref<InputEvent>> *get_action_list(const StringName &p_action);
 	bool event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action) const;
 	bool event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action) const;
-	bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed = NULL, float *p_strength = NULL) const;
+	bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed = nullptr, float *p_strength = nullptr) const;
 
 
 	const Map<StringName, Action> &get_action_map() const;
 	const Map<StringName, Action> &get_action_map() const;
 	void load_from_globals();
 	void load_from_globals();

+ 1 - 1
core/io/config_file.cpp

@@ -264,7 +264,7 @@ Error ConfigFile::_parse(const String &p_path, VariantParser::Stream *p_stream)
 		next_tag.fields.clear();
 		next_tag.fields.clear();
 		next_tag.name = String();
 		next_tag.name = String();
 
 
-		Error err = VariantParser::parse_tag_assign_eof(p_stream, lines, error_text, next_tag, assign, value, NULL, true);
+		Error err = VariantParser::parse_tag_assign_eof(p_stream, lines, error_text, next_tag, assign, value, nullptr, true);
 		if (err == ERR_FILE_EOF) {
 		if (err == ERR_FILE_EOF) {
 			return OK;
 			return OK;
 		} else if (err != OK) {
 		} else if (err != OK) {

+ 2 - 2
core/io/dtls_server.cpp

@@ -32,14 +32,14 @@
 #include "core/os/file_access.h"
 #include "core/os/file_access.h"
 #include "core/project_settings.h"
 #include "core/project_settings.h"
 
 
-DTLSServer *(*DTLSServer::_create)() = NULL;
+DTLSServer *(*DTLSServer::_create)() = nullptr;
 bool DTLSServer::available = false;
 bool DTLSServer::available = false;
 
 
 DTLSServer *DTLSServer::create() {
 DTLSServer *DTLSServer::create() {
 	if (_create) {
 	if (_create) {
 		return _create();
 		return _create();
 	}
 	}
-	return NULL;
+	return nullptr;
 }
 }
 
 
 bool DTLSServer::is_available() {
 bool DTLSServer::is_available() {

+ 8 - 8
core/io/file_access_compressed.cpp

@@ -62,7 +62,7 @@ Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
 	cmode = (Compression::Mode)f->get_32();
 	cmode = (Compression::Mode)f->get_32();
 	block_size = f->get_32();
 	block_size = f->get_32();
 	if (block_size == 0) {
 	if (block_size == 0) {
-		f = NULL; // Let the caller to handle the FileAccess object if failed to open as compressed file.
+		f = nullptr; // Let the caller to handle the FileAccess object if failed to open as compressed file.
 		ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Can't open compressed file '" + p_base->get_path() + "' with block size 0, it is corrupted.");
 		ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Can't open compressed file '" + p_base->get_path() + "' with block size 0, it is corrupted.");
 	}
 	}
 	read_total = f->get_32();
 	read_total = f->get_32();
@@ -105,7 +105,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
 	if (err != OK) {
 	if (err != OK) {
 		//not openable
 		//not openable
 
 
-		f = NULL;
+		f = nullptr;
 		return err;
 		return err;
 	}
 	}
 
 
@@ -125,7 +125,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
 		rmagic[4] = 0;
 		rmagic[4] = 0;
 		if (magic != rmagic || open_after_magic(f) != OK) {
 		if (magic != rmagic || open_after_magic(f) != OK) {
 			memdelete(f);
 			memdelete(f);
-			f = NULL;
+			f = nullptr;
 			return ERR_FILE_UNRECOGNIZED;
 			return ERR_FILE_UNRECOGNIZED;
 		}
 		}
 	}
 	}
@@ -178,11 +178,11 @@ void FileAccessCompressed::close() {
 	}
 	}
 
 
 	memdelete(f);
 	memdelete(f);
-	f = NULL;
+	f = nullptr;
 }
 }
 
 
 bool FileAccessCompressed::is_open() const {
 bool FileAccessCompressed::is_open() const {
-	return f != NULL;
+	return f != nullptr;
 }
 }
 
 
 void FileAccessCompressed::seek(size_t p_position) {
 void FileAccessCompressed::seek(size_t p_position) {
@@ -364,20 +364,20 @@ Error FileAccessCompressed::_set_unix_permissions(const String &p_file, uint32_t
 FileAccessCompressed::FileAccessCompressed() :
 FileAccessCompressed::FileAccessCompressed() :
 		cmode(Compression::MODE_ZSTD),
 		cmode(Compression::MODE_ZSTD),
 		writing(false),
 		writing(false),
-		write_ptr(0),
+		write_ptr(nullptr),
 		write_buffer_size(0),
 		write_buffer_size(0),
 		write_max(0),
 		write_max(0),
 		block_size(0),
 		block_size(0),
 		read_eof(false),
 		read_eof(false),
 		at_end(false),
 		at_end(false),
-		read_ptr(NULL),
+		read_ptr(nullptr),
 		read_block(0),
 		read_block(0),
 		read_block_count(0),
 		read_block_count(0),
 		read_block_size(0),
 		read_block_size(0),
 		read_pos(0),
 		read_pos(0),
 		read_total(0),
 		read_total(0),
 		magic("GCMP"),
 		magic("GCMP"),
-		f(NULL) {
+		f(nullptr) {
 }
 }
 
 
 FileAccessCompressed::~FileAccessCompressed() {
 FileAccessCompressed::~FileAccessCompressed() {

+ 5 - 5
core/io/file_access_encrypted.cpp

@@ -39,7 +39,7 @@
 #define COMP_MAGIC 0x43454447
 #define COMP_MAGIC 0x43454447
 
 
 Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode) {
 Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode) {
-	ERR_FAIL_COND_V_MSG(file != NULL, ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open.");
+	ERR_FAIL_COND_V_MSG(file != nullptr, ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open.");
 	ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER);
 	ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER);
 
 
 	pos = 0;
 	pos = 0;
@@ -148,19 +148,19 @@ void FileAccessEncrypted::close() {
 		file->store_buffer(compressed.ptr(), compressed.size());
 		file->store_buffer(compressed.ptr(), compressed.size());
 		file->close();
 		file->close();
 		memdelete(file);
 		memdelete(file);
-		file = NULL;
+		file = nullptr;
 		data.clear();
 		data.clear();
 
 
 	} else {
 	} else {
 		file->close();
 		file->close();
 		memdelete(file);
 		memdelete(file);
 		data.clear();
 		data.clear();
-		file = NULL;
+		file = nullptr;
 	}
 	}
 }
 }
 
 
 bool FileAccessEncrypted::is_open() const {
 bool FileAccessEncrypted::is_open() const {
-	return file != NULL;
+	return file != nullptr;
 }
 }
 
 
 String FileAccessEncrypted::get_path() const {
 String FileAccessEncrypted::get_path() const {
@@ -288,7 +288,7 @@ Error FileAccessEncrypted::_set_unix_permissions(const String &p_file, uint32_t
 }
 }
 
 
 FileAccessEncrypted::FileAccessEncrypted() {
 FileAccessEncrypted::FileAccessEncrypted() {
-	file = NULL;
+	file = nullptr;
 	pos = 0;
 	pos = 0;
 	eofed = false;
 	eofed = false;
 	mode = MODE_MAX;
 	mode = MODE_MAX;

+ 5 - 5
core/io/file_access_memory.cpp

@@ -34,7 +34,7 @@
 #include "core/os/dir_access.h"
 #include "core/os/dir_access.h"
 #include "core/project_settings.h"
 #include "core/project_settings.h"
 
 
-static Map<String, Vector<uint8_t>> *files = NULL;
+static Map<String, Vector<uint8_t>> *files = nullptr;
 
 
 void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
 void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
 	if (!files) {
 	if (!files) {
@@ -66,7 +66,7 @@ bool FileAccessMemory::file_exists(const String &p_name) {
 	String name = fix_path(p_name);
 	String name = fix_path(p_name);
 	//name = DirAccess::normalize_path(name);
 	//name = DirAccess::normalize_path(name);
 
 
-	return files && (files->find(name) != NULL);
+	return files && (files->find(name) != nullptr);
 }
 }
 
 
 Error FileAccessMemory::open_custom(const uint8_t *p_data, int p_len) {
 Error FileAccessMemory::open_custom(const uint8_t *p_data, int p_len) {
@@ -93,11 +93,11 @@ Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
 }
 }
 
 
 void FileAccessMemory::close() {
 void FileAccessMemory::close() {
-	data = NULL;
+	data = nullptr;
 }
 }
 
 
 bool FileAccessMemory::is_open() const {
 bool FileAccessMemory::is_open() const {
-	return data != NULL;
+	return data != nullptr;
 }
 }
 
 
 void FileAccessMemory::seek(size_t p_position) {
 void FileAccessMemory::seek(size_t p_position) {
@@ -178,5 +178,5 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src, int p_length) {
 }
 }
 
 
 FileAccessMemory::FileAccessMemory() {
 FileAccessMemory::FileAccessMemory() {
-	data = NULL;
+	data = nullptr;
 }
 }

+ 3 - 3
core/io/file_access_network.cpp

@@ -105,7 +105,7 @@ void FileAccessNetworkClient::_thread_func() {
 		int response = get_32();
 		int response = get_32();
 		DEBUG_PRINT("GET RESPONSE: " + itos(response));
 		DEBUG_PRINT("GET RESPONSE: " + itos(response));
 
 
-		FileAccessNetwork *fa = NULL;
+		FileAccessNetwork *fa = nullptr;
 
 
 		if (response != FileAccessNetwork::RESPONSE_DATA) {
 		if (response != FileAccessNetwork::RESPONSE_DATA) {
 			if (!accesses.has(id)) {
 			if (!accesses.has(id)) {
@@ -203,7 +203,7 @@ Error FileAccessNetworkClient::connect(const String &p_host, int p_port, const S
 	return OK;
 	return OK;
 }
 }
 
 
-FileAccessNetworkClient *FileAccessNetworkClient::singleton = NULL;
+FileAccessNetworkClient *FileAccessNetworkClient::singleton = nullptr;
 
 
 FileAccessNetworkClient::FileAccessNetworkClient() {
 FileAccessNetworkClient::FileAccessNetworkClient() {
 	quit = false;
 	quit = false;
@@ -271,7 +271,7 @@ Error FileAccessNetwork::_open(const String &p_path, int p_mode_flags) {
 	pos = 0;
 	pos = 0;
 	eof_flag = false;
 	eof_flag = false;
 	last_page = -1;
 	last_page = -1;
-	last_page_buff = NULL;
+	last_page_buff = nullptr;
 
 
 	//buffers.clear();
 	//buffers.clear();
 	nc->unlock_mutex();
 	nc->unlock_mutex();

+ 5 - 5
core/io/file_access_pack.cpp

@@ -91,17 +91,17 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o
 }
 }
 
 
 void PackedData::add_pack_source(PackSource *p_source) {
 void PackedData::add_pack_source(PackSource *p_source) {
-	if (p_source != NULL) {
+	if (p_source != nullptr) {
 		sources.push_back(p_source);
 		sources.push_back(p_source);
 	}
 	}
 };
 };
 
 
-PackedData *PackedData::singleton = NULL;
+PackedData *PackedData::singleton = nullptr;
 
 
 PackedData::PackedData() {
 PackedData::PackedData() {
 	singleton = this;
 	singleton = this;
 	root = memnew(PackedDir);
 	root = memnew(PackedDir);
-	root->parent = NULL;
+	root->parent = nullptr;
 	disabled = false;
 	disabled = false;
 
 
 	add_pack_source(memnew(PackedSourcePCK));
 	add_pack_source(memnew(PackedSourcePCK));
@@ -420,7 +420,7 @@ PackedData::PackedDir *DirAccessPack::_find_dir(String p_dir) {
 			pd = pd->subdirs[p];
 			pd = pd->subdirs[p];
 
 
 		} else {
 		} else {
-			return NULL;
+			return nullptr;
 		}
 		}
 	}
 	}
 
 
@@ -462,7 +462,7 @@ bool DirAccessPack::file_exists(String p_file) {
 bool DirAccessPack::dir_exists(String p_dir) {
 bool DirAccessPack::dir_exists(String p_dir) {
 	p_dir = fix_path(p_dir);
 	p_dir = fix_path(p_dir);
 
 
-	return _find_dir(p_dir) != NULL;
+	return _find_dir(p_dir) != nullptr;
 }
 }
 
 
 Error DirAccessPack::make_dir(String p_dir) {
 Error DirAccessPack::make_dir(String p_dir) {

+ 3 - 3
core/io/file_access_pack.h

@@ -183,9 +183,9 @@ FileAccess *PackedData::try_open_path(const String &p_path) {
 	PathMD5 pmd5(p_path.md5_buffer());
 	PathMD5 pmd5(p_path.md5_buffer());
 	Map<PathMD5, PackedFile>::Element *E = files.find(pmd5);
 	Map<PathMD5, PackedFile>::Element *E = files.find(pmd5);
 	if (!E)
 	if (!E)
-		return NULL; //not found
+		return nullptr; //not found
 	if (E->get().offset == 0)
 	if (E->get().offset == 0)
-		return NULL; //was erased
+		return nullptr; //was erased
 
 
 	return E->get().src->get_file(p_path, &E->get());
 	return E->get().src->get_file(p_path, &E->get());
 }
 }
@@ -246,7 +246,7 @@ DirAccess *PackedData::try_open_directory(const String &p_path) {
 	DirAccess *da = memnew(DirAccessPack());
 	DirAccess *da = memnew(DirAccessPack());
 	if (da->change_dir(p_path) != OK) {
 	if (da->change_dir(p_path) != OK) {
 		memdelete(da);
 		memdelete(da);
-		da = NULL;
+		da = nullptr;
 	}
 	}
 	return da;
 	return da;
 }
 }

+ 13 - 13
core/io/file_access_zip.cpp

@@ -34,19 +34,19 @@
 
 
 #include "core/os/file_access.h"
 #include "core/os/file_access.h"
 
 
-ZipArchive *ZipArchive::instance = NULL;
+ZipArchive *ZipArchive::instance = nullptr;
 
 
 extern "C" {
 extern "C" {
 
 
 static void *godot_open(void *data, const char *p_fname, int mode) {
 static void *godot_open(void *data, const char *p_fname, int mode) {
 	if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
 	if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	FileAccess *f = (FileAccess *)data;
 	FileAccess *f = (FileAccess *)data;
 	f->open(p_fname, FileAccess::READ);
 	f->open(p_fname, FileAccess::READ);
 
 
-	return f->is_open() ? data : NULL;
+	return f->is_open() ? data : nullptr;
 }
 }
 
 
 static uLong godot_read(void *data, void *fdata, void *buf, uLong size) {
 static uLong godot_read(void *data, void *fdata, void *buf, uLong size) {
@@ -113,11 +113,11 @@ void ZipArchive::close_handle(unzFile p_file) const {
 }
 }
 
 
 unzFile ZipArchive::get_file_handle(String p_file) const {
 unzFile ZipArchive::get_file_handle(String p_file) const {
-	ERR_FAIL_COND_V_MSG(!file_exists(p_file), NULL, "File '" + p_file + " doesn't exist.");
+	ERR_FAIL_COND_V_MSG(!file_exists(p_file), nullptr, "File '" + p_file + " doesn't exist.");
 	File file = files[p_file];
 	File file = files[p_file];
 
 
 	FileAccess *f = FileAccess::open(packages[file.package].filename, FileAccess::READ);
 	FileAccess *f = FileAccess::open(packages[file.package].filename, FileAccess::READ);
-	ERR_FAIL_COND_V_MSG(!f, NULL, "Cannot open file '" + packages[file.package].filename + "'.");
+	ERR_FAIL_COND_V_MSG(!f, nullptr, "Cannot open file '" + packages[file.package].filename + "'.");
 
 
 	zlib_filefunc_def io;
 	zlib_filefunc_def io;
 	memset(&io, 0, sizeof(io));
 	memset(&io, 0, sizeof(io));
@@ -136,11 +136,11 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
 	io.free_mem = godot_free;
 	io.free_mem = godot_free;
 
 
 	unzFile pkg = unzOpen2(packages[file.package].filename.utf8().get_data(), &io);
 	unzFile pkg = unzOpen2(packages[file.package].filename.utf8().get_data(), &io);
-	ERR_FAIL_COND_V(!pkg, NULL);
+	ERR_FAIL_COND_V(!pkg, nullptr);
 	int unz_err = unzGoToFilePos(pkg, &file.file_pos);
 	int unz_err = unzGoToFilePos(pkg, &file.file_pos);
 	if (unz_err != UNZ_OK || unzOpenCurrentFile(pkg) != UNZ_OK) {
 	if (unz_err != UNZ_OK || unzOpenCurrentFile(pkg) != UNZ_OK) {
 		unzClose(pkg);
 		unzClose(pkg);
-		ERR_FAIL_V(NULL);
+		ERR_FAIL_V(nullptr);
 	}
 	}
 
 
 	return pkg;
 	return pkg;
@@ -186,7 +186,7 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, size_
 		char filename_inzip[256];
 		char filename_inzip[256];
 
 
 		unz_file_info64 file_info;
 		unz_file_info64 file_info;
-		err = unzGetCurrentFileInfo64(zfile, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
+		err = unzGetCurrentFileInfo64(zfile, &file_info, filename_inzip, sizeof(filename_inzip), nullptr, 0, nullptr, 0);
 		ERR_CONTINUE(err != UNZ_OK);
 		ERR_CONTINUE(err != UNZ_OK);
 
 
 		File f;
 		File f;
@@ -217,7 +217,7 @@ FileAccess *ZipArchive::get_file(const String &p_path, PackedData::PackedFile *p
 }
 }
 
 
 ZipArchive *ZipArchive::get_singleton() {
 ZipArchive *ZipArchive::get_singleton() {
-	if (instance == NULL) {
+	if (instance == nullptr) {
 		instance = memnew(ZipArchive);
 		instance = memnew(ZipArchive);
 	}
 	}
 
 
@@ -248,7 +248,7 @@ Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
 	zfile = arch->get_file_handle(p_path);
 	zfile = arch->get_file_handle(p_path);
 	ERR_FAIL_COND_V(!zfile, FAILED);
 	ERR_FAIL_COND_V(!zfile, FAILED);
 
 
-	int err = unzGetCurrentFileInfo64(zfile, &file_info, NULL, 0, NULL, 0, NULL, 0);
+	int err = unzGetCurrentFileInfo64(zfile, &file_info, nullptr, 0, nullptr, 0, nullptr, 0);
 	ERR_FAIL_COND_V(err != UNZ_OK, FAILED);
 	ERR_FAIL_COND_V(err != UNZ_OK, FAILED);
 
 
 	return OK;
 	return OK;
@@ -261,11 +261,11 @@ void FileAccessZip::close() {
 	ZipArchive *arch = ZipArchive::get_singleton();
 	ZipArchive *arch = ZipArchive::get_singleton();
 	ERR_FAIL_COND(!arch);
 	ERR_FAIL_COND(!arch);
 	arch->close_handle(zfile);
 	arch->close_handle(zfile);
-	zfile = NULL;
+	zfile = nullptr;
 }
 }
 
 
 bool FileAccessZip::is_open() const {
 bool FileAccessZip::is_open() const {
-	return zfile != NULL;
+	return zfile != nullptr;
 }
 }
 
 
 void FileAccessZip::seek(size_t p_position) {
 void FileAccessZip::seek(size_t p_position) {
@@ -338,7 +338,7 @@ bool FileAccessZip::file_exists(const String &p_name) {
 }
 }
 
 
 FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) :
 FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) :
-		zfile(NULL) {
+		zfile(nullptr) {
 	_open(p_path, FileAccess::READ);
 	_open(p_path, FileAccess::READ);
 }
 }
 
 

+ 1 - 1
core/io/image_loader.cpp

@@ -92,7 +92,7 @@ ImageFormatLoader *ImageLoader::recognize(const String &p_extension) {
 			return loader[i];
 			return loader[i];
 	}
 	}
 
 
-	return NULL;
+	return nullptr;
 }
 }
 
 
 Vector<ImageFormatLoader *> ImageLoader::loader;
 Vector<ImageFormatLoader *> ImageLoader::loader;

+ 2 - 2
core/io/image_loader.h

@@ -58,7 +58,7 @@ class ImageLoader {
 
 
 protected:
 protected:
 public:
 public:
-	static Error load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom = NULL, bool p_force_linear = false, float p_scale = 1.0);
+	static Error load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom = nullptr, bool p_force_linear = false, float p_scale = 1.0);
 	static void get_recognized_extensions(List<String> *p_extensions);
 	static void get_recognized_extensions(List<String> *p_extensions);
 	static ImageFormatLoader *recognize(const String &p_extension);
 	static ImageFormatLoader *recognize(const String &p_extension);
 
 
@@ -72,7 +72,7 @@ public:
 
 
 class ResourceFormatLoaderImage : public ResourceFormatLoader {
 class ResourceFormatLoaderImage : public ResourceFormatLoader {
 public:
 public:
-	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual bool handles_type(const String &p_type) const;
 	virtual bool handles_type(const String &p_type) const;
 	virtual String get_resource_type(const String &p_path) const;
 	virtual String get_resource_type(const String &p_path) const;

+ 4 - 4
core/io/ip.cpp

@@ -277,17 +277,17 @@ void IP::_bind_methods() {
 	BIND_ENUM_CONSTANT(TYPE_ANY);
 	BIND_ENUM_CONSTANT(TYPE_ANY);
 }
 }
 
 
-IP *IP::singleton = NULL;
+IP *IP::singleton = nullptr;
 
 
 IP *IP::get_singleton() {
 IP *IP::get_singleton() {
 	return singleton;
 	return singleton;
 }
 }
 
 
-IP *(*IP::_create)() = NULL;
+IP *(*IP::_create)() = nullptr;
 
 
 IP *IP::create() {
 IP *IP::create() {
-	ERR_FAIL_COND_V_MSG(singleton, NULL, "IP singleton already exist.");
-	ERR_FAIL_COND_V(!_create, NULL);
+	ERR_FAIL_COND_V_MSG(singleton, nullptr, "IP singleton already exist.");
+	ERR_FAIL_COND_V(!_create, nullptr);
 	return _create();
 	return _create();
 }
 }
 
 

+ 2 - 2
core/io/logger.cpp

@@ -125,7 +125,7 @@ Logger::~Logger() {}
 void RotatedFileLogger::close_file() {
 void RotatedFileLogger::close_file() {
 	if (file) {
 	if (file) {
 		memdelete(file);
 		memdelete(file);
-		file = NULL;
+		file = nullptr;
 	}
 	}
 }
 }
 
 
@@ -199,7 +199,7 @@ void RotatedFileLogger::rotate_file() {
 RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) :
 RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) :
 		base_path(p_base_path.simplify_path()),
 		base_path(p_base_path.simplify_path()),
 		max_files(p_max_files > 0 ? p_max_files : 1),
 		max_files(p_max_files > 0 ? p_max_files : 1),
-		file(NULL) {
+		file(nullptr) {
 	rotate_file();
 	rotate_file();
 }
 }
 
 

+ 2 - 2
core/io/marshalls.cpp

@@ -366,7 +366,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
 					(*r_len) += 8;
 					(*r_len) += 8;
 
 
 				if (val == 0) {
 				if (val == 0) {
-					r_variant = (Object *)NULL;
+					r_variant = (Object *)nullptr;
 				} else {
 				} else {
 					Ref<EncodedObjectAsID> obj_as_id;
 					Ref<EncodedObjectAsID> obj_as_id;
 					obj_as_id.instance();
 					obj_as_id.instance();
@@ -384,7 +384,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
 					return err;
 					return err;
 
 
 				if (str == String()) {
 				if (str == String()) {
-					r_variant = (Object *)NULL;
+					r_variant = (Object *)nullptr;
 				} else {
 				} else {
 					Object *obj = ClassDB::instance(str);
 					Object *obj = ClassDB::instance(str);
 
 

+ 1 - 1
core/io/marshalls.h

@@ -179,7 +179,7 @@ public:
 	EncodedObjectAsID();
 	EncodedObjectAsID();
 };
 };
 
 
-Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = NULL, bool p_allow_objects = false);
+Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false);
 Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects = false);
 Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects = false);
 
 
 #endif
 #endif

+ 14 - 14
core/io/multiplayer_api.cpp

@@ -167,7 +167,7 @@ Ref<NetworkedMultiplayerPeer> MultiplayerAPI::get_network_peer() const {
 }
 }
 
 
 void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_packet_len) {
 void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_packet_len) {
-	ERR_FAIL_COND_MSG(root_node == NULL, "Multiplayer root node was not initialized. If you are using custom multiplayer, remember to set the root node via MultiplayerAPI.set_root_node before using it.");
+	ERR_FAIL_COND_MSG(root_node == nullptr, "Multiplayer root node was not initialized. If you are using custom multiplayer, remember to set the root node via MultiplayerAPI.set_root_node before using it.");
 	ERR_FAIL_COND_MSG(p_packet_len < 1, "Invalid packet received. Size too small.");
 	ERR_FAIL_COND_MSG(p_packet_len < 1, "Invalid packet received. Size too small.");
 
 
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
@@ -195,7 +195,7 @@ void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_
 
 
 			Node *node = _process_get_node(p_from, p_packet, p_packet_len);
 			Node *node = _process_get_node(p_from, p_packet, p_packet_len);
 
 
-			ERR_FAIL_COND_MSG(node == NULL, "Invalid packet received. Requested node was not found.");
+			ERR_FAIL_COND_MSG(node == nullptr, "Invalid packet received. Requested node was not found.");
 
 
 			// Detect cstring end.
 			// Detect cstring end.
 			int len_end = 5;
 			int len_end = 5;
@@ -226,14 +226,14 @@ void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_
 
 
 Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int p_packet_len) {
 Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int p_packet_len) {
 	uint32_t target = decode_uint32(&p_packet[1]);
 	uint32_t target = decode_uint32(&p_packet[1]);
-	Node *node = NULL;
+	Node *node = nullptr;
 
 
 	if (target & 0x80000000) {
 	if (target & 0x80000000) {
 		// Use full path (not cached yet).
 		// Use full path (not cached yet).
 
 
 		int ofs = target & 0x7FFFFFFF;
 		int ofs = target & 0x7FFFFFFF;
 
 
-		ERR_FAIL_COND_V_MSG(ofs >= p_packet_len, NULL, "Invalid packet received. Size smaller than declared.");
+		ERR_FAIL_COND_V_MSG(ofs >= p_packet_len, nullptr, "Invalid packet received. Size smaller than declared.");
 
 
 		String paths;
 		String paths;
 		paths.parse_utf8((const char *)&p_packet[ofs], p_packet_len - ofs);
 		paths.parse_utf8((const char *)&p_packet[ofs], p_packet_len - ofs);
@@ -249,10 +249,10 @@ Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int
 		int id = target;
 		int id = target;
 
 
 		Map<int, PathGetCache>::Element *E = path_get_cache.find(p_from);
 		Map<int, PathGetCache>::Element *E = path_get_cache.find(p_from);
-		ERR_FAIL_COND_V_MSG(!E, NULL, "Invalid packet received. Requests invalid peer cache.");
+		ERR_FAIL_COND_V_MSG(!E, nullptr, "Invalid packet received. Requests invalid peer cache.");
 
 
 		Map<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id);
 		Map<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id);
-		ERR_FAIL_COND_V_MSG(!F, NULL, "Invalid packet received. Unabled to find requested cached node.");
+		ERR_FAIL_COND_V_MSG(!F, nullptr, "Invalid packet received. Unabled to find requested cached node.");
 
 
 		PathGetCache::NodeInfo *ni = &F->get();
 		PathGetCache::NodeInfo *ni = &F->get();
 		// Do proper caching later.
 		// Do proper caching later.
@@ -340,7 +340,7 @@ void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p
 #endif
 #endif
 
 
 	Variant value;
 	Variant value;
-	Error err = decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset, NULL, allow_object_decoding || network_peer->is_object_decoding_allowed());
+	Error err = decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset, nullptr, allow_object_decoding || network_peer->is_object_decoding_allowed());
 
 
 	ERR_FAIL_COND_MSG(err != OK, "Invalid packet received. Unable to decode RSET value.");
 	ERR_FAIL_COND_MSG(err != OK, "Invalid packet received. Unable to decode RSET value.");
 
 
@@ -374,7 +374,7 @@ void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet,
 
 
 	// Encode path to send ack.
 	// Encode path to send ack.
 	CharString pname = String(path).utf8();
 	CharString pname = String(path).utf8();
-	int len = encode_cstring(pname.get_data(), NULL);
+	int len = encode_cstring(pname.get_data(), nullptr);
 
 
 	Vector<uint8_t> packet;
 	Vector<uint8_t> packet;
 
 
@@ -432,7 +432,7 @@ bool MultiplayerAPI::_send_confirm_path(NodePath p_path, PathSentCache *psc, int
 	for (List<int>::Element *E = peers_to_add.front(); E; E = E->next()) {
 	for (List<int>::Element *E = peers_to_add.front(); E; E = E->next()) {
 		// Encode function name.
 		// Encode function name.
 		CharString pname = String(p_path).utf8();
 		CharString pname = String(p_path).utf8();
-		int len = encode_cstring(pname.get_data(), NULL);
+		int len = encode_cstring(pname.get_data(), nullptr);
 
 
 		Vector<uint8_t> packet;
 		Vector<uint8_t> packet;
 
 
@@ -498,14 +498,14 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
 
 
 	// Encode function name.
 	// Encode function name.
 	CharString name = String(p_name).utf8();
 	CharString name = String(p_name).utf8();
-	int len = encode_cstring(name.get_data(), NULL);
+	int len = encode_cstring(name.get_data(), nullptr);
 	MAKE_ROOM(ofs + len);
 	MAKE_ROOM(ofs + len);
 	encode_cstring(name.get_data(), &(packet_cache.write[ofs]));
 	encode_cstring(name.get_data(), &(packet_cache.write[ofs]));
 	ofs += len;
 	ofs += len;
 
 
 	if (p_set) {
 	if (p_set) {
 		// Set argument.
 		// Set argument.
-		Error err = encode_variant(*p_arg[0], NULL, len, allow_object_decoding || network_peer->is_object_decoding_allowed());
+		Error err = encode_variant(*p_arg[0], nullptr, len, allow_object_decoding || network_peer->is_object_decoding_allowed());
 		ERR_FAIL_COND_MSG(err != OK, "Unable to encode RSET value. THIS IS LIKELY A BUG IN THE ENGINE!");
 		ERR_FAIL_COND_MSG(err != OK, "Unable to encode RSET value. THIS IS LIKELY A BUG IN THE ENGINE!");
 		MAKE_ROOM(ofs + len);
 		MAKE_ROOM(ofs + len);
 		encode_variant(*p_arg[0], &(packet_cache.write[ofs]), len, allow_object_decoding || network_peer->is_object_decoding_allowed());
 		encode_variant(*p_arg[0], &(packet_cache.write[ofs]), len, allow_object_decoding || network_peer->is_object_decoding_allowed());
@@ -517,7 +517,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
 		packet_cache.write[ofs] = p_argcount;
 		packet_cache.write[ofs] = p_argcount;
 		ofs += 1;
 		ofs += 1;
 		for (int i = 0; i < p_argcount; i++) {
 		for (int i = 0; i < p_argcount; i++) {
-			Error err = encode_variant(*p_arg[i], NULL, len, allow_object_decoding || network_peer->is_object_decoding_allowed());
+			Error err = encode_variant(*p_arg[i], nullptr, len, allow_object_decoding || network_peer->is_object_decoding_allowed());
 			ERR_FAIL_COND_MSG(err != OK, "Unable to encode RPC argument. THIS IS LIKELY A BUG IN THE ENGINE!");
 			ERR_FAIL_COND_MSG(err != OK, "Unable to encode RPC argument. THIS IS LIKELY A BUG IN THE ENGINE!");
 			MAKE_ROOM(ofs + len);
 			MAKE_ROOM(ofs + len);
 			encode_variant(*p_arg[i], &(packet_cache.write[ofs]), len, allow_object_decoding || network_peer->is_object_decoding_allowed());
 			encode_variant(*p_arg[i], &(packet_cache.write[ofs]), len, allow_object_decoding || network_peer->is_object_decoding_allowed());
@@ -548,7 +548,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
 
 
 		// Append path at the end, since we will need it for some packets.
 		// Append path at the end, since we will need it for some packets.
 		CharString pname = String(from_path).utf8();
 		CharString pname = String(from_path).utf8();
-		int path_len = encode_cstring(pname.get_data(), NULL);
+		int path_len = encode_cstring(pname.get_data(), nullptr);
 		MAKE_ROOM(ofs + path_len);
 		MAKE_ROOM(ofs + path_len);
 		encode_cstring(pname.get_data(), &(packet_cache.write[ofs]));
 		encode_cstring(pname.get_data(), &(packet_cache.write[ofs]));
 
 
@@ -961,7 +961,7 @@ void MultiplayerAPI::_bind_methods() {
 MultiplayerAPI::MultiplayerAPI() :
 MultiplayerAPI::MultiplayerAPI() :
 		allow_object_decoding(false) {
 		allow_object_decoding(false) {
 	rpc_sender_id = 0;
 	rpc_sender_id = 0;
-	root_node = NULL;
+	root_node = nullptr;
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
 	profiling = false;
 	profiling = false;
 #endif
 #endif

+ 2 - 2
core/io/net_socket.cpp

@@ -30,12 +30,12 @@
 
 
 #include "net_socket.h"
 #include "net_socket.h"
 
 
-NetSocket *(*NetSocket::_create)() = NULL;
+NetSocket *(*NetSocket::_create)() = nullptr;
 
 
 NetSocket *NetSocket::create() {
 NetSocket *NetSocket::create() {
 	if (_create)
 	if (_create)
 		return _create();
 		return _create();
 
 
 	ERR_PRINT("Unable to create network socket, platform not supported");
 	ERR_PRINT("Unable to create network socket, platform not supported");
-	return NULL;
+	return nullptr;
 }
 }

+ 2 - 2
core/io/packet_peer.cpp

@@ -94,12 +94,12 @@ Error PacketPeer::get_var(Variant &r_variant, bool p_allow_objects) {
 	if (err)
 	if (err)
 		return err;
 		return err;
 
 
-	return decode_variant(r_variant, buffer, buffer_size, NULL, p_allow_objects || allow_object_decoding);
+	return decode_variant(r_variant, buffer, buffer_size, nullptr, p_allow_objects || allow_object_decoding);
 }
 }
 
 
 Error PacketPeer::put_var(const Variant &p_packet, bool p_full_objects) {
 Error PacketPeer::put_var(const Variant &p_packet, bool p_full_objects) {
 	int len;
 	int len;
-	Error err = encode_variant(p_packet, NULL, len, p_full_objects || allow_object_decoding); // compute len first
+	Error err = encode_variant(p_packet, nullptr, len, p_full_objects || allow_object_decoding); // compute len first
 	if (err)
 	if (err)
 		return err;
 		return err;
 
 

+ 2 - 2
core/io/packet_peer_dtls.cpp

@@ -32,14 +32,14 @@
 #include "core/os/file_access.h"
 #include "core/os/file_access.h"
 #include "core/project_settings.h"
 #include "core/project_settings.h"
 
 
-PacketPeerDTLS *(*PacketPeerDTLS::_create)() = NULL;
+PacketPeerDTLS *(*PacketPeerDTLS::_create)() = nullptr;
 bool PacketPeerDTLS::available = false;
 bool PacketPeerDTLS::available = false;
 
 
 PacketPeerDTLS *PacketPeerDTLS::create() {
 PacketPeerDTLS *PacketPeerDTLS::create() {
 	if (_create) {
 	if (_create) {
 		return _create();
 		return _create();
 	}
 	}
-	return NULL;
+	return nullptr;
 }
 }
 
 
 bool PacketPeerDTLS::is_available() {
 bool PacketPeerDTLS::is_available() {

+ 4 - 4
core/io/pck_packer.cpp

@@ -58,7 +58,7 @@ void PCKPacker::_bind_methods() {
 };
 };
 
 
 Error PCKPacker::pck_start(const String &p_file, int p_alignment) {
 Error PCKPacker::pck_start(const String &p_file, int p_alignment) {
-	if (file != NULL) {
+	if (file != nullptr) {
 		memdelete(file);
 		memdelete(file);
 	}
 	}
 
 
@@ -170,12 +170,12 @@ Error PCKPacker::flush(bool p_verbose) {
 };
 };
 
 
 PCKPacker::PCKPacker() {
 PCKPacker::PCKPacker() {
-	file = NULL;
+	file = nullptr;
 };
 };
 
 
 PCKPacker::~PCKPacker() {
 PCKPacker::~PCKPacker() {
-	if (file != NULL) {
+	if (file != nullptr) {
 		memdelete(file);
 		memdelete(file);
 	};
 	};
-	file = NULL;
+	file = nullptr;
 };
 };

+ 3 - 3
core/io/resource_format_binary.cpp

@@ -906,7 +906,7 @@ String ResourceInteractiveLoaderBinary::recognize(FileAccess *p_f) {
 
 
 ResourceInteractiveLoaderBinary::ResourceInteractiveLoaderBinary() :
 ResourceInteractiveLoaderBinary::ResourceInteractiveLoaderBinary() :
 		translation_remapped(false),
 		translation_remapped(false),
-		f(NULL),
+		f(nullptr),
 		error(OK),
 		error(OK),
 		stage(0) {
 		stage(0) {
 }
 }
@@ -983,7 +983,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
 	FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
 	FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
 	ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot open file '" + p_path + "'.");
 	ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot open file '" + p_path + "'.");
 
 
-	FileAccess *fw = NULL; //=FileAccess::open(p_path+".depren");
+	FileAccess *fw = nullptr; //=FileAccess::open(p_path+".depren");
 
 
 	String local_path = p_path.get_base_dir();
 	String local_path = p_path.get_base_dir();
 
 
@@ -1845,7 +1845,7 @@ void ResourceFormatSaverBinary::get_recognized_extensions(const RES &p_resource,
 		p_extensions->push_back("res");
 		p_extensions->push_back("res");
 }
 }
 
 
-ResourceFormatSaverBinary *ResourceFormatSaverBinary::singleton = NULL;
+ResourceFormatSaverBinary *ResourceFormatSaverBinary::singleton = nullptr;
 
 
 ResourceFormatSaverBinary::ResourceFormatSaverBinary() {
 ResourceFormatSaverBinary::ResourceFormatSaverBinary() {
 	singleton = this;
 	singleton = this;

+ 1 - 1
core/io/resource_format_binary.h

@@ -100,7 +100,7 @@ public:
 
 
 class ResourceFormatLoaderBinary : public ResourceFormatLoader {
 class ResourceFormatLoaderBinary : public ResourceFormatLoader {
 public:
 public:
-	virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+	virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
 	virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
 	virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual bool handles_type(const String &p_type) const;
 	virtual bool handles_type(const String &p_type) const;

+ 3 - 3
core/io/resource_importer.cpp

@@ -67,7 +67,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
 		next_tag.fields.clear();
 		next_tag.fields.clear();
 		next_tag.name = String();
 		next_tag.name = String();
 
 
-		err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+		err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
 		if (err == ERR_FILE_EOF) {
 		if (err == ERR_FILE_EOF) {
 			memdelete(f);
 			memdelete(f);
 			return OK;
 			return OK;
@@ -256,7 +256,7 @@ void ResourceFormatImporter::get_internal_resource_path_list(const String &p_pat
 		next_tag.fields.clear();
 		next_tag.fields.clear();
 		next_tag.name = String();
 		next_tag.name = String();
 
 
-		err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+		err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
 		if (err == ERR_FILE_EOF) {
 		if (err == ERR_FILE_EOF) {
 			memdelete(f);
 			memdelete(f);
 			return;
 			return;
@@ -408,7 +408,7 @@ String ResourceFormatImporter::get_import_settings_hash() const {
 	return hash.md5_text();
 	return hash.md5_text();
 }
 }
 
 
-ResourceFormatImporter *ResourceFormatImporter::singleton = NULL;
+ResourceFormatImporter *ResourceFormatImporter::singleton = nullptr;
 
 
 ResourceFormatImporter::ResourceFormatImporter() {
 ResourceFormatImporter::ResourceFormatImporter() {
 	singleton = this;
 	singleton = this;

+ 3 - 3
core/io/resource_importer.h

@@ -44,7 +44,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
 		Variant metadata;
 		Variant metadata;
 	};
 	};
 
 
-	Error _get_path_and_type(const String &p_path, PathAndType &r_path_and_type, bool *r_valid = NULL) const;
+	Error _get_path_and_type(const String &p_path, PathAndType &r_path_and_type, bool *r_valid = nullptr) const;
 
 
 	static ResourceFormatImporter *singleton;
 	static ResourceFormatImporter *singleton;
 
 
@@ -57,7 +57,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
 
 
 public:
 public:
 	static ResourceFormatImporter *get_singleton() { return singleton; }
 	static ResourceFormatImporter *get_singleton() { return singleton; }
-	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
 	virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
 	virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const;
 	virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const;
@@ -122,7 +122,7 @@ public:
 	virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const = 0;
 	virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const = 0;
 	virtual String get_option_group_file() const { return String(); }
 	virtual String get_option_group_file() const { return String(); }
 
 
-	virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL) = 0;
+	virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) = 0;
 
 
 	virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
 	virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
 	virtual bool are_import_settings_valid(const String &p_path) const { return true; }
 	virtual bool are_import_settings_valid(const String &p_path) const { return true; }

+ 9 - 9
core/io/resource_loader.cpp

@@ -745,7 +745,7 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem
 				next_tag.fields.clear();
 				next_tag.fields.clear();
 				next_tag.name = String();
 				next_tag.name = String();
 
 
-				err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+				err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
 				if (err == ERR_FILE_EOF) {
 				if (err == ERR_FILE_EOF) {
 					break;
 					break;
 				} else if (err != OK) {
 				} else if (err != OK) {
@@ -848,7 +848,7 @@ void ResourceLoader::set_load_callback(ResourceLoadedCallback p_callback) {
 	_loaded_callback = p_callback;
 	_loaded_callback = p_callback;
 }
 }
 
 
-ResourceLoadedCallback ResourceLoader::_loaded_callback = NULL;
+ResourceLoadedCallback ResourceLoader::_loaded_callback = nullptr;
 
 
 Ref<ResourceFormatLoader> ResourceLoader::_find_custom_resource_format_loader(String path) {
 Ref<ResourceFormatLoader> ResourceLoader::_find_custom_resource_format_loader(String path) {
 	for (int i = 0; i < loader_count; ++i) {
 	for (int i = 0; i < loader_count; ++i) {
@@ -874,7 +874,7 @@ bool ResourceLoader::add_custom_resource_format_loader(String script_path) {
 
 
 	Object *obj = ClassDB::instance(ibt);
 	Object *obj = ClassDB::instance(ibt);
 
 
-	ERR_FAIL_COND_V_MSG(obj == NULL, false, "Cannot instance script as custom resource loader, expected 'ResourceFormatLoader' inheritance, got: " + String(ibt) + ".");
+	ERR_FAIL_COND_V_MSG(obj == nullptr, false, "Cannot instance script as custom resource loader, expected 'ResourceFormatLoader' inheritance, got: " + String(ibt) + ".");
 
 
 	Ref<ResourceFormatLoader> crl = Object::cast_to<ResourceFormatLoader>(obj);
 	Ref<ResourceFormatLoader> crl = Object::cast_to<ResourceFormatLoader>(obj);
 	crl->set_script(s.get_ref_ptr());
 	crl->set_script(s.get_ref_ptr());
@@ -926,7 +926,7 @@ HashMap<ResourceLoader::LoadingMapKey, int, ResourceLoader::LoadingMapKeyHasher>
 
 
 void ResourceLoader::finalize() {
 void ResourceLoader::finalize() {
 #ifndef NO_THREADS
 #ifndef NO_THREADS
-	const LoadingMapKey *K = NULL;
+	const LoadingMapKey *K = nullptr;
 	while ((K = loading_map.next(K))) {
 	while ((K = loading_map.next(K))) {
 		ERR_PRINTS("Exited while resource is being loaded: " + K->path);
 		ERR_PRINTS("Exited while resource is being loaded: " + K->path);
 	}
 	}
@@ -934,11 +934,11 @@ void ResourceLoader::finalize() {
 #endif
 #endif
 }
 }
 
 
-ResourceLoadErrorNotify ResourceLoader::err_notify = NULL;
-void *ResourceLoader::err_notify_ud = NULL;
+ResourceLoadErrorNotify ResourceLoader::err_notify = nullptr;
+void *ResourceLoader::err_notify_ud = nullptr;
 
 
-DependencyErrorNotify ResourceLoader::dep_err_notify = NULL;
-void *ResourceLoader::dep_err_notify_ud = NULL;
+DependencyErrorNotify ResourceLoader::dep_err_notify = nullptr;
+void *ResourceLoader::dep_err_notify_ud = nullptr;
 
 
 bool ResourceLoader::abort_on_missing_resource = true;
 bool ResourceLoader::abort_on_missing_resource = true;
 bool ResourceLoader::timestamp_on_load = false;
 bool ResourceLoader::timestamp_on_load = false;
@@ -947,4 +947,4 @@ SelfList<Resource>::List ResourceLoader::remapped_list;
 HashMap<String, Vector<String>> ResourceLoader::translation_remaps;
 HashMap<String, Vector<String>> ResourceLoader::translation_remaps;
 HashMap<String, String> ResourceLoader::path_remaps;
 HashMap<String, String> ResourceLoader::path_remaps;
 
 
-ResourceLoaderImport ResourceLoader::import = NULL;
+ResourceLoaderImport ResourceLoader::import = nullptr;

+ 5 - 5
core/io/resource_loader.h

@@ -63,8 +63,8 @@ protected:
 	static void _bind_methods();
 	static void _bind_methods();
 
 
 public:
 public:
-	virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
-	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+	virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
+	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
 	virtual bool exists(const String &p_path) const;
 	virtual bool exists(const String &p_path) const;
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
 	virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
@@ -104,7 +104,7 @@ class ResourceLoader {
 	static HashMap<String, Vector<String>> translation_remaps;
 	static HashMap<String, Vector<String>> translation_remaps;
 	static HashMap<String, String> path_remaps;
 	static HashMap<String, String> path_remaps;
 
 
-	static String _path_remap(const String &p_path, bool *r_translation_remapped = NULL);
+	static String _path_remap(const String &p_path, bool *r_translation_remapped = nullptr);
 	friend class Resource;
 	friend class Resource;
 
 
 	static SelfList<Resource>::List remapped_list;
 	static SelfList<Resource>::List remapped_list;
@@ -138,8 +138,8 @@ class ResourceLoader {
 	static void _remove_from_loading_map_and_thread(const String &p_path, Thread::ID p_thread);
 	static void _remove_from_loading_map_and_thread(const String &p_path, Thread::ID p_thread);
 
 
 public:
 public:
-	static Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false, Error *r_error = NULL);
-	static RES load(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false, Error *r_error = NULL);
+	static Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false, Error *r_error = nullptr);
+	static RES load(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false, Error *r_error = nullptr);
 	static bool exists(const String &p_path, const String &p_type_hint = "");
 	static bool exists(const String &p_path, const String &p_type_hint = "");
 
 
 	static void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions);
 	static void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions);

+ 2 - 2
core/io/resource_saver.cpp

@@ -38,7 +38,7 @@ Ref<ResourceFormatSaver> ResourceSaver::saver[MAX_SAVERS];
 
 
 int ResourceSaver::saver_count = 0;
 int ResourceSaver::saver_count = 0;
 bool ResourceSaver::timestamp_on_save = false;
 bool ResourceSaver::timestamp_on_save = false;
-ResourceSavedCallback ResourceSaver::save_callback = 0;
+ResourceSavedCallback ResourceSaver::save_callback = nullptr;
 
 
 Error ResourceFormatSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
 Error ResourceFormatSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
 	if (get_script_instance() && get_script_instance()->has_method("save")) {
 	if (get_script_instance() && get_script_instance()->has_method("save")) {
@@ -204,7 +204,7 @@ bool ResourceSaver::add_custom_resource_format_saver(String script_path) {
 
 
 	Object *obj = ClassDB::instance(ibt);
 	Object *obj = ClassDB::instance(ibt);
 
 
-	ERR_FAIL_COND_V_MSG(obj == NULL, false, "Cannot instance script as custom resource saver, expected 'ResourceFormatSaver' inheritance, got: " + String(ibt) + ".");
+	ERR_FAIL_COND_V_MSG(obj == nullptr, false, "Cannot instance script as custom resource saver, expected 'ResourceFormatSaver' inheritance, got: " + String(ibt) + ".");
 
 
 	Ref<ResourceFormatSaver> crl = Object::cast_to<ResourceFormatSaver>(obj);
 	Ref<ResourceFormatSaver> crl = Object::cast_to<ResourceFormatSaver>(obj);
 	crl->set_script(s.get_ref_ptr());
 	crl->set_script(s.get_ref_ptr());

+ 2 - 2
core/io/stream_peer.cpp

@@ -204,7 +204,7 @@ void StreamPeer::put_utf8_string(const String &p_string) {
 void StreamPeer::put_var(const Variant &p_variant, bool p_full_objects) {
 void StreamPeer::put_var(const Variant &p_variant, bool p_full_objects) {
 	int len = 0;
 	int len = 0;
 	Vector<uint8_t> buf;
 	Vector<uint8_t> buf;
-	encode_variant(p_variant, NULL, len, p_full_objects);
+	encode_variant(p_variant, nullptr, len, p_full_objects);
 	buf.resize(len);
 	buf.resize(len);
 	put_32(len);
 	put_32(len);
 	encode_variant(p_variant, buf.ptrw(), len, p_full_objects);
 	encode_variant(p_variant, buf.ptrw(), len, p_full_objects);
@@ -335,7 +335,7 @@ Variant StreamPeer::get_var(bool p_allow_objects) {
 	ERR_FAIL_COND_V(err != OK, Variant());
 	ERR_FAIL_COND_V(err != OK, Variant());
 
 
 	Variant ret;
 	Variant ret;
-	err = decode_variant(ret, var.ptr(), len, NULL, p_allow_objects);
+	err = decode_variant(ret, var.ptr(), len, nullptr, p_allow_objects);
 	ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to decode Variant.");
 	ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to decode Variant.");
 
 
 	return ret;
 	return ret;

+ 2 - 2
core/io/stream_peer_ssl.cpp

@@ -32,12 +32,12 @@
 
 
 #include "core/engine.h"
 #include "core/engine.h"
 
 
-StreamPeerSSL *(*StreamPeerSSL::_create)() = NULL;
+StreamPeerSSL *(*StreamPeerSSL::_create)() = nullptr;
 
 
 StreamPeerSSL *StreamPeerSSL::create() {
 StreamPeerSSL *StreamPeerSSL::create() {
 	if (_create)
 	if (_create)
 		return _create();
 		return _create();
-	return NULL;
+	return nullptr;
 }
 }
 
 
 bool StreamPeerSSL::available = false;
 bool StreamPeerSSL::available = false;

+ 1 - 1
core/io/translation_loader_po.h

@@ -38,7 +38,7 @@
 class TranslationLoaderPO : public ResourceFormatLoader {
 class TranslationLoaderPO : public ResourceFormatLoader {
 public:
 public:
 	static RES load_translation(FileAccess *f, Error *r_error);
 	static RES load_translation(FileAccess *f, Error *r_error);
-	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+	virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual void get_recognized_extensions(List<String> *p_extensions) const;
 	virtual bool handles_type(const String &p_type) const;
 	virtual bool handles_type(const String &p_type) const;
 	virtual String get_resource_type(const String &p_path) const;
 	virtual String get_resource_type(const String &p_path) const;

+ 4 - 4
core/io/xml_parser.cpp

@@ -163,7 +163,7 @@ bool XMLParser::_parse_cdata() {
 		return true;
 		return true;
 
 
 	char *cDataBegin = P;
 	char *cDataBegin = P;
-	char *cDataEnd = 0;
+	char *cDataEnd = nullptr;
 
 
 	// find end of CDATA
 	// find end of CDATA
 	while (*P && !cDataEnd) {
 	while (*P && !cDataEnd) {
@@ -507,9 +507,9 @@ void XMLParser::skip_section() {
 void XMLParser::close() {
 void XMLParser::close() {
 	if (data)
 	if (data)
 		memdelete_arr(data);
 		memdelete_arr(data);
-	data = NULL;
+	data = nullptr;
 	length = 0;
 	length = 0;
-	P = NULL;
+	P = nullptr;
 	node_empty = false;
 	node_empty = false;
 	node_type = NODE_NONE;
 	node_type = NODE_NONE;
 	node_offset = 0;
 	node_offset = 0;
@@ -520,7 +520,7 @@ int XMLParser::get_current_line() const {
 }
 }
 
 
 XMLParser::XMLParser() {
 XMLParser::XMLParser() {
-	data = NULL;
+	data = nullptr;
 	close();
 	close();
 	special_characters.push_back("&amp;");
 	special_characters.push_back("&amp;");
 	special_characters.push_back("<lt;");
 	special_characters.push_back("<lt;");

+ 2 - 2
core/io/zip_io.cpp

@@ -43,7 +43,7 @@ void *zipio_open(void *data, const char *p_fname, int mode) {
 	}
 	}
 
 
 	if (!f)
 	if (!f)
-		return NULL;
+		return nullptr;
 
 
 	return data;
 	return data;
 }
 }
@@ -88,7 +88,7 @@ int zipio_close(voidpf opaque, voidpf stream) {
 	if (f) {
 	if (f) {
 		f->close();
 		f->close();
 		memdelete(f);
 		memdelete(f);
-		f = NULL;
+		f = nullptr;
 	}
 	}
 	return 0;
 	return 0;
 }
 }

+ 21 - 21
core/list.h

@@ -133,9 +133,9 @@ public:
 		}
 		}
 
 
 		_FORCE_INLINE_ Element() {
 		_FORCE_INLINE_ Element() {
-			next_ptr = 0;
-			prev_ptr = 0;
-			data = NULL;
+			next_ptr = nullptr;
+			prev_ptr = nullptr;
+			data = nullptr;
 		};
 		};
 	};
 	};
 
 
@@ -176,28 +176,28 @@ public:
 	* return a const iterator to the beginning of the list.
 	* return a const iterator to the beginning of the list.
 	*/
 	*/
 	_FORCE_INLINE_ const Element *front() const {
 	_FORCE_INLINE_ const Element *front() const {
-		return _data ? _data->first : 0;
+		return _data ? _data->first : nullptr;
 	};
 	};
 
 
 	/**
 	/**
 	* return an iterator to the beginning of the list.
 	* return an iterator to the beginning of the list.
 	*/
 	*/
 	_FORCE_INLINE_ Element *front() {
 	_FORCE_INLINE_ Element *front() {
-		return _data ? _data->first : 0;
+		return _data ? _data->first : nullptr;
 	};
 	};
 
 
 	/**
 	/**
  	* return a const iterator to the last member of the list.
  	* return a const iterator to the last member of the list.
 	*/
 	*/
 	_FORCE_INLINE_ const Element *back() const {
 	_FORCE_INLINE_ const Element *back() const {
-		return _data ? _data->last : 0;
+		return _data ? _data->last : nullptr;
 	};
 	};
 
 
 	/**
 	/**
  	* return an iterator to the last member of the list.
  	* return an iterator to the last member of the list.
 	*/
 	*/
 	_FORCE_INLINE_ Element *back() {
 	_FORCE_INLINE_ Element *back() {
-		return _data ? _data->last : 0;
+		return _data ? _data->last : nullptr;
 	};
 	};
 
 
 	/**
 	/**
@@ -206,8 +206,8 @@ public:
 	Element *push_back(const T &value) {
 	Element *push_back(const T &value) {
 		if (!_data) {
 		if (!_data) {
 			_data = memnew_allocator(_Data, A);
 			_data = memnew_allocator(_Data, A);
-			_data->first = NULL;
-			_data->last = NULL;
+			_data->first = nullptr;
+			_data->last = nullptr;
 			_data->size_cache = 0;
 			_data->size_cache = 0;
 		}
 		}
 
 
@@ -215,7 +215,7 @@ public:
 		n->value = (T &)value;
 		n->value = (T &)value;
 
 
 		n->prev_ptr = _data->last;
 		n->prev_ptr = _data->last;
-		n->next_ptr = 0;
+		n->next_ptr = nullptr;
 		n->data = _data;
 		n->data = _data;
 
 
 		if (_data->last) {
 		if (_data->last) {
@@ -243,14 +243,14 @@ public:
 	Element *push_front(const T &value) {
 	Element *push_front(const T &value) {
 		if (!_data) {
 		if (!_data) {
 			_data = memnew_allocator(_Data, A);
 			_data = memnew_allocator(_Data, A);
-			_data->first = NULL;
-			_data->last = NULL;
+			_data->first = nullptr;
+			_data->last = nullptr;
 			_data->size_cache = 0;
 			_data->size_cache = 0;
 		}
 		}
 
 
 		Element *n = memnew_allocator(Element, A);
 		Element *n = memnew_allocator(Element, A);
 		n->value = (T &)value;
 		n->value = (T &)value;
-		n->prev_ptr = 0;
+		n->prev_ptr = nullptr;
 		n->next_ptr = _data->first;
 		n->next_ptr = _data->first;
 		n->data = _data;
 		n->data = _data;
 
 
@@ -337,7 +337,7 @@ public:
 			it = it->next();
 			it = it->next();
 		};
 		};
 
 
-		return NULL;
+		return nullptr;
 	};
 	};
 
 
 	/**
 	/**
@@ -349,7 +349,7 @@ public:
 
 
 			if (_data->size_cache == 0) {
 			if (_data->size_cache == 0) {
 				memdelete_allocator<_Data, A>(_data);
 				memdelete_allocator<_Data, A>(_data);
-				_data = NULL;
+				_data = nullptr;
 			}
 			}
 
 
 			return ret;
 			return ret;
@@ -487,7 +487,7 @@ public:
 
 
 		_data->last->next_ptr = p_I;
 		_data->last->next_ptr = p_I;
 		p_I->prev_ptr = _data->last;
 		p_I->prev_ptr = _data->last;
-		p_I->next_ptr = NULL;
+		p_I->next_ptr = nullptr;
 		_data->last = p_I;
 		_data->last = p_I;
 	}
 	}
 
 
@@ -521,7 +521,7 @@ public:
 
 
 		_data->first->prev_ptr = p_I;
 		_data->first->prev_ptr = p_I;
 		p_I->next_ptr = _data->first;
 		p_I->next_ptr = _data->first;
-		p_I->prev_ptr = NULL;
+		p_I->prev_ptr = nullptr;
 		_data->first = p_I;
 		_data->first = p_I;
 	}
 	}
 
 
@@ -636,12 +636,12 @@ public:
 		sort.sort(aux_buffer, s);
 		sort.sort(aux_buffer, s);
 
 
 		_data->first = aux_buffer[0];
 		_data->first = aux_buffer[0];
-		aux_buffer[0]->prev_ptr = NULL;
+		aux_buffer[0]->prev_ptr = nullptr;
 		aux_buffer[0]->next_ptr = aux_buffer[1];
 		aux_buffer[0]->next_ptr = aux_buffer[1];
 
 
 		_data->last = aux_buffer[s - 1];
 		_data->last = aux_buffer[s - 1];
 		aux_buffer[s - 1]->prev_ptr = aux_buffer[s - 2];
 		aux_buffer[s - 1]->prev_ptr = aux_buffer[s - 2];
-		aux_buffer[s - 1]->next_ptr = NULL;
+		aux_buffer[s - 1]->next_ptr = nullptr;
 
 
 		for (int i = 1; i < s - 1; i++) {
 		for (int i = 1; i < s - 1; i++) {
 			aux_buffer[i]->prev_ptr = aux_buffer[i - 1];
 			aux_buffer[i]->prev_ptr = aux_buffer[i - 1];
@@ -659,7 +659,7 @@ public:
 	 * copy constructor for the list
 	 * copy constructor for the list
 	 */
 	 */
 	List(const List &p_list) {
 	List(const List &p_list) {
-		_data = NULL;
+		_data = nullptr;
 		const Element *it = p_list.front();
 		const Element *it = p_list.front();
 		while (it) {
 		while (it) {
 			push_back(it->get());
 			push_back(it->get());
@@ -668,7 +668,7 @@ public:
 	}
 	}
 
 
 	List() {
 	List() {
-		_data = NULL;
+		_data = nullptr;
 	};
 	};
 	~List() {
 	~List() {
 		clear();
 		clear();

+ 21 - 21
core/map.h

@@ -89,11 +89,11 @@ public:
 		};
 		};
 		Element() {
 		Element() {
 			color = RED;
 			color = RED;
-			right = NULL;
-			left = NULL;
-			parent = NULL;
-			_next = NULL;
-			_prev = NULL;
+			right = nullptr;
+			left = nullptr;
+			parent = nullptr;
+			_next = nullptr;
+			_prev = nullptr;
 		};
 		};
 	};
 	};
 
 
@@ -111,7 +111,7 @@ private:
 #else
 #else
 			_nil = (Element *)&_GlobalNilClass::_nil;
 			_nil = (Element *)&_GlobalNilClass::_nil;
 #endif
 #endif
-			_root = NULL;
+			_root = nullptr;
 			size_cache = 0;
 			size_cache = 0;
 		}
 		}
 
 
@@ -124,7 +124,7 @@ private:
 		void _free_root() {
 		void _free_root() {
 			if (_root) {
 			if (_root) {
 				memdelete_allocator<Element, A>(_root);
 				memdelete_allocator<Element, A>(_root);
-				_root = NULL;
+				_root = nullptr;
 			}
 			}
 		}
 		}
 
 
@@ -189,7 +189,7 @@ private:
 			}
 			}
 
 
 			if (node->parent == _data._root)
 			if (node->parent == _data._root)
-				return NULL; // No successor, as p_node = last node
+				return nullptr; // No successor, as p_node = last node
 			return node->parent;
 			return node->parent;
 		}
 		}
 	}
 	}
@@ -209,7 +209,7 @@ private:
 			}
 			}
 
 
 			if (node == _data._root)
 			if (node == _data._root)
-				return NULL; // No predecessor, as p_node = first node
+				return nullptr; // No predecessor, as p_node = first node
 			return node->parent;
 			return node->parent;
 		}
 		}
 	}
 	}
@@ -227,12 +227,12 @@ private:
 				return node; // found
 				return node; // found
 		}
 		}
 
 
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	Element *_find_closest(const K &p_key) const {
 	Element *_find_closest(const K &p_key) const {
 		Element *node = _data._root->left;
 		Element *node = _data._root->left;
-		Element *prev = NULL;
+		Element *prev = nullptr;
 		C less;
 		C less;
 
 
 		while (node != _data._nil) {
 		while (node != _data._nil) {
@@ -246,8 +246,8 @@ private:
 				return node; // found
 				return node; // found
 		}
 		}
 
 
-		if (prev == NULL)
-			return NULL; // tree empty
+		if (prev == nullptr)
+			return nullptr; // tree empty
 
 
 		if (less(p_key, prev->_key))
 		if (less(p_key, prev->_key))
 			prev = prev->_prev;
 			prev = prev->_prev;
@@ -488,7 +488,7 @@ private:
 public:
 public:
 	const Element *find(const K &p_key) const {
 	const Element *find(const K &p_key) const {
 		if (!_data._root)
 		if (!_data._root)
-			return NULL;
+			return nullptr;
 
 
 		const Element *res = _find(p_key);
 		const Element *res = _find(p_key);
 		return res;
 		return res;
@@ -496,7 +496,7 @@ public:
 
 
 	Element *find(const K &p_key) {
 	Element *find(const K &p_key) {
 		if (!_data._root)
 		if (!_data._root)
-			return NULL;
+			return nullptr;
 
 
 		Element *res = _find(p_key);
 		Element *res = _find(p_key);
 		return res;
 		return res;
@@ -512,14 +512,14 @@ public:
 
 
 	Element *find_closest(const K &p_key) {
 	Element *find_closest(const K &p_key) {
 		if (!_data._root)
 		if (!_data._root)
-			return NULL;
+			return nullptr;
 
 
 		Element *res = _find_closest(p_key);
 		Element *res = _find_closest(p_key);
 		return res;
 		return res;
 	}
 	}
 
 
 	bool has(const K &p_key) const {
 	bool has(const K &p_key) const {
-		return find(p_key) != NULL;
+		return find(p_key) != nullptr;
 	}
 	}
 
 
 	Element *insert(const K &p_key, const V &p_value) {
 	Element *insert(const K &p_key, const V &p_value) {
@@ -571,11 +571,11 @@ public:
 
 
 	Element *front() const {
 	Element *front() const {
 		if (!_data._root)
 		if (!_data._root)
-			return NULL;
+			return nullptr;
 
 
 		Element *e = _data._root->left;
 		Element *e = _data._root->left;
 		if (e == _data._nil)
 		if (e == _data._nil)
-			return NULL;
+			return nullptr;
 
 
 		while (e->left != _data._nil)
 		while (e->left != _data._nil)
 			e = e->left;
 			e = e->left;
@@ -585,11 +585,11 @@ public:
 
 
 	Element *back() const {
 	Element *back() const {
 		if (!_data._root)
 		if (!_data._root)
-			return NULL;
+			return nullptr;
 
 
 		Element *e = _data._root->left;
 		Element *e = _data._root->left;
 		if (e == _data._nil)
 		if (e == _data._nil)
-			return NULL;
+			return nullptr;
 
 
 		while (e->right != _data._nil)
 		while (e->right != _data._nil)
 			e = e->right;
 			e = e->right;

+ 4 - 4
core/math/a_star.cpp

@@ -64,7 +64,7 @@ void AStar::add_point(int p_id, const Vector3 &p_pos, real_t p_weight_scale) {
 		pt->id = p_id;
 		pt->id = p_id;
 		pt->pos = p_pos;
 		pt->pos = p_pos;
 		pt->weight_scale = p_weight_scale;
 		pt->weight_scale = p_weight_scale;
-		pt->prev_point = NULL;
+		pt->prev_point = nullptr;
 		pt->open_pass = 0;
 		pt->open_pass = 0;
 		pt->closed_pass = 0;
 		pt->closed_pass = 0;
 		pt->enabled = true;
 		pt->enabled = true;
@@ -158,7 +158,7 @@ void AStar::connect_points(int p_id, int p_with_id, bool bidirectional) {
 		s.direction = Segment::BIDIRECTIONAL;
 		s.direction = Segment::BIDIRECTIONAL;
 
 
 	Set<Segment>::Element *element = segments.find(s);
 	Set<Segment>::Element *element = segments.find(s);
-	if (element != NULL) {
+	if (element != nullptr) {
 		s.direction |= element->get().direction;
 		s.direction |= element->get().direction;
 		if (s.direction == Segment::BIDIRECTIONAL) {
 		if (s.direction == Segment::BIDIRECTIONAL) {
 			// Both are neighbours of each other now
 			// Both are neighbours of each other now
@@ -184,7 +184,7 @@ void AStar::disconnect_points(int p_id, int p_with_id, bool bidirectional) {
 	int remove_direction = bidirectional ? (int)Segment::BIDIRECTIONAL : s.direction;
 	int remove_direction = bidirectional ? (int)Segment::BIDIRECTIONAL : s.direction;
 
 
 	Set<Segment>::Element *element = segments.find(s);
 	Set<Segment>::Element *element = segments.find(s);
-	if (element != NULL) {
+	if (element != nullptr) {
 		// s is the new segment
 		// s is the new segment
 		// Erase the directions to be removed
 		// Erase the directions to be removed
 		s.direction = (element->get().direction & ~remove_direction);
 		s.direction = (element->get().direction & ~remove_direction);
@@ -241,7 +241,7 @@ bool AStar::are_points_connected(int p_id, int p_with_id, bool bidirectional) co
 	Segment s(p_id, p_with_id);
 	Segment s(p_id, p_with_id);
 	const Set<Segment>::Element *element = segments.find(s);
 	const Set<Segment>::Element *element = segments.find(s);
 
 
-	return element != NULL &&
+	return element != nullptr &&
 		   (bidirectional || (element->get().direction & s.direction) == s.direction);
 		   (bidirectional || (element->get().direction & s.direction) == s.direction);
 }
 }
 
 

+ 2 - 2
core/math/aabb.h

@@ -70,8 +70,8 @@ public:
 	AABB merge(const AABB &p_with) const;
 	AABB merge(const AABB &p_with) const;
 	void merge_with(const AABB &p_aabb); ///merge with another AABB
 	void merge_with(const AABB &p_aabb); ///merge with another AABB
 	AABB intersection(const AABB &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
 	AABB intersection(const AABB &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
-	bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
-	bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
+	bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const;
+	bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const;
 	_FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
 	_FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
 
 
 	_FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const;
 	_FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const;

+ 39 - 39
core/math/expression.cpp

@@ -685,7 +685,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
 			PoolByteArray barr;
 			PoolByteArray barr;
 			bool full_objects = *p_inputs[1];
 			bool full_objects = *p_inputs[1];
 			int len;
 			int len;
-			Error err = encode_variant(*p_inputs[0], NULL, len, full_objects);
+			Error err = encode_variant(*p_inputs[0], nullptr, len, full_objects);
 			if (err) {
 			if (err) {
 				r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
 				r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
 				r_error.argument = 0;
 				r_error.argument = 0;
@@ -715,7 +715,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
 			Variant ret;
 			Variant ret;
 			{
 			{
 				PoolByteArray::Read r = varr.read();
 				PoolByteArray::Read r = varr.read();
-				Error err = decode_variant(ret, r.ptr(), varr.size(), NULL, allow_objects);
+				Error err = decode_variant(ret, r.ptr(), varr.size(), nullptr, allow_objects);
 				if (err != OK) {
 				if (err != OK) {
 					r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format.");
 					r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format.");
 					r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
 					r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
@@ -1206,12 +1206,12 @@ Expression::ENode *Expression::_parse_expression() {
 
 
 	while (true) {
 	while (true) {
 		//keep appending stuff to expression
 		//keep appending stuff to expression
-		ENode *expr = NULL;
+		ENode *expr = nullptr;
 
 
 		Token tk;
 		Token tk;
 		_get_token(tk);
 		_get_token(tk);
 		if (error_set)
 		if (error_set)
-			return NULL;
+			return nullptr;
 
 
 		switch (tk.type) {
 		switch (tk.type) {
 			case TK_CURLY_BRACKET_OPEN: {
 			case TK_CURLY_BRACKET_OPEN: {
@@ -1228,18 +1228,18 @@ Expression::ENode *Expression::_parse_expression() {
 					//parse an expression
 					//parse an expression
 					ENode *subexpr = _parse_expression();
 					ENode *subexpr = _parse_expression();
 					if (!subexpr)
 					if (!subexpr)
-						return NULL;
+						return nullptr;
 					dn->dict.push_back(subexpr);
 					dn->dict.push_back(subexpr);
 
 
 					_get_token(tk);
 					_get_token(tk);
 					if (tk.type != TK_COLON) {
 					if (tk.type != TK_COLON) {
 						_set_error("Expected ':'");
 						_set_error("Expected ':'");
-						return NULL;
+						return nullptr;
 					}
 					}
 
 
 					subexpr = _parse_expression();
 					subexpr = _parse_expression();
 					if (!subexpr)
 					if (!subexpr)
-						return NULL;
+						return nullptr;
 
 
 					dn->dict.push_back(subexpr);
 					dn->dict.push_back(subexpr);
 
 
@@ -1271,7 +1271,7 @@ Expression::ENode *Expression::_parse_expression() {
 					//parse an expression
 					//parse an expression
 					ENode *subexpr = _parse_expression();
 					ENode *subexpr = _parse_expression();
 					if (!subexpr)
 					if (!subexpr)
-						return NULL;
+						return nullptr;
 					an->array.push_back(subexpr);
 					an->array.push_back(subexpr);
 
 
 					cofs = str_ofs;
 					cofs = str_ofs;
@@ -1291,11 +1291,11 @@ Expression::ENode *Expression::_parse_expression() {
 				//a suexpression
 				//a suexpression
 				ENode *e = _parse_expression();
 				ENode *e = _parse_expression();
 				if (error_set)
 				if (error_set)
-					return NULL;
+					return nullptr;
 				_get_token(tk);
 				_get_token(tk);
 				if (tk.type != TK_PARENTHESIS_CLOSE) {
 				if (tk.type != TK_PARENTHESIS_CLOSE) {
 					_set_error("Expected ')'");
 					_set_error("Expected ')'");
-					return NULL;
+					return nullptr;
 				}
 				}
 
 
 				expr = e;
 				expr = e;
@@ -1323,7 +1323,7 @@ Expression::ENode *Expression::_parse_expression() {
 						//parse an expression
 						//parse an expression
 						ENode *subexpr = _parse_expression();
 						ENode *subexpr = _parse_expression();
 						if (!subexpr)
 						if (!subexpr)
-							return NULL;
+							return nullptr;
 
 
 						func_call->arguments.push_back(subexpr);
 						func_call->arguments.push_back(subexpr);
 
 
@@ -1385,7 +1385,7 @@ Expression::ENode *Expression::_parse_expression() {
 				_get_token(tk);
 				_get_token(tk);
 				if (tk.type != TK_PARENTHESIS_OPEN) {
 				if (tk.type != TK_PARENTHESIS_OPEN) {
 					_set_error("Expected '('");
 					_set_error("Expected '('");
-					return NULL;
+					return nullptr;
 				}
 				}
 
 
 				ConstructorNode *constructor = alloc_node<ConstructorNode>();
 				ConstructorNode *constructor = alloc_node<ConstructorNode>();
@@ -1401,7 +1401,7 @@ Expression::ENode *Expression::_parse_expression() {
 					//parse an expression
 					//parse an expression
 					ENode *subexpr = _parse_expression();
 					ENode *subexpr = _parse_expression();
 					if (!subexpr)
 					if (!subexpr)
-						return NULL;
+						return nullptr;
 
 
 					constructor->arguments.push_back(subexpr);
 					constructor->arguments.push_back(subexpr);
 
 
@@ -1425,7 +1425,7 @@ Expression::ENode *Expression::_parse_expression() {
 				_get_token(tk);
 				_get_token(tk);
 				if (tk.type != TK_PARENTHESIS_OPEN) {
 				if (tk.type != TK_PARENTHESIS_OPEN) {
 					_set_error("Expected '('");
 					_set_error("Expected '('");
-					return NULL;
+					return nullptr;
 				}
 				}
 
 
 				BuiltinFuncNode *bifunc = alloc_node<BuiltinFuncNode>();
 				BuiltinFuncNode *bifunc = alloc_node<BuiltinFuncNode>();
@@ -1441,7 +1441,7 @@ Expression::ENode *Expression::_parse_expression() {
 					//parse an expression
 					//parse an expression
 					ENode *subexpr = _parse_expression();
 					ENode *subexpr = _parse_expression();
 					if (!subexpr)
 					if (!subexpr)
-						return NULL;
+						return nullptr;
 
 
 					bifunc->arguments.push_back(subexpr);
 					bifunc->arguments.push_back(subexpr);
 
 
@@ -1481,7 +1481,7 @@ Expression::ENode *Expression::_parse_expression() {
 
 
 			default: {
 			default: {
 				_set_error("Expected expression.");
 				_set_error("Expected expression.");
-				return NULL;
+				return nullptr;
 			} break;
 			} break;
 		}
 		}
 
 
@@ -1491,7 +1491,7 @@ Expression::ENode *Expression::_parse_expression() {
 			int cofs2 = str_ofs;
 			int cofs2 = str_ofs;
 			_get_token(tk);
 			_get_token(tk);
 			if (error_set)
 			if (error_set)
-				return NULL;
+				return nullptr;
 
 
 			bool done = false;
 			bool done = false;
 
 
@@ -1504,14 +1504,14 @@ Expression::ENode *Expression::_parse_expression() {
 
 
 					ENode *what = _parse_expression();
 					ENode *what = _parse_expression();
 					if (!what)
 					if (!what)
-						return NULL;
+						return nullptr;
 
 
 					index->index = what;
 					index->index = what;
 
 
 					_get_token(tk);
 					_get_token(tk);
 					if (tk.type != TK_BRACKET_CLOSE) {
 					if (tk.type != TK_BRACKET_CLOSE) {
 						_set_error("Expected ']' at end of index.");
 						_set_error("Expected ']' at end of index.");
-						return NULL;
+						return nullptr;
 					}
 					}
 					expr = index;
 					expr = index;
 
 
@@ -1521,7 +1521,7 @@ Expression::ENode *Expression::_parse_expression() {
 					_get_token(tk);
 					_get_token(tk);
 					if (tk.type != TK_IDENTIFIER) {
 					if (tk.type != TK_IDENTIFIER) {
 						_set_error("Expected identifier after '.'");
 						_set_error("Expected identifier after '.'");
-						return NULL;
+						return nullptr;
 					}
 					}
 
 
 					StringName identifier = tk.value;
 					StringName identifier = tk.value;
@@ -1544,7 +1544,7 @@ Expression::ENode *Expression::_parse_expression() {
 							//parse an expression
 							//parse an expression
 							ENode *subexpr = _parse_expression();
 							ENode *subexpr = _parse_expression();
 							if (!subexpr)
 							if (!subexpr)
-								return NULL;
+								return nullptr;
 
 
 							func_call->arguments.push_back(subexpr);
 							func_call->arguments.push_back(subexpr);
 
 
@@ -1594,7 +1594,7 @@ Expression::ENode *Expression::_parse_expression() {
 		int cofs = str_ofs;
 		int cofs = str_ofs;
 		_get_token(tk);
 		_get_token(tk);
 		if (error_set)
 		if (error_set)
-			return NULL;
+			return nullptr;
 
 
 		Variant::Operator op = Variant::OP_MAX;
 		Variant::Operator op = Variant::OP_MAX;
 
 
@@ -1777,7 +1777,7 @@ Expression::ENode *Expression::_parse_expression() {
 
 
 				default: {
 				default: {
 					_set_error("Parser bug, invalid operator in expression: " + itos(expression[i].op));
 					_set_error("Parser bug, invalid operator in expression: " + itos(expression[i].op));
-					return NULL;
+					return nullptr;
 				}
 				}
 			}
 			}
 
 
@@ -1793,7 +1793,7 @@ Expression::ENode *Expression::_parse_expression() {
 
 
 		if (next_op == -1) {
 		if (next_op == -1) {
 			_set_error("Yet another parser bug....");
 			_set_error("Yet another parser bug....");
-			ERR_FAIL_V(NULL);
+			ERR_FAIL_V(nullptr);
 		}
 		}
 
 
 		// OK! create operator..
 		// OK! create operator..
@@ -1804,7 +1804,7 @@ Expression::ENode *Expression::_parse_expression() {
 				if (expr_pos == expression.size()) {
 				if (expr_pos == expression.size()) {
 					//can happen..
 					//can happen..
 					_set_error("Unexpected end of expression...");
 					_set_error("Unexpected end of expression...");
-					return NULL;
+					return nullptr;
 				}
 				}
 			}
 			}
 
 
@@ -1813,7 +1813,7 @@ Expression::ENode *Expression::_parse_expression() {
 				OperatorNode *op = alloc_node<OperatorNode>();
 				OperatorNode *op = alloc_node<OperatorNode>();
 				op->op = expression[i].op;
 				op->op = expression[i].op;
 				op->nodes[0] = expression[i + 1].node;
 				op->nodes[0] = expression[i + 1].node;
-				op->nodes[1] = NULL;
+				op->nodes[1] = nullptr;
 				expression.write[i].is_op = false;
 				expression.write[i].is_op = false;
 				expression.write[i].node = op;
 				expression.write[i].node = op;
 				expression.remove(i + 1);
 				expression.remove(i + 1);
@@ -1822,7 +1822,7 @@ Expression::ENode *Expression::_parse_expression() {
 		} else {
 		} else {
 			if (next_op < 1 || next_op >= (expression.size() - 1)) {
 			if (next_op < 1 || next_op >= (expression.size() - 1)) {
 				_set_error("Parser bug...");
 				_set_error("Parser bug...");
-				ERR_FAIL_V(NULL);
+				ERR_FAIL_V(nullptr);
 			}
 			}
 
 
 			OperatorNode *op = alloc_node<OperatorNode>();
 			OperatorNode *op = alloc_node<OperatorNode>();
@@ -1830,7 +1830,7 @@ Expression::ENode *Expression::_parse_expression() {
 
 
 			if (expression[next_op - 1].is_op) {
 			if (expression[next_op - 1].is_op) {
 				_set_error("Parser bug...");
 				_set_error("Parser bug...");
-				ERR_FAIL_V(NULL);
+				ERR_FAIL_V(nullptr);
 			}
 			}
 
 
 			if (expression[next_op + 1].is_op) {
 			if (expression[next_op + 1].is_op) {
@@ -1840,7 +1840,7 @@ Expression::ENode *Expression::_parse_expression() {
 				// due to how precedence works, unaries will always disappear first
 				// due to how precedence works, unaries will always disappear first
 
 
 				_set_error("Unexpected two consecutive operators.");
 				_set_error("Unexpected two consecutive operators.");
-				return NULL;
+				return nullptr;
 			}
 			}
 
 
 			op->nodes[0] = expression[next_op - 1].node; //expression goes as left
 			op->nodes[0] = expression[next_op - 1].node; //expression goes as left
@@ -1862,8 +1862,8 @@ bool Expression::_compile_expression() {
 
 
 	if (nodes) {
 	if (nodes) {
 		memdelete(nodes);
 		memdelete(nodes);
-		nodes = NULL;
-		root = NULL;
+		nodes = nullptr;
+		root = nullptr;
 	}
 	}
 
 
 	error_str = String();
 	error_str = String();
@@ -1873,11 +1873,11 @@ bool Expression::_compile_expression() {
 	root = _parse_expression();
 	root = _parse_expression();
 
 
 	if (error_set) {
 	if (error_set) {
-		root = NULL;
+		root = nullptr;
 		if (nodes) {
 		if (nodes) {
 			memdelete(nodes);
 			memdelete(nodes);
 		}
 		}
-		nodes = NULL;
+		nodes = nullptr;
 		return true;
 		return true;
 	}
 	}
 
 
@@ -2100,8 +2100,8 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression:
 Error Expression::parse(const String &p_expression, const Vector<String> &p_input_names) {
 Error Expression::parse(const String &p_expression, const Vector<String> &p_input_names) {
 	if (nodes) {
 	if (nodes) {
 		memdelete(nodes);
 		memdelete(nodes);
-		nodes = NULL;
-		root = NULL;
+		nodes = nullptr;
+		root = nullptr;
 	}
 	}
 
 
 	error_str = String();
 	error_str = String();
@@ -2113,11 +2113,11 @@ Error Expression::parse(const String &p_expression, const Vector<String> &p_inpu
 	root = _parse_expression();
 	root = _parse_expression();
 
 
 	if (error_set) {
 	if (error_set) {
-		root = NULL;
+		root = nullptr;
 		if (nodes) {
 		if (nodes) {
 			memdelete(nodes);
 			memdelete(nodes);
 		}
 		}
-		nodes = NULL;
+		nodes = nullptr;
 		return ERR_INVALID_PARAMETER;
 		return ERR_INVALID_PARAMETER;
 	}
 	}
 
 
@@ -2159,8 +2159,8 @@ Expression::Expression() :
 		output_type(Variant::NIL),
 		output_type(Variant::NIL),
 		sequenced(false),
 		sequenced(false),
 		error_set(true),
 		error_set(true),
-		root(NULL),
-		nodes(NULL),
+		root(nullptr),
+		nodes(nullptr),
 		execution_error(false) {
 		execution_error(false) {
 }
 }
 
 

+ 2 - 2
core/math/expression.h

@@ -217,7 +217,7 @@ private:
 
 
 		Type type;
 		Type type;
 
 
-		ENode() { next = NULL; }
+		ENode() { next = nullptr; }
 		virtual ~ENode() {
 		virtual ~ENode() {
 			if (next) {
 			if (next) {
 				memdelete(next);
 				memdelete(next);
@@ -345,7 +345,7 @@ protected:
 
 
 public:
 public:
 	Error parse(const String &p_expression, const Vector<String> &p_input_names = Vector<String>());
 	Error parse(const String &p_expression, const Vector<String> &p_input_names = Vector<String>());
-	Variant execute(Array p_inputs, Object *p_base = NULL, bool p_show_error = true);
+	Variant execute(Array p_inputs, Object *p_base = nullptr, bool p_show_error = true);
 	bool has_execute_failed() const;
 	bool has_execute_failed() const;
 	String get_error_text() const;
 	String get_error_text() const;
 
 

+ 2 - 2
core/math/face3.h

@@ -69,8 +69,8 @@ public:
 	Vector3 get_median_point() const;
 	Vector3 get_median_point() const;
 	Vector3 get_closest_point_to(const Vector3 &p_point) const;
 	Vector3 get_closest_point_to(const Vector3 &p_point) const;
 
 
-	bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = 0) const;
-	bool intersects_segment(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = 0) const;
+	bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = nullptr) const;
+	bool intersects_segment(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = nullptr) const;
 
 
 	ClockDirection get_clock_dir() const; ///< todo, test if this is returning the proper clockwisity
 	ClockDirection get_clock_dir() const; ///< todo, test if this is returning the proper clockwisity
 
 

+ 6 - 6
core/math/geometry.h

@@ -189,7 +189,7 @@ public:
 		return dP.length(); // Return the closest distance.
 		return dP.length(); // Return the closest distance.
 	}
 	}
 
 
-	static inline bool ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2, Vector3 *r_res = 0) {
+	static inline bool ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2, Vector3 *r_res = nullptr) {
 		Vector3 e1 = p_v1 - p_v0;
 		Vector3 e1 = p_v1 - p_v0;
 		Vector3 e2 = p_v2 - p_v0;
 		Vector3 e2 = p_v2 - p_v0;
 		Vector3 h = p_dir.cross(e2);
 		Vector3 h = p_dir.cross(e2);
@@ -224,7 +224,7 @@ public:
 			return false;
 			return false;
 	}
 	}
 
 
-	static inline bool segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2, Vector3 *r_res = 0) {
+	static inline bool segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2, Vector3 *r_res = nullptr) {
 		Vector3 rel = p_to - p_from;
 		Vector3 rel = p_to - p_from;
 		Vector3 e1 = p_v1 - p_v0;
 		Vector3 e1 = p_v1 - p_v0;
 		Vector3 e2 = p_v2 - p_v0;
 		Vector3 e2 = p_v2 - p_v0;
@@ -260,7 +260,7 @@ public:
 			return false;
 			return false;
 	}
 	}
 
 
-	static inline bool segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius, Vector3 *r_res = 0, Vector3 *r_norm = 0) {
+	static inline bool segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius, Vector3 *r_res = nullptr, Vector3 *r_norm = nullptr) {
 		Vector3 sphere_pos = p_sphere_pos - p_from;
 		Vector3 sphere_pos = p_sphere_pos - p_from;
 		Vector3 rel = (p_to - p_from);
 		Vector3 rel = (p_to - p_from);
 		real_t rel_l = rel.length();
 		real_t rel_l = rel.length();
@@ -295,7 +295,7 @@ public:
 		return true;
 		return true;
 	}
 	}
 
 
-	static inline bool segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, real_t p_height, real_t p_radius, Vector3 *r_res = 0, Vector3 *r_norm = 0, int p_cylinder_axis = 2) {
+	static inline bool segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, real_t p_height, real_t p_radius, Vector3 *r_res = nullptr, Vector3 *r_norm = nullptr, int p_cylinder_axis = 2) {
 		Vector3 rel = (p_to - p_from);
 		Vector3 rel = (p_to - p_from);
 		real_t rel_l = rel.length();
 		real_t rel_l = rel.length();
 		if (rel_l < CMP_EPSILON)
 		if (rel_l < CMP_EPSILON)
@@ -892,7 +892,7 @@ public:
 		for (int i = 0; i < c; i++) {
 		for (int i = 0; i < c; i++) {
 			const Vector2 &v1 = p[i];
 			const Vector2 &v1 = p[i];
 			const Vector2 &v2 = p[(i + 1) % c];
 			const Vector2 &v2 = p[(i + 1) % c];
-			if (segment_intersects_segment_2d(v1, v2, p_point, further_away, NULL)) {
+			if (segment_intersects_segment_2d(v1, v2, p_point, further_away, nullptr)) {
 				intersections++;
 				intersections++;
 			}
 			}
 		}
 		}
@@ -903,7 +903,7 @@ public:
 	static PoolVector<PoolVector<Face3>> separate_objects(PoolVector<Face3> p_array);
 	static PoolVector<PoolVector<Face3>> separate_objects(PoolVector<Face3> p_array);
 
 
 	// Create a "wrap" that encloses the given geometry.
 	// Create a "wrap" that encloses the given geometry.
-	static PoolVector<Face3> wrap_geometry(PoolVector<Face3> p_array, real_t *p_error = NULL);
+	static PoolVector<Face3> wrap_geometry(PoolVector<Face3> p_array, real_t *p_error = nullptr);
 
 
 	struct MeshData {
 	struct MeshData {
 		struct Face {
 		struct Face {

+ 28 - 28
core/math/octree_definition.inc

@@ -182,12 +182,12 @@ private:
 			children_count = 0;
 			children_count = 0;
 			parent_index = -1;
 			parent_index = -1;
 			last_pass = 0;
 			last_pass = 0;
-			parent = NULL;
+			parent = nullptr;
 #ifdef OCTREE_USE_CACHED_LISTS
 #ifdef OCTREE_USE_CACHED_LISTS
 			dirty = true;
 			dirty = true;
 #endif
 #endif
 			for (int i = 0; i < 8; i++)
 			for (int i = 0; i < 8; i++)
-				children[i] = NULL;
+				children[i] = nullptr;
 		}
 		}
 
 
 		~Octant() {
 		~Octant() {
@@ -241,11 +241,11 @@ private:
 			_id = 0;
 			_id = 0;
 			pairable = false;
 			pairable = false;
 			subindex = 0;
 			subindex = 0;
-			userdata = 0;
-			octree = 0;
+			userdata = nullptr;
+			octree = nullptr;
 			pairable_mask = 0;
 			pairable_mask = 0;
 			pairable_type = 0;
 			pairable_type = 0;
-			common_parent = NULL;
+			common_parent = nullptr;
 		}
 		}
 	};
 	};
 
 
@@ -370,17 +370,17 @@ private:
 
 
 	_FORCE_INLINE_ void _optimize() {
 	_FORCE_INLINE_ void _optimize() {
 		while (root && root->children_count < 2 && !root->elements.size() && !(use_pairs && root->pairable_elements.size())) {
 		while (root && root->children_count < 2 && !root->elements.size() && !(use_pairs && root->pairable_elements.size())) {
-			Octant *new_root = NULL;
+			Octant *new_root = nullptr;
 			if (root->children_count == 1) {
 			if (root->children_count == 1) {
 				for (int i = 0; i < 8; i++) {
 				for (int i = 0; i < 8; i++) {
 					if (root->children[i]) {
 					if (root->children[i]) {
 						new_root = root->children[i];
 						new_root = root->children[i];
-						root->children[i] = NULL;
+						root->children[i] = nullptr;
 						break;
 						break;
 					}
 					}
 				}
 				}
 				ERR_FAIL_COND(!new_root);
 				ERR_FAIL_COND(!new_root);
-				new_root->parent = NULL;
+				new_root->parent = nullptr;
 				new_root->parent_index = -1;
 				new_root->parent_index = -1;
 			}
 			}
 
 
@@ -392,7 +392,7 @@ private:
 
 
 	void _insert_element(Element *p_element, Octant *p_octant);
 	void _insert_element(Element *p_element, Octant *p_octant);
 	void _ensure_valid_root(const AABB &p_aabb);
 	void _ensure_valid_root(const AABB &p_aabb);
-	bool _remove_element_pair_and_remove_empty_octants(Element *p_element, Octant *p_octant, Octant *p_limit = NULL);
+	bool _remove_element_pair_and_remove_empty_octants(Element *p_element, Octant *p_octant, Octant *p_limit = nullptr);
 	void _remove_element(Element *p_element);
 	void _remove_element(Element *p_element);
 	void _pair_element(Element *p_element, Octant *p_octant);
 	void _pair_element(Element *p_element, Octant *p_octant);
 	void _unpair_element(Element *p_element, Octant *p_octant);
 	void _unpair_element(Element *p_element, Octant *p_octant);
@@ -441,10 +441,10 @@ public:
 	int get_subindex(OctreeElementID p_id) const;
 	int get_subindex(OctreeElementID p_id) const;
 
 
 	int cull_convex(const Vector<Plane> &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask = 0xFFFFFFFF);
 	int cull_convex(const Vector<Plane> &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask = 0xFFFFFFFF);
-	int cull_aabb(const AABB &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
-	int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
+	int cull_aabb(const AABB &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF);
+	int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF);
 
 
-	int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
+	int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF);
 
 
 	void set_pair_callback(PairCallback p_callback, void *p_userdata);
 	void set_pair_callback(PairCallback p_callback, void *p_userdata);
 	void set_unpair_callback(UnpairCallback p_callback, void *p_userdata);
 	void set_unpair_callback(UnpairCallback p_callback, void *p_userdata);
@@ -476,7 +476,7 @@ public:
 
 
 OCTREE_FUNC(T *)::get(OctreeElementID p_id) const {
 OCTREE_FUNC(T *)::get(OctreeElementID p_id) const {
 	const typename ElementMap::Element *E = element_map.find(p_id);
 	const typename ElementMap::Element *E = element_map.find(p_id);
-	ERR_FAIL_COND_V(!E, NULL);
+	ERR_FAIL_COND_V(!E, nullptr);
 	return E->get().userdata;
 	return E->get().userdata;
 }
 }
 
 
@@ -527,7 +527,7 @@ OCTREE_FUNC(void)::_insert_element(Element *p_element, Octant *p_octant) {
 #endif
 #endif
 		p_element->octant_owners.push_back(owner);
 		p_element->octant_owners.push_back(owner);
 
 
-		if (p_element->common_parent == NULL) {
+		if (p_element->common_parent == nullptr) {
 			p_element->common_parent = p_octant;
 			p_element->common_parent = p_octant;
 			p_element->container_aabb = p_octant->aabb;
 			p_element->container_aabb = p_octant->aabb;
 		} else {
 		} else {
@@ -546,7 +546,7 @@ OCTREE_FUNC(void)::_insert_element(Element *p_element, Octant *p_octant) {
 	} else {
 	} else {
 		/* not big enough, send it to subitems */
 		/* not big enough, send it to subitems */
 		int splits = 0;
 		int splits = 0;
-		bool candidate = p_element->common_parent == NULL;
+		bool candidate = p_element->common_parent == nullptr;
 
 
 		for (int i = 0; i < 8; i++) {
 		for (int i = 0; i < 8; i++) {
 			if (p_octant->children[i]) {
 			if (p_octant->children[i]) {
@@ -629,7 +629,7 @@ OCTREE_FUNC(void)::_ensure_valid_root(const AABB &p_aabb) {
 
 
 		root = memnew_allocator(Octant, AL);
 		root = memnew_allocator(Octant, AL);
 
 
-		root->parent = NULL;
+		root->parent = nullptr;
 		root->parent_index = -1;
 		root->parent_index = -1;
 		root->aabb = base;
 		root->aabb = base;
 
 
@@ -705,11 +705,11 @@ OCTREE_FUNC(bool)::_remove_element_pair_and_remove_empty_octants(Element *p_elem
 
 
 			if (p_octant == root) { // won't have a parent, just erase
 			if (p_octant == root) { // won't have a parent, just erase
 
 
-				root = NULL;
+				root = nullptr;
 			} else {
 			} else {
 				ERR_FAIL_INDEX_V(p_octant->parent_index, 8, octant_removed);
 				ERR_FAIL_INDEX_V(p_octant->parent_index, 8, octant_removed);
 
 
-				parent->children[p_octant->parent_index] = NULL;
+				parent->children[p_octant->parent_index] = nullptr;
 				parent->children_count--;
 				parent->children_count--;
 			}
 			}
 
 
@@ -899,12 +899,12 @@ OCTREE_FUNC(void)::move(OctreeElementID p_id, const AABB &p_aabb) {
 	if (old_has_surf != new_has_surf) {
 	if (old_has_surf != new_has_surf) {
 		if (old_has_surf) {
 		if (old_has_surf) {
 			_remove_element(&e); // removing
 			_remove_element(&e); // removing
-			e.common_parent = NULL;
+			e.common_parent = nullptr;
 			e.aabb = AABB();
 			e.aabb = AABB();
 			_optimize();
 			_optimize();
 		} else {
 		} else {
 			_ensure_valid_root(p_aabb); // inserting
 			_ensure_valid_root(p_aabb); // inserting
-			e.common_parent = NULL;
+			e.common_parent = nullptr;
 			e.aabb = p_aabb;
 			e.aabb = p_aabb;
 			_insert_element(&e, root);
 			_insert_element(&e, root);
 			if (use_pairs)
 			if (use_pairs)
@@ -933,7 +933,7 @@ OCTREE_FUNC(void)::move(OctreeElementID p_id, const AABB &p_aabb) {
 	combined.merge_with(p_aabb);
 	combined.merge_with(p_aabb);
 	_ensure_valid_root(combined);
 	_ensure_valid_root(combined);
 
 
-	ERR_FAIL_COND(e.octant_owners.front() == NULL);
+	ERR_FAIL_COND(e.octant_owners.front() == nullptr);
 
 
 	/* FIND COMMON PARENT */
 	/* FIND COMMON PARENT */
 
 
@@ -951,7 +951,7 @@ OCTREE_FUNC(void)::move(OctreeElementID p_id, const AABB &p_aabb) {
 
 
 	//prepare for reinsert
 	//prepare for reinsert
 	e.octant_owners.clear();
 	e.octant_owners.clear();
-	e.common_parent = NULL;
+	e.common_parent = nullptr;
 	e.aabb = p_aabb;
 	e.aabb = p_aabb;
 
 
 	_insert_element(&e, common_parent); // reinsert from this point
 	_insert_element(&e, common_parent); // reinsert from this point
@@ -1018,7 +1018,7 @@ OCTREE_FUNC(void)::set_pairable(OctreeElementID p_id, bool p_pairable, uint32_t
 	e.pairable = p_pairable;
 	e.pairable = p_pairable;
 	e.pairable_type = p_pairable_type;
 	e.pairable_type = p_pairable_type;
 	e.pairable_mask = p_pairable_mask;
 	e.pairable_mask = p_pairable_mask;
-	e.common_parent = NULL;
+	e.common_parent = nullptr;
 
 
 	if (!e.aabb.has_no_surface()) {
 	if (!e.aabb.has_no_surface()) {
 		_ensure_valid_root(e.aabb);
 		_ensure_valid_root(e.aabb);
@@ -1577,16 +1577,16 @@ OCTREE_FUNC_CONSTRUCTOR::OCTREE_CLASS_NAME(real_t p_unit_size) {
 	last_element_id = 1;
 	last_element_id = 1;
 	pass = 1;
 	pass = 1;
 	unit_size = p_unit_size;
 	unit_size = p_unit_size;
-	root = NULL;
+	root = nullptr;
 
 
 	octant_count = 0;
 	octant_count = 0;
 	pair_count = 0;
 	pair_count = 0;
 	octant_elements_limit = OCTREE_DEFAULT_OCTANT_LIMIT;
 	octant_elements_limit = OCTREE_DEFAULT_OCTANT_LIMIT;
 
 
-	pair_callback = NULL;
-	unpair_callback = NULL;
-	pair_callback_userdata = NULL;
-	unpair_callback_userdata = NULL;
+	pair_callback = nullptr;
+	unpair_callback = nullptr;
+	pair_callback_userdata = nullptr;
+	unpair_callback_userdata = nullptr;
 }
 }
 
 
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED

+ 1 - 1
core/math/plane.h

@@ -56,7 +56,7 @@ public:
 
 
 	/* intersections */
 	/* intersections */
 
 
-	bool intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r_result = 0) const;
+	bool intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r_result = nullptr) const;
 	bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const;
 	bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const;
 	bool intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const;
 	bool intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const;
 
 

+ 3 - 3
core/math/quick_hull.cpp

@@ -370,7 +370,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
 			ERR_CONTINUE(!F);
 			ERR_CONTINUE(!F);
 			List<Geometry::MeshData::Face>::Element *O = F->get().left == E ? F->get().right : F->get().left;
 			List<Geometry::MeshData::Face>::Element *O = F->get().left == E ? F->get().right : F->get().left;
 			ERR_CONTINUE(O == E);
 			ERR_CONTINUE(O == E);
-			ERR_CONTINUE(O == NULL);
+			ERR_CONTINUE(O == nullptr);
 
 
 			if (O->get().plane.is_equal_approx(f.plane)) {
 			if (O->get().plane.is_equal_approx(f.plane)) {
 				//merge and delete edge and contiguous face, while repointing edges (uuugh!)
 				//merge and delete edge and contiguous face, while repointing edges (uuugh!)
@@ -410,10 +410,10 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
 				// remove all edge connections to this face
 				// remove all edge connections to this face
 				for (Map<Edge, RetFaceConnect>::Element *G = ret_edges.front(); G; G = G->next()) {
 				for (Map<Edge, RetFaceConnect>::Element *G = ret_edges.front(); G; G = G->next()) {
 					if (G->get().left == O)
 					if (G->get().left == O)
-						G->get().left = NULL;
+						G->get().left = nullptr;
 
 
 					if (G->get().right == O)
 					if (G->get().right == O)
-						G->get().right = NULL;
+						G->get().right = nullptr;
 				}
 				}
 
 
 				ret_edges.erase(F); //remove the edge
 				ret_edges.erase(F); //remove the edge

+ 4 - 4
core/math/quick_hull.h

@@ -72,15 +72,15 @@ private:
 	struct FaceConnect {
 	struct FaceConnect {
 		List<Face>::Element *left, *right;
 		List<Face>::Element *left, *right;
 		FaceConnect() {
 		FaceConnect() {
-			left = NULL;
-			right = NULL;
+			left = nullptr;
+			right = nullptr;
 		}
 		}
 	};
 	};
 	struct RetFaceConnect {
 	struct RetFaceConnect {
 		List<Geometry::MeshData::Face>::Element *left, *right;
 		List<Geometry::MeshData::Face>::Element *left, *right;
 		RetFaceConnect() {
 		RetFaceConnect() {
-			left = NULL;
-			right = NULL;
+			left = nullptr;
+			right = nullptr;
 		}
 		}
 	};
 	};
 
 

+ 1 - 1
core/math/rect2.h

@@ -103,7 +103,7 @@ struct Rect2 {
 
 
 	bool intersects_transformed(const Transform2D &p_xform, const Rect2 &p_rect) const;
 	bool intersects_transformed(const Transform2D &p_xform, const Rect2 &p_rect) const;
 
 
-	bool intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos = NULL, Point2 *r_normal = NULL) const;
+	bool intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos = nullptr, Point2 *r_normal = nullptr) const;
 
 
 	inline bool encloses(const Rect2 &p_rect) const {
 	inline bool encloses(const Rect2 &p_rect) const {
 		return (p_rect.position.x >= position.x) && (p_rect.position.y >= position.y) &&
 		return (p_rect.position.x >= position.x) && (p_rect.position.y >= position.y) &&

+ 6 - 6
core/message_queue.cpp

@@ -33,7 +33,7 @@
 #include "core/project_settings.h"
 #include "core/project_settings.h"
 #include "core/script_language.h"
 #include "core/script_language.h"
 
 
-MessageQueue *MessageQueue::singleton = NULL;
+MessageQueue *MessageQueue::singleton = nullptr;
 
 
 MessageQueue *MessageQueue::get_singleton() {
 MessageQueue *MessageQueue::get_singleton() {
 	return singleton;
 	return singleton;
@@ -163,7 +163,7 @@ void MessageQueue::statistics() {
 
 
 		Object *target = ObjectDB::get_instance(message->instance_id);
 		Object *target = ObjectDB::get_instance(message->instance_id);
 
 
-		if (target != NULL) {
+		if (target != nullptr) {
 			switch (message->type & FLAG_MASK) {
 			switch (message->type & FLAG_MASK) {
 				case TYPE_CALL: {
 				case TYPE_CALL: {
 					if (!call_count.has(message->target))
 					if (!call_count.has(message->target))
@@ -221,7 +221,7 @@ int MessageQueue::get_max_buffer_usage() const {
 }
 }
 
 
 void MessageQueue::_call_function(Object *p_target, const StringName &p_func, const Variant *p_args, int p_argcount, bool p_show_error) {
 void MessageQueue::_call_function(Object *p_target, const StringName &p_func, const Variant *p_args, int p_argcount, bool p_show_error) {
-	const Variant **argptrs = NULL;
+	const Variant **argptrs = nullptr;
 	if (p_argcount) {
 	if (p_argcount) {
 		argptrs = (const Variant **)alloca(sizeof(Variant *) * p_argcount);
 		argptrs = (const Variant **)alloca(sizeof(Variant *) * p_argcount);
 		for (int i = 0; i < p_argcount; i++) {
 		for (int i = 0; i < p_argcount; i++) {
@@ -265,7 +265,7 @@ void MessageQueue::flush() {
 
 
 		Object *target = ObjectDB::get_instance(message->instance_id);
 		Object *target = ObjectDB::get_instance(message->instance_id);
 
 
-		if (target != NULL) {
+		if (target != nullptr) {
 			switch (message->type & FLAG_MASK) {
 			switch (message->type & FLAG_MASK) {
 				case TYPE_CALL: {
 				case TYPE_CALL: {
 					Variant *args = (Variant *)(message + 1);
 					Variant *args = (Variant *)(message + 1);
@@ -311,7 +311,7 @@ bool MessageQueue::is_flushing() const {
 }
 }
 
 
 MessageQueue::MessageQueue() {
 MessageQueue::MessageQueue() {
-	ERR_FAIL_COND_MSG(singleton != NULL, "A MessageQueue singleton already exists.");
+	ERR_FAIL_COND_MSG(singleton != nullptr, "A MessageQueue singleton already exists.");
 	singleton = this;
 	singleton = this;
 	flushing = false;
 	flushing = false;
 
 
@@ -341,6 +341,6 @@ MessageQueue::~MessageQueue() {
 			read_pos += sizeof(Variant) * message->args;
 			read_pos += sizeof(Variant) * message->args;
 	}
 	}
 
 
-	singleton = NULL;
+	singleton = nullptr;
 	memdelete_arr(buffer);
 	memdelete_arr(buffer);
 }
 }

+ 1 - 1
core/method_bind.cpp

@@ -101,7 +101,7 @@ MethodBind::MethodBind() {
 	argument_count = 0;
 	argument_count = 0;
 	default_argument_count = 0;
 	default_argument_count = 0;
 #ifdef DEBUG_METHODS_ENABLED
 #ifdef DEBUG_METHODS_ENABLED
-	argument_types = NULL;
+	argument_types = nullptr;
 #endif
 #endif
 	_const = false;
 	_const = false;
 	_returns = false;
 	_returns = false;

+ 1 - 1
core/method_bind.h

@@ -367,7 +367,7 @@ public:
 	virtual bool is_vararg() const { return true; }
 	virtual bool is_vararg() const { return true; }
 
 
 	MethodBindVarArg() {
 	MethodBindVarArg() {
-		call_method = NULL;
+		call_method = nullptr;
 		_set_returns(true);
 		_set_returns(true);
 	}
 	}
 };
 };

+ 6 - 6
core/node_path.cpp

@@ -90,7 +90,7 @@ void NodePath::unref() {
 	if (data && data->refcount.unref()) {
 	if (data && data->refcount.unref()) {
 		memdelete(data);
 		memdelete(data);
 	}
 	}
-	data = NULL;
+	data = nullptr;
 }
 }
 
 
 bool NodePath::operator==(const NodePath &p_path) const {
 bool NodePath::operator==(const NodePath &p_path) const {
@@ -170,7 +170,7 @@ NodePath::operator String() const {
 }
 }
 
 
 NodePath::NodePath(const NodePath &p_path) {
 NodePath::NodePath(const NodePath &p_path) {
-	data = NULL;
+	data = nullptr;
 
 
 	if (p_path.data && p_path.data->refcount.ref()) {
 	if (p_path.data && p_path.data->refcount.ref()) {
 		data = p_path.data;
 		data = p_path.data;
@@ -260,7 +260,7 @@ NodePath NodePath::get_as_property_path() const {
 }
 }
 
 
 NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
 NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
-	data = NULL;
+	data = nullptr;
 
 
 	if (p_path.size() == 0)
 	if (p_path.size() == 0)
 		return;
 		return;
@@ -274,7 +274,7 @@ NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
 }
 }
 
 
 NodePath::NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p_subpath, bool p_absolute) {
 NodePath::NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p_subpath, bool p_absolute) {
-	data = NULL;
+	data = nullptr;
 
 
 	if (p_path.size() == 0 && p_subpath.size() == 0)
 	if (p_path.size() == 0 && p_subpath.size() == 0)
 		return;
 		return;
@@ -318,7 +318,7 @@ NodePath NodePath::simplified() const {
 }
 }
 
 
 NodePath::NodePath(const String &p_path) {
 NodePath::NodePath(const String &p_path) {
-	data = NULL;
+	data = nullptr;
 
 
 	if (p_path.length() == 0)
 	if (p_path.length() == 0)
 		return;
 		return;
@@ -401,7 +401,7 @@ bool NodePath::is_empty() const {
 	return !data;
 	return !data;
 }
 }
 NodePath::NodePath() {
 NodePath::NodePath() {
-	data = NULL;
+	data = nullptr;
 }
 }
 
 
 NodePath::~NodePath() {
 NodePath::~NodePath() {

+ 2 - 2
core/oa_hash_map.h

@@ -305,8 +305,8 @@ public:
 		Iterator it;
 		Iterator it;
 		it.valid = false;
 		it.valid = false;
 		it.pos = p_iter.pos;
 		it.pos = p_iter.pos;
-		it.key = NULL;
-		it.value = NULL;
+		it.key = nullptr;
+		it.value = nullptr;
 
 
 		for (uint32_t i = it.pos; i < capacity; i++) {
 		for (uint32_t i = it.pos; i < capacity; i++) {
 			it.pos = i + 1;
 			it.pos = i + 1;

+ 23 - 23
core/object.cpp

@@ -371,7 +371,7 @@ bool Object::_predelete() {
 	_predelete_ok = 1;
 	_predelete_ok = 1;
 	notification(NOTIFICATION_PREDELETE, true);
 	notification(NOTIFICATION_PREDELETE, true);
 	if (_predelete_ok) {
 	if (_predelete_ok) {
-		_class_ptr = NULL; //must restore so destructors can access class ptr correctly
+		_class_ptr = nullptr; //must restore so destructors can access class ptr correctly
 	}
 	}
 	return _predelete_ok;
 	return _predelete_ok;
 }
 }
@@ -763,7 +763,7 @@ bool Object::has_method(const StringName &p_method) const {
 
 
 	MethodBind *method = ClassDB::get_method(get_class_name(), p_method);
 	MethodBind *method = ClassDB::get_method(get_class_name(), p_method);
 
 
-	return method != NULL;
+	return method != nullptr;
 }
 }
 
 
 Variant Object::getvar(const Variant &p_key, bool *r_valid) const {
 Variant Object::getvar(const Variant &p_key, bool *r_valid) const {
@@ -777,7 +777,7 @@ void Object::setvar(const Variant &p_key, const Variant &p_value, bool *r_valid)
 }
 }
 
 
 Variant Object::callv(const StringName &p_method, const Array &p_args) {
 Variant Object::callv(const StringName &p_method, const Array &p_args) {
-	const Variant **argptrs = NULL;
+	const Variant **argptrs = nullptr;
 
 
 	if (p_args.size() > 0) {
 	if (p_args.size() > 0) {
 		argptrs = (const Variant **)alloca(sizeof(Variant *) * p_args.size());
 		argptrs = (const Variant **)alloca(sizeof(Variant *) * p_args.size());
@@ -955,7 +955,7 @@ void Object::set_script_and_instance(const RefPtr &p_script, ScriptInstance *p_i
 	//this function is not meant to be used in any of these ways
 	//this function is not meant to be used in any of these ways
 	ERR_FAIL_COND(p_script.is_null());
 	ERR_FAIL_COND(p_script.is_null());
 	ERR_FAIL_COND(!p_instance);
 	ERR_FAIL_COND(!p_instance);
-	ERR_FAIL_COND(script_instance != NULL || !script.is_null());
+	ERR_FAIL_COND(script_instance != nullptr || !script.is_null());
 
 
 	script = p_script;
 	script = p_script;
 	script_instance = p_instance;
 	script_instance = p_instance;
@@ -967,7 +967,7 @@ void Object::set_script(const RefPtr &p_script) {
 
 
 	if (script_instance) {
 	if (script_instance) {
 		memdelete(script_instance);
 		memdelete(script_instance);
-		script_instance = NULL;
+		script_instance = nullptr;
 	}
 	}
 
 
 	script = p_script;
 	script = p_script;
@@ -1103,7 +1103,7 @@ Variant Object::_emit_signal(const Variant **p_args, int p_argcount, Variant::Ca
 
 
 	StringName signal = *p_args[0];
 	StringName signal = *p_args[0];
 
 
-	const Variant **args = NULL;
+	const Variant **args = nullptr;
 
 
 	int argc = p_argcount - 1;
 	int argc = p_argcount - 1;
 	if (argc) {
 	if (argc) {
@@ -1334,7 +1334,7 @@ void Object::get_signal_list(List<MethodInfo> *p_signals) const {
 
 
 	ClassDB::get_signal_list(get_class_name(), p_signals);
 	ClassDB::get_signal_list(get_class_name(), p_signals);
 	//find maybe usersignals?
 	//find maybe usersignals?
-	const StringName *S = NULL;
+	const StringName *S = nullptr;
 
 
 	while ((S = signal_map.next(S))) {
 	while ((S = signal_map.next(S))) {
 		if (signal_map[*S].user.name != "") {
 		if (signal_map[*S].user.name != "") {
@@ -1345,7 +1345,7 @@ void Object::get_signal_list(List<MethodInfo> *p_signals) const {
 }
 }
 
 
 void Object::get_all_signal_connections(List<Connection> *p_connections) const {
 void Object::get_all_signal_connections(List<Connection> *p_connections) const {
-	const StringName *S = NULL;
+	const StringName *S = nullptr;
 
 
 	while ((S = signal_map.next(S))) {
 	while ((S = signal_map.next(S))) {
 		const Signal *s = &signal_map[*S];
 		const Signal *s = &signal_map[*S];
@@ -1367,7 +1367,7 @@ void Object::get_signal_connection_list(const StringName &p_signal, List<Connect
 
 
 int Object::get_persistent_signal_connection_count() const {
 int Object::get_persistent_signal_connection_count() const {
 	int count = 0;
 	int count = 0;
-	const StringName *S = NULL;
+	const StringName *S = nullptr;
 
 
 	while ((S = signal_map.next(S))) {
 	while ((S = signal_map.next(S))) {
 		const Signal *s = &signal_map[*S];
 		const Signal *s = &signal_map[*S];
@@ -1771,7 +1771,7 @@ Variant::Type Object::get_static_property_type_indexed(const Vector<StringName>
 	}
 	}
 
 
 	Variant::CallError ce;
 	Variant::CallError ce;
-	Variant check = Variant::construct(t, NULL, 0, ce);
+	Variant check = Variant::construct(t, nullptr, 0, ce);
 
 
 	for (int i = 1; i < p_path.size(); i++) {
 	for (int i = 1; i < p_path.size(); i++) {
 		if (check.get_type() == Variant::OBJECT || check.get_type() == Variant::DICTIONARY || check.get_type() == Variant::ARRAY) {
 		if (check.get_type() == Variant::OBJECT || check.get_type() == Variant::DICTIONARY || check.get_type() == Variant::ARRAY) {
@@ -1817,7 +1817,7 @@ uint32_t Object::get_edited_version() const {
 
 
 void *Object::get_script_instance_binding(int p_script_language_index) {
 void *Object::get_script_instance_binding(int p_script_language_index) {
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
-	ERR_FAIL_INDEX_V(p_script_language_index, MAX_SCRIPT_INSTANCE_BINDINGS, NULL);
+	ERR_FAIL_INDEX_V(p_script_language_index, MAX_SCRIPT_INSTANCE_BINDINGS, nullptr);
 #endif
 #endif
 
 
 	//it's up to the script language to make this thread safe, if the function is called twice due to threads being out of syncro
 	//it's up to the script language to make this thread safe, if the function is called twice due to threads being out of syncro
@@ -1837,18 +1837,18 @@ void *Object::get_script_instance_binding(int p_script_language_index) {
 }
 }
 
 
 bool Object::has_script_instance_binding(int p_script_language_index) {
 bool Object::has_script_instance_binding(int p_script_language_index) {
-	return _script_instance_bindings[p_script_language_index] != NULL;
+	return _script_instance_bindings[p_script_language_index] != nullptr;
 }
 }
 
 
 void Object::set_script_instance_binding(int p_script_language_index, void *p_data) {
 void Object::set_script_instance_binding(int p_script_language_index, void *p_data) {
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
-	CRASH_COND(_script_instance_bindings[p_script_language_index] != NULL);
+	CRASH_COND(_script_instance_bindings[p_script_language_index] != nullptr);
 #endif
 #endif
 	_script_instance_bindings[p_script_language_index] = p_data;
 	_script_instance_bindings[p_script_language_index] = p_data;
 }
 }
 
 
 Object::Object() {
 Object::Object() {
-	_class_ptr = NULL;
+	_class_ptr = nullptr;
 	_block_signals = false;
 	_block_signals = false;
 	_predelete_ok = 0;
 	_predelete_ok = 0;
 	_instance_id = 0;
 	_instance_id = 0;
@@ -1857,7 +1857,7 @@ Object::Object() {
 	_is_queued_for_deletion = false;
 	_is_queued_for_deletion = false;
 	_emitting = false;
 	_emitting = false;
 	memset(_script_instance_bindings, 0, sizeof(void *) * MAX_SCRIPT_INSTANCE_BINDINGS);
 	memset(_script_instance_bindings, 0, sizeof(void *) * MAX_SCRIPT_INSTANCE_BINDINGS);
-	script_instance = NULL;
+	script_instance = nullptr;
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
 	_rc.store(nullptr, std::memory_order_release);
 	_rc.store(nullptr, std::memory_order_release);
 #endif
 #endif
@@ -1884,16 +1884,16 @@ Object::~Object() {
 
 
 	if (script_instance)
 	if (script_instance)
 		memdelete(script_instance);
 		memdelete(script_instance);
-	script_instance = NULL;
+	script_instance = nullptr;
 
 
-	const StringName *S = NULL;
+	const StringName *S = nullptr;
 
 
 	if (_emitting) {
 	if (_emitting) {
 		//@todo this may need to actually reach the debugger prioritarily somehow because it may crash before
 		//@todo this may need to actually reach the debugger prioritarily somehow because it may crash before
 		ERR_PRINTS("Object " + to_string() + " was freed or unreferenced while a signal is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes.");
 		ERR_PRINTS("Object " + to_string() + " was freed or unreferenced while a signal is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes.");
 	}
 	}
 
 
-	while ((S = signal_map.next(NULL))) {
+	while ((S = signal_map.next(nullptr))) {
 		Signal *s = &signal_map[*S];
 		Signal *s = &signal_map[*S];
 
 
 		//brute force disconnect for performance
 		//brute force disconnect for performance
@@ -1964,14 +1964,14 @@ Object *ObjectDB::get_instance(ObjectID p_instance_id) {
 	rw_lock.read_unlock();
 	rw_lock.read_unlock();
 
 
 	if (!obj)
 	if (!obj)
-		return NULL;
+		return nullptr;
 	return *obj;
 	return *obj;
 }
 }
 
 
 void ObjectDB::debug_objects(DebugFunc p_func) {
 void ObjectDB::debug_objects(DebugFunc p_func) {
 	rw_lock.read_lock();
 	rw_lock.read_lock();
 
 
-	const ObjectID *K = NULL;
+	const ObjectID *K = nullptr;
 	while ((K = instances.next(K))) {
 	while ((K = instances.next(K))) {
 		p_func(instances[*K]);
 		p_func(instances[*K]);
 	}
 	}
@@ -2004,13 +2004,13 @@ void ObjectDB::cleanup() {
 			MethodBind *resource_get_path = ClassDB::get_method("Resource", "get_path");
 			MethodBind *resource_get_path = ClassDB::get_method("Resource", "get_path");
 			Variant::CallError call_error;
 			Variant::CallError call_error;
 
 
-			const ObjectID *K = NULL;
+			const ObjectID *K = nullptr;
 			while ((K = instances.next(K))) {
 			while ((K = instances.next(K))) {
 				String extra_info;
 				String extra_info;
 				if (instances[*K]->is_class("Node"))
 				if (instances[*K]->is_class("Node"))
-					extra_info = " - Node name: " + String(node_get_name->call(instances[*K], NULL, 0, call_error));
+					extra_info = " - Node name: " + String(node_get_name->call(instances[*K], nullptr, 0, call_error));
 				if (instances[*K]->is_class("Resource"))
 				if (instances[*K]->is_class("Resource"))
-					extra_info = " - Resource path: " + String(resource_get_path->call(instances[*K], NULL, 0, call_error));
+					extra_info = " - Resource path: " + String(resource_get_path->call(instances[*K], nullptr, 0, call_error));
 				print_line("Leaked instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + extra_info);
 				print_line("Leaked instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + extra_info);
 			}
 			}
 			print_line("Hint: Leaked instances typically happen when nodes are removed from the scene tree (with `remove_child()`) but not freed (with `free()` or `queue_free()`).");
 			print_line("Hint: Leaked instances typically happen when nodes are removed from the scene tree (with `remove_child()`) but not freed (with `free()` or `queue_free()`).");

+ 10 - 10
core/object.h

@@ -423,8 +423,8 @@ public:
 
 
 		operator Variant() const;
 		operator Variant() const;
 		Connection() {
 		Connection() {
-			source = NULL;
-			target = NULL;
+			source = nullptr;
+			target = nullptr;
 			flags = 0;
 			flags = 0;
 		}
 		}
 		Connection(const Variant &p_variant);
 		Connection(const Variant &p_variant);
@@ -659,10 +659,10 @@ public:
 	//void set(const String& p_name, const Variant& p_value);
 	//void set(const String& p_name, const Variant& p_value);
 	//Variant get(const String& p_name) const;
 	//Variant get(const String& p_name) const;
 
 
-	void set(const StringName &p_name, const Variant &p_value, bool *r_valid = NULL);
-	Variant get(const StringName &p_name, bool *r_valid = NULL) const;
-	void set_indexed(const Vector<StringName> &p_names, const Variant &p_value, bool *r_valid = NULL);
-	Variant get_indexed(const Vector<StringName> &p_names, bool *r_valid = NULL) const;
+	void set(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr);
+	Variant get(const StringName &p_name, bool *r_valid = nullptr) const;
+	void set_indexed(const Vector<StringName> &p_names, const Variant &p_value, bool *r_valid = nullptr);
+	Variant get_indexed(const Vector<StringName> &p_names, bool *r_valid = nullptr) const;
 
 
 	void get_property_list(List<PropertyInfo> *p_list, bool p_reversed = false) const;
 	void get_property_list(List<PropertyInfo> *p_list, bool p_reversed = false) const;
 
 
@@ -679,8 +679,8 @@ public:
 	virtual String to_string();
 	virtual String to_string();
 
 
 	//used mainly by script, get and set all INCLUDING string
 	//used mainly by script, get and set all INCLUDING string
-	virtual Variant getvar(const Variant &p_key, bool *r_valid = NULL) const;
-	virtual void setvar(const Variant &p_key, const Variant &p_value, bool *r_valid = NULL);
+	virtual Variant getvar(const Variant &p_key, bool *r_valid = nullptr) const;
+	virtual void setvar(const Variant &p_key, const Variant &p_value, bool *r_valid = nullptr);
 
 
 	/* SCRIPT */
 	/* SCRIPT */
 
 
@@ -726,8 +726,8 @@ public:
 	void set_block_signals(bool p_block);
 	void set_block_signals(bool p_block);
 	bool is_blocking_signals() const;
 	bool is_blocking_signals() const;
 
 
-	Variant::Type get_static_property_type(const StringName &p_property, bool *r_valid = NULL) const;
-	Variant::Type get_static_property_type_indexed(const Vector<StringName> &p_path, bool *r_valid = NULL) const;
+	Variant::Type get_static_property_type(const StringName &p_property, bool *r_valid = nullptr) const;
+	Variant::Type get_static_property_type_indexed(const Vector<StringName> &p_path, bool *r_valid = nullptr) const;
 
 
 	virtual void get_translatable_strings(List<String> *p_strings) const;
 	virtual void get_translatable_strings(List<String> *p_strings) const;
 
 

+ 9 - 9
core/ordered_hash_map.h

@@ -70,9 +70,9 @@ public:
 
 
 	public:
 	public:
 		_FORCE_INLINE_ Element() :
 		_FORCE_INLINE_ Element() :
-				list_element(NULL),
-				prev_element(NULL),
-				next_element(NULL) {
+				list_element(nullptr),
+				prev_element(nullptr),
+				next_element(nullptr) {
 		}
 		}
 
 
 		Element next() const {
 		Element next() const {
@@ -104,7 +104,7 @@ public:
 		}
 		}
 
 
 		operator bool() const {
 		operator bool() const {
-			return (list_element != NULL);
+			return (list_element != nullptr);
 		}
 		}
 
 
 		const K &key() const {
 		const K &key() const {
@@ -157,7 +157,7 @@ public:
 		}
 		}
 
 
 		ConstElement next() const {
 		ConstElement next() const {
-			return ConstElement(list_element ? list_element->next() : NULL);
+			return ConstElement(list_element ? list_element->next() : nullptr);
 		}
 		}
 
 
 		ConstElement prev() const {
 		ConstElement prev() const {
@@ -172,7 +172,7 @@ public:
 		}
 		}
 
 
 		operator bool() const {
 		operator bool() const {
-			return (list_element != NULL);
+			return (list_element != nullptr);
 		}
 		}
 
 
 		const K &key() const {
 		const K &key() const {
@@ -196,7 +196,7 @@ public:
 		if (list_element) {
 		if (list_element) {
 			return ConstElement(*list_element);
 			return ConstElement(*list_element);
 		}
 		}
-		return ConstElement(NULL);
+		return ConstElement(nullptr);
 	}
 	}
 
 
 	Element find(const K &p_key) {
 	Element find(const K &p_key) {
@@ -204,7 +204,7 @@ public:
 		if (list_element) {
 		if (list_element) {
 			return Element(*list_element);
 			return Element(*list_element);
 		}
 		}
-		return Element(NULL);
+		return Element(nullptr);
 	}
 	}
 
 
 	Element insert(const K &p_key, const V &p_value) {
 	Element insert(const K &p_key, const V &p_value) {
@@ -223,7 +223,7 @@ public:
 	void erase(Element &p_element) {
 	void erase(Element &p_element) {
 		map.erase(p_element.key());
 		map.erase(p_element.key());
 		list.erase(p_element.list_element);
 		list.erase(p_element.list_element);
-		p_element.list_element = NULL;
+		p_element.list_element = nullptr;
 	}
 	}
 
 
 	bool erase(const K &p_key) {
 	bool erase(const K &p_key) {

+ 5 - 5
core/os/dir_access.cpp

@@ -212,10 +212,10 @@ String DirAccess::fix_path(String p_path) const {
 	return p_path;
 	return p_path;
 }
 }
 
 
-DirAccess::CreateFunc DirAccess::create_func[ACCESS_MAX] = { 0, 0, 0 };
+DirAccess::CreateFunc DirAccess::create_func[ACCESS_MAX] = { nullptr, nullptr, nullptr };
 
 
 DirAccess *DirAccess::create_for_path(const String &p_path) {
 DirAccess *DirAccess::create_for_path(const String &p_path) {
-	DirAccess *da = NULL;
+	DirAccess *da = nullptr;
 	if (p_path.begins_with("res://")) {
 	if (p_path.begins_with("res://")) {
 		da = create(ACCESS_RESOURCES);
 		da = create(ACCESS_RESOURCES);
 	} else if (p_path.begins_with("user://")) {
 	} else if (p_path.begins_with("user://")) {
@@ -230,20 +230,20 @@ DirAccess *DirAccess::create_for_path(const String &p_path) {
 DirAccess *DirAccess::open(const String &p_path, Error *r_error) {
 DirAccess *DirAccess::open(const String &p_path, Error *r_error) {
 	DirAccess *da = create_for_path(p_path);
 	DirAccess *da = create_for_path(p_path);
 
 
-	ERR_FAIL_COND_V_MSG(!da, NULL, "Cannot create DirAccess for path '" + p_path + "'.");
+	ERR_FAIL_COND_V_MSG(!da, nullptr, "Cannot create DirAccess for path '" + p_path + "'.");
 	Error err = da->change_dir(p_path);
 	Error err = da->change_dir(p_path);
 	if (r_error)
 	if (r_error)
 		*r_error = err;
 		*r_error = err;
 	if (err != OK) {
 	if (err != OK) {
 		memdelete(da);
 		memdelete(da);
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	return da;
 	return da;
 }
 }
 
 
 DirAccess *DirAccess::create(AccessType p_access) {
 DirAccess *DirAccess::create(AccessType p_access) {
-	DirAccess *da = create_func[p_access] ? create_func[p_access]() : NULL;
+	DirAccess *da = create_func[p_access] ? create_func[p_access]() : nullptr;
 	if (da) {
 	if (da) {
 		da->_access_type = p_access;
 		da->_access_type = p_access;
 	}
 	}

+ 2 - 2
core/os/dir_access.h

@@ -127,7 +127,7 @@ public:
 		create_func[p_access] = _create_builtin<T>;
 		create_func[p_access] = _create_builtin<T>;
 	}
 	}
 
 
-	static DirAccess *open(const String &p_path, Error *r_error = NULL);
+	static DirAccess *open(const String &p_path, Error *r_error = nullptr);
 
 
 	DirAccess();
 	DirAccess();
 	virtual ~DirAccess();
 	virtual ~DirAccess();
@@ -138,7 +138,7 @@ struct DirAccessRef {
 		return f;
 		return f;
 	}
 	}
 
 
-	operator bool() const { return f != NULL; }
+	operator bool() const { return f != nullptr; }
 	DirAccess *f;
 	DirAccess *f;
 	DirAccessRef(DirAccess *fa) { f = fa; }
 	DirAccessRef(DirAccess *fa) { f = fa; }
 	~DirAccessRef() {
 	~DirAccessRef() {

+ 6 - 6
core/os/file_access.cpp

@@ -36,14 +36,14 @@
 #include "core/os/os.h"
 #include "core/os/os.h"
 #include "core/project_settings.h"
 #include "core/project_settings.h"
 
 
-FileAccess::CreateFunc FileAccess::create_func[ACCESS_MAX] = { 0, 0 };
+FileAccess::CreateFunc FileAccess::create_func[ACCESS_MAX] = { nullptr, nullptr };
 
 
-FileAccess::FileCloseFailNotify FileAccess::close_fail_notify = NULL;
+FileAccess::FileCloseFailNotify FileAccess::close_fail_notify = nullptr;
 
 
 bool FileAccess::backup_save = false;
 bool FileAccess::backup_save = false;
 
 
 FileAccess *FileAccess::create(AccessType p_access) {
 FileAccess *FileAccess::create(AccessType p_access) {
-	ERR_FAIL_INDEX_V(p_access, ACCESS_MAX, 0);
+	ERR_FAIL_INDEX_V(p_access, ACCESS_MAX, nullptr);
 
 
 	FileAccess *ret = create_func[p_access]();
 	FileAccess *ret = create_func[p_access]();
 	ret->_set_access_type(p_access);
 	ret->_set_access_type(p_access);
@@ -66,7 +66,7 @@ void FileAccess::_set_access_type(AccessType p_access) {
 };
 };
 
 
 FileAccess *FileAccess::create_for_path(const String &p_path) {
 FileAccess *FileAccess::create_for_path(const String &p_path) {
-	FileAccess *ret = NULL;
+	FileAccess *ret = nullptr;
 	if (p_path.begins_with("res://")) {
 	if (p_path.begins_with("res://")) {
 		ret = create(ACCESS_RESOURCES);
 		ret = create(ACCESS_RESOURCES);
 	} else if (p_path.begins_with("user://")) {
 	} else if (p_path.begins_with("user://")) {
@@ -86,7 +86,7 @@ Error FileAccess::reopen(const String &p_path, int p_mode_flags) {
 FileAccess *FileAccess::open(const String &p_path, int p_mode_flags, Error *r_error) {
 FileAccess *FileAccess::open(const String &p_path, int p_mode_flags, Error *r_error) {
 	//try packed data first
 	//try packed data first
 
 
-	FileAccess *ret = NULL;
+	FileAccess *ret = nullptr;
 	if (!(p_mode_flags & WRITE) && PackedData::get_singleton() && !PackedData::get_singleton()->is_disabled()) {
 	if (!(p_mode_flags & WRITE) && PackedData::get_singleton() && !PackedData::get_singleton()->is_disabled()) {
 		ret = PackedData::get_singleton()->try_open_path(p_path);
 		ret = PackedData::get_singleton()->try_open_path(p_path);
 		if (ret) {
 		if (ret) {
@@ -103,7 +103,7 @@ FileAccess *FileAccess::open(const String &p_path, int p_mode_flags, Error *r_er
 		*r_error = err;
 		*r_error = err;
 	if (err != OK) {
 	if (err != OK) {
 		memdelete(ret);
 		memdelete(ret);
-		ret = NULL;
+		ret = nullptr;
 	}
 	}
 
 
 	return ret;
 	return ret;

+ 4 - 4
core/os/file_access.h

@@ -151,7 +151,7 @@ public:
 
 
 	static FileAccess *create(AccessType p_access); /// Create a file access (for the current platform) this is the only portable way of accessing files.
 	static FileAccess *create(AccessType p_access); /// Create a file access (for the current platform) this is the only portable way of accessing files.
 	static FileAccess *create_for_path(const String &p_path);
 	static FileAccess *create_for_path(const String &p_path);
-	static FileAccess *open(const String &p_path, int p_mode_flags, Error *r_error = NULL); /// Create a file access (for the current platform) this is the only portable way of accessing files.
+	static FileAccess *open(const String &p_path, int p_mode_flags, Error *r_error = nullptr); /// Create a file access (for the current platform) this is the only portable way of accessing files.
 	static CreateFunc get_create_func(AccessType p_access);
 	static CreateFunc get_create_func(AccessType p_access);
 	static bool exists(const String &p_name); ///< return true if a file exists
 	static bool exists(const String &p_name); ///< return true if a file exists
 	static uint64_t get_modified_time(const String &p_file);
 	static uint64_t get_modified_time(const String &p_file);
@@ -165,8 +165,8 @@ public:
 	static String get_sha256(const String &p_file);
 	static String get_sha256(const String &p_file);
 	static String get_multiple_md5(const Vector<String> &p_file);
 	static String get_multiple_md5(const Vector<String> &p_file);
 
 
-	static Vector<uint8_t> get_file_as_array(const String &p_path, Error *r_error = NULL);
-	static String get_file_as_string(const String &p_path, Error *r_error = NULL);
+	static Vector<uint8_t> get_file_as_array(const String &p_path, Error *r_error = nullptr);
+	static String get_file_as_string(const String &p_path, Error *r_error = nullptr);
 
 
 	template <class T>
 	template <class T>
 	static void make_default(AccessType p_access) {
 	static void make_default(AccessType p_access) {
@@ -182,7 +182,7 @@ struct FileAccessRef {
 		return f;
 		return f;
 	}
 	}
 
 
-	operator bool() const { return f != NULL; }
+	operator bool() const { return f != nullptr; }
 	FileAccess *f;
 	FileAccess *f;
 	operator FileAccess *() { return f; }
 	operator FileAccess *() { return f; }
 	FileAccessRef(FileAccess *fa) { f = fa; }
 	FileAccessRef(FileAccess *fa) { f = fa; }

+ 1 - 1
core/os/input.cpp

@@ -38,7 +38,7 @@
 #include "editor/editor_settings.h"
 #include "editor/editor_settings.h"
 #endif
 #endif
 
 
-Input *Input::singleton = NULL;
+Input *Input::singleton = nullptr;
 
 
 Input *Input::get_singleton() {
 Input *Input::get_singleton() {
 	return singleton;
 	return singleton;

+ 14 - 14
core/os/input_event.cpp

@@ -274,10 +274,10 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool *p_pressed
 
 
 	bool match = get_scancode() == key->get_scancode() && (!key->is_pressed() || (code & event_code) == code);
 	bool match = get_scancode() == key->get_scancode() && (!key->is_pressed() || (code & event_code) == code);
 	if (match) {
 	if (match) {
-		if (p_pressed != NULL)
+		if (p_pressed != nullptr)
 			*p_pressed = key->is_pressed();
 			*p_pressed = key->is_pressed();
-		if (p_strength != NULL)
-			*p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
+		if (p_strength != nullptr)
+			*p_strength = (p_pressed != nullptr && *p_pressed) ? 1.0f : 0.0f;
 	}
 	}
 	return match;
 	return match;
 }
 }
@@ -422,10 +422,10 @@ bool InputEventMouseButton::action_match(const Ref<InputEvent> &p_event, bool *p
 
 
 	bool match = mb->button_index == button_index;
 	bool match = mb->button_index == button_index;
 	if (match) {
 	if (match) {
-		if (p_pressed != NULL)
+		if (p_pressed != nullptr)
 			*p_pressed = mb->is_pressed();
 			*p_pressed = mb->is_pressed();
-		if (p_strength != NULL)
-			*p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
+		if (p_strength != nullptr)
+			*p_strength = (p_pressed != nullptr && *p_pressed) ? 1.0f : 0.0f;
 	}
 	}
 
 
 	return match;
 	return match;
@@ -669,9 +669,9 @@ bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event, bool *
 	if (match) {
 	if (match) {
 		bool same_direction = (((axis_value < 0) == (jm->axis_value < 0)) || jm->axis_value == 0);
 		bool same_direction = (((axis_value < 0) == (jm->axis_value < 0)) || jm->axis_value == 0);
 		bool pressed = same_direction ? Math::abs(jm->get_axis_value()) >= p_deadzone : false;
 		bool pressed = same_direction ? Math::abs(jm->get_axis_value()) >= p_deadzone : false;
-		if (p_pressed != NULL)
+		if (p_pressed != nullptr)
 			*p_pressed = pressed;
 			*p_pressed = pressed;
-		if (p_strength != NULL) {
+		if (p_strength != nullptr) {
 			if (pressed) {
 			if (pressed) {
 				if (p_deadzone == 1.0f) {
 				if (p_deadzone == 1.0f) {
 					*p_strength = 1.0f;
 					*p_strength = 1.0f;
@@ -736,10 +736,10 @@ bool InputEventJoypadButton::action_match(const Ref<InputEvent> &p_event, bool *
 
 
 	bool match = button_index == jb->button_index;
 	bool match = button_index == jb->button_index;
 	if (match) {
 	if (match) {
-		if (p_pressed != NULL)
+		if (p_pressed != nullptr)
 			*p_pressed = jb->is_pressed();
 			*p_pressed = jb->is_pressed();
-		if (p_strength != NULL)
-			*p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
+		if (p_strength != nullptr)
+			*p_strength = (p_pressed != nullptr && *p_pressed) ? 1.0f : 0.0f;
 	}
 	}
 
 
 	return match;
 	return match;
@@ -950,10 +950,10 @@ bool InputEventAction::action_match(const Ref<InputEvent> &p_event, bool *p_pres
 
 
 	bool match = action == act->action;
 	bool match = action == act->action;
 	if (match) {
 	if (match) {
-		if (p_pressed != NULL)
+		if (p_pressed != nullptr)
 			*p_pressed = act->pressed;
 			*p_pressed = act->pressed;
-		if (p_strength != NULL)
-			*p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
+		if (p_strength != nullptr)
+			*p_strength = (p_pressed != nullptr && *p_pressed) ? 1.0f : 0.0f;
 	}
 	}
 	return match;
 	return match;
 }
 }

+ 1 - 1
core/os/keyboard.cpp

@@ -288,7 +288,7 @@ static const _KeyCodeText _keycodes[] = {
 
 
 		{KEY_DIVISION                      ,"Division"},
 		{KEY_DIVISION                      ,"Division"},
 		{KEY_YDIAERESIS                    ,"Ydiaeresis"},
 		{KEY_YDIAERESIS                    ,"Ydiaeresis"},
-		{0                                 ,0}
+		{0                                 ,nullptr}
 	/* clang-format on */
 	/* clang-format on */
 };
 };
 
 

+ 6 - 6
core/os/memory.cpp

@@ -74,7 +74,7 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
 
 
 	void *mem = malloc(p_bytes + (prepad ? PAD_ALIGN : 0));
 	void *mem = malloc(p_bytes + (prepad ? PAD_ALIGN : 0));
 
 
-	ERR_FAIL_COND_V(!mem, NULL);
+	ERR_FAIL_COND_V(!mem, nullptr);
 
 
 	alloc_count.increment();
 	alloc_count.increment();
 
 
@@ -95,7 +95,7 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
 }
 }
 
 
 void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
 void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
-	if (p_memory == NULL) {
+	if (p_memory == nullptr) {
 		return alloc_static(p_bytes, p_pad_align);
 		return alloc_static(p_bytes, p_pad_align);
 	}
 	}
 
 
@@ -122,12 +122,12 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
 
 
 		if (p_bytes == 0) {
 		if (p_bytes == 0) {
 			free(mem);
 			free(mem);
-			return NULL;
+			return nullptr;
 		} else {
 		} else {
 			*s = p_bytes;
 			*s = p_bytes;
 
 
 			mem = (uint8_t *)realloc(mem, p_bytes + PAD_ALIGN);
 			mem = (uint8_t *)realloc(mem, p_bytes + PAD_ALIGN);
-			ERR_FAIL_COND_V(!mem, NULL);
+			ERR_FAIL_COND_V(!mem, nullptr);
 
 
 			s = (uint64_t *)mem;
 			s = (uint64_t *)mem;
 
 
@@ -138,14 +138,14 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
 	} else {
 	} else {
 		mem = (uint8_t *)realloc(mem, p_bytes);
 		mem = (uint8_t *)realloc(mem, p_bytes);
 
 
-		ERR_FAIL_COND_V(mem == NULL && p_bytes > 0, NULL);
+		ERR_FAIL_COND_V(mem == nullptr && p_bytes > 0, nullptr);
 
 
 		return mem;
 		return mem;
 	}
 	}
 }
 }
 
 
 void Memory::free_static(void *p_ptr, bool p_pad_align) {
 void Memory::free_static(void *p_ptr, bool p_pad_align) {
-	ERR_FAIL_COND(p_ptr == NULL);
+	ERR_FAIL_COND(p_ptr == nullptr);
 
 
 	uint8_t *mem = (uint8_t *)p_ptr;
 	uint8_t *mem = (uint8_t *)p_ptr;
 
 

+ 2 - 2
core/os/memory.h

@@ -137,13 +137,13 @@ void memdelete_allocator(T *p_class) {
 template <typename T>
 template <typename T>
 T *memnew_arr_template(size_t p_elements, const char *p_descr = "") {
 T *memnew_arr_template(size_t p_elements, const char *p_descr = "") {
 	if (p_elements == 0)
 	if (p_elements == 0)
-		return 0;
+		return nullptr;
 	/** overloading operator new[] cannot be done , because it may not return the real allocated address (it may pad the 'element count' before the actual array). Because of that, it must be done by hand. This is the
 	/** overloading operator new[] cannot be done , because it may not return the real allocated address (it may pad the 'element count' before the actual array). Because of that, it must be done by hand. This is the
 	same strategy used by std::vector, and the PoolVector class, so it should be safe.*/
 	same strategy used by std::vector, and the PoolVector class, so it should be safe.*/
 
 
 	size_t len = sizeof(T) * p_elements;
 	size_t len = sizeof(T) * p_elements;
 	uint64_t *mem = (uint64_t *)Memory::alloc_static(len, true);
 	uint64_t *mem = (uint64_t *)Memory::alloc_static(len, true);
-	T *failptr = 0; //get rid of a warning
+	T *failptr = nullptr; //get rid of a warning
 	ERR_FAIL_COND_V(!mem, failptr);
 	ERR_FAIL_COND_V(!mem, failptr);
 	*(mem - 1) = p_elements;
 	*(mem - 1) = p_elements;
 
 

+ 1 - 1
core/os/midi_driver.cpp

@@ -34,7 +34,7 @@
 #include "main/input_default.h"
 #include "main/input_default.h"
 
 
 uint8_t MIDIDriver::last_received_message = 0x00;
 uint8_t MIDIDriver::last_received_message = 0x00;
-MIDIDriver *MIDIDriver::singleton = NULL;
+MIDIDriver *MIDIDriver::singleton = nullptr;
 MIDIDriver *MIDIDriver::get_singleton() {
 MIDIDriver *MIDIDriver::get_singleton() {
 	return singleton;
 	return singleton;
 }
 }

+ 9 - 9
core/os/os.cpp

@@ -40,7 +40,7 @@
 
 
 #include <stdarg.h>
 #include <stdarg.h>
 
 
-OS *OS::singleton = NULL;
+OS *OS::singleton = nullptr;
 uint64_t OS::target_ticks = 0;
 uint64_t OS::target_ticks = 0;
 
 
 OS *OS::get_singleton() {
 OS *OS::get_singleton() {
@@ -191,7 +191,7 @@ void OS::dump_memory_to_file(const char *p_file) {
 	//Memory::dump_static_mem_to_file(p_file);
 	//Memory::dump_static_mem_to_file(p_file);
 }
 }
 
 
-static FileAccess *_OSPRF = NULL;
+static FileAccess *_OSPRF = nullptr;
 
 
 static void _OS_printres(Object *p_obj) {
 static void _OS_printres(Object *p_obj) {
 	Resource *res = Object::cast_to<Resource>(p_obj);
 	Resource *res = Object::cast_to<Resource>(p_obj);
@@ -235,7 +235,7 @@ void OS::print_all_resources(String p_to_file) {
 		Error err;
 		Error err;
 		_OSPRF = FileAccess::open(p_to_file, FileAccess::WRITE, &err);
 		_OSPRF = FileAccess::open(p_to_file, FileAccess::WRITE, &err);
 		if (err != OK) {
 		if (err != OK) {
-			_OSPRF = NULL;
+			_OSPRF = nullptr;
 			ERR_FAIL_MSG("Can't print all resources to file: " + String(p_to_file) + ".");
 			ERR_FAIL_MSG("Can't print all resources to file: " + String(p_to_file) + ".");
 		}
 		}
 	}
 	}
@@ -245,12 +245,12 @@ void OS::print_all_resources(String p_to_file) {
 	if (p_to_file != "") {
 	if (p_to_file != "") {
 		if (_OSPRF)
 		if (_OSPRF)
 			memdelete(_OSPRF);
 			memdelete(_OSPRF);
-		_OSPRF = NULL;
+		_OSPRF = nullptr;
 	}
 	}
 }
 }
 
 
 void OS::print_resources_in_use(bool p_short) {
 void OS::print_resources_in_use(bool p_short) {
-	ResourceCache::dump(NULL, p_short);
+	ResourceCache::dump(nullptr, p_short);
 }
 }
 
 
 void OS::dump_resources_to_file(const char *p_file) {
 void OS::dump_resources_to_file(const char *p_file) {
@@ -534,7 +534,7 @@ String OS::get_joy_guid(int p_device) const {
 void OS::set_context(int p_context) {
 void OS::set_context(int p_context) {
 }
 }
 
 
-OS::SwitchVSyncCallbackInThread OS::switch_vsync_function = NULL;
+OS::SwitchVSyncCallbackInThread OS::switch_vsync_function = nullptr;
 
 
 void OS::set_use_vsync(bool p_enable) {
 void OS::set_use_vsync(bool p_enable) {
 	_use_vsync = p_enable;
 	_use_vsync = p_enable;
@@ -766,9 +766,9 @@ OS::OS() {
 	_allow_layered = false;
 	_allow_layered = false;
 	_stack_bottom = (void *)(&stack_bottom);
 	_stack_bottom = (void *)(&stack_bottom);
 
 
-	_logger = NULL;
+	_logger = nullptr;
 
 
-	has_server_feature_callback = NULL;
+	has_server_feature_callback = nullptr;
 
 
 	Vector<Logger *> loggers;
 	Vector<Logger *> loggers;
 	loggers.push_back(memnew(StdLogger));
 	loggers.push_back(memnew(StdLogger));
@@ -777,5 +777,5 @@ OS::OS() {
 
 
 OS::~OS() {
 OS::~OS() {
 	memdelete(_logger);
 	memdelete(_logger);
-	singleton = NULL;
+	singleton = nullptr;
 }
 }

+ 2 - 2
core/os/os.h

@@ -249,7 +249,7 @@ public:
 		OPENGL_CONTEXT, // HGLRC, X11::GLXContext, NSOpenGLContext*, EGLContext* ...
 		OPENGL_CONTEXT, // HGLRC, X11::GLXContext, NSOpenGLContext*, EGLContext* ...
 	};
 	};
 
 
-	virtual void *get_native_handle(int p_handle_type) { return NULL; };
+	virtual void *get_native_handle(int p_handle_type) { return nullptr; };
 
 
 	// Returns window area free of hardware controls and other obstacles.
 	// Returns window area free of hardware controls and other obstacles.
 	// The application should use this to determine where to place UI elements.
 	// The application should use this to determine where to place UI elements.
@@ -286,7 +286,7 @@ public:
 	virtual int get_low_processor_usage_mode_sleep_usec() const;
 	virtual int get_low_processor_usage_mode_sleep_usec() const;
 
 
 	virtual String get_executable_path() const;
 	virtual String get_executable_path() const;
-	virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL) = 0;
+	virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr) = 0;
 	virtual Error kill(const ProcessID &p_pid) = 0;
 	virtual Error kill(const ProcessID &p_pid) = 0;
 	virtual int get_process_id() const;
 	virtual int get_process_id() const;
 	virtual void vibrate_handheld(int p_duration_ms = 500);
 	virtual void vibrate_handheld(int p_duration_ms = 500);

+ 2 - 2
core/packed_data_container.cpp

@@ -104,7 +104,7 @@ Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, b
 		return pdcr;
 		return pdcr;
 	} else {
 	} else {
 		Variant v;
 		Variant v;
-		Error rerr = decode_variant(v, p_buf + p_ofs, datalen - p_ofs, NULL, false);
+		Error rerr = decode_variant(v, p_buf + p_ofs, datalen - p_ofs, nullptr, false);
 
 
 		if (rerr != OK) {
 		if (rerr != OK) {
 			err = true;
 			err = true;
@@ -227,7 +227,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
 		case Variant::NODE_PATH: {
 		case Variant::NODE_PATH: {
 			uint32_t pos = tmpdata.size();
 			uint32_t pos = tmpdata.size();
 			int len;
 			int len;
-			encode_variant(p_data, NULL, len, false);
+			encode_variant(p_data, nullptr, len, false);
 			tmpdata.resize(tmpdata.size() + len);
 			tmpdata.resize(tmpdata.size() + len);
 			encode_variant(p_data, &tmpdata.write[pos], len, false);
 			encode_variant(p_data, &tmpdata.write[pos], len, false);
 			return pos;
 			return pos;

+ 2 - 2
core/packed_data_container.h

@@ -72,7 +72,7 @@ protected:
 	static void _bind_methods();
 	static void _bind_methods();
 
 
 public:
 public:
-	virtual Variant getvar(const Variant &p_key, bool *r_valid = NULL) const;
+	virtual Variant getvar(const Variant &p_key, bool *r_valid = nullptr) const;
 	Error pack(const Variant &p_data);
 	Error pack(const Variant &p_data);
 
 
 	int size() const;
 	int size() const;
@@ -97,7 +97,7 @@ public:
 	bool _is_dictionary() const;
 	bool _is_dictionary() const;
 
 
 	int size() const;
 	int size() const;
-	virtual Variant getvar(const Variant &p_key, bool *r_valid = NULL) const;
+	virtual Variant getvar(const Variant &p_key, bool *r_valid = nullptr) const;
 
 
 	PackedDataContainerRef();
 	PackedDataContainerRef();
 };
 };

+ 15 - 15
core/pool_allocator.cpp

@@ -234,9 +234,9 @@ PoolAllocator::ID PoolAllocator::alloc(int p_size) {
 PoolAllocator::Entry *PoolAllocator::get_entry(ID p_mem) {
 PoolAllocator::Entry *PoolAllocator::get_entry(ID p_mem) {
 	unsigned int check = p_mem & CHECK_MASK;
 	unsigned int check = p_mem & CHECK_MASK;
 	int entry = p_mem >> CHECK_BITS;
 	int entry = p_mem >> CHECK_BITS;
-	ERR_FAIL_INDEX_V(entry, entry_max, NULL);
-	ERR_FAIL_COND_V(entry_array[entry].check != check, NULL);
-	ERR_FAIL_COND_V(entry_array[entry].len == 0, NULL);
+	ERR_FAIL_INDEX_V(entry, entry_max, nullptr);
+	ERR_FAIL_COND_V(entry_array[entry].check != check, nullptr);
+	ERR_FAIL_COND_V(entry_array[entry].len == 0, nullptr);
 
 
 	return &entry_array[entry];
 	return &entry_array[entry];
 }
 }
@@ -244,9 +244,9 @@ PoolAllocator::Entry *PoolAllocator::get_entry(ID p_mem) {
 const PoolAllocator::Entry *PoolAllocator::get_entry(ID p_mem) const {
 const PoolAllocator::Entry *PoolAllocator::get_entry(ID p_mem) const {
 	unsigned int check = p_mem & CHECK_MASK;
 	unsigned int check = p_mem & CHECK_MASK;
 	int entry = p_mem >> CHECK_BITS;
 	int entry = p_mem >> CHECK_BITS;
-	ERR_FAIL_INDEX_V(entry, entry_max, NULL);
-	ERR_FAIL_COND_V(entry_array[entry].check != check, NULL);
-	ERR_FAIL_COND_V(entry_array[entry].len == 0, NULL);
+	ERR_FAIL_INDEX_V(entry, entry_max, nullptr);
+	ERR_FAIL_COND_V(entry_array[entry].check != check, nullptr);
+	ERR_FAIL_COND_V(entry_array[entry].len == 0, nullptr);
 
 
 	return &entry_array[entry];
 	return &entry_array[entry];
 }
 }
@@ -429,7 +429,7 @@ bool PoolAllocator::is_locked(ID p_mem) const {
 const void *PoolAllocator::get(ID p_mem) const {
 const void *PoolAllocator::get(ID p_mem) const {
 	if (!needs_locking) {
 	if (!needs_locking) {
 		const Entry *e = get_entry(p_mem);
 		const Entry *e = get_entry(p_mem);
-		ERR_FAIL_COND_V(!e, NULL);
+		ERR_FAIL_COND_V(!e, nullptr);
 		return &pool[e->pos];
 		return &pool[e->pos];
 	}
 	}
 
 
@@ -438,18 +438,18 @@ const void *PoolAllocator::get(ID p_mem) const {
 
 
 	if (!e) {
 	if (!e) {
 		mt_unlock();
 		mt_unlock();
-		ERR_FAIL_COND_V(!e, NULL);
+		ERR_FAIL_COND_V(!e, nullptr);
 	}
 	}
 	if (e->lock == 0) {
 	if (e->lock == 0) {
 		mt_unlock();
 		mt_unlock();
 		ERR_PRINT("e->lock == 0");
 		ERR_PRINT("e->lock == 0");
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	if ((int)e->pos >= pool_size) {
 	if ((int)e->pos >= pool_size) {
 		mt_unlock();
 		mt_unlock();
 		ERR_PRINT("e->pos<0 || e->pos>=pool_size");
 		ERR_PRINT("e->pos<0 || e->pos>=pool_size");
-		return NULL;
+		return nullptr;
 	}
 	}
 	const void *ptr = &pool[e->pos];
 	const void *ptr = &pool[e->pos];
 
 
@@ -461,7 +461,7 @@ const void *PoolAllocator::get(ID p_mem) const {
 void *PoolAllocator::get(ID p_mem) {
 void *PoolAllocator::get(ID p_mem) {
 	if (!needs_locking) {
 	if (!needs_locking) {
 		Entry *e = get_entry(p_mem);
 		Entry *e = get_entry(p_mem);
-		ERR_FAIL_COND_V(!e, NULL);
+		ERR_FAIL_COND_V(!e, nullptr);
 		return &pool[e->pos];
 		return &pool[e->pos];
 	}
 	}
 
 
@@ -470,19 +470,19 @@ void *PoolAllocator::get(ID p_mem) {
 
 
 	if (!e) {
 	if (!e) {
 		mt_unlock();
 		mt_unlock();
-		ERR_FAIL_COND_V(!e, NULL);
+		ERR_FAIL_COND_V(!e, nullptr);
 	}
 	}
 	if (e->lock == 0) {
 	if (e->lock == 0) {
 		//assert(0);
 		//assert(0);
 		mt_unlock();
 		mt_unlock();
 		ERR_PRINT("e->lock == 0");
 		ERR_PRINT("e->lock == 0");
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	if ((int)e->pos >= pool_size) {
 	if ((int)e->pos >= pool_size) {
 		mt_unlock();
 		mt_unlock();
 		ERR_PRINT("e->pos<0 || e->pos>=pool_size");
 		ERR_PRINT("e->pos<0 || e->pos>=pool_size");
-		return NULL;
+		return nullptr;
 	}
 	}
 	void *ptr = &pool[e->pos];
 	void *ptr = &pool[e->pos];
 
 
@@ -558,7 +558,7 @@ PoolAllocator::PoolAllocator(void *p_mem, int p_size, int p_align, bool p_needs_
 	create_pool(p_mem, p_size, p_max_entries);
 	create_pool(p_mem, p_size, p_max_entries);
 	needs_locking = p_needs_locking;
 	needs_locking = p_needs_locking;
 	align = p_align;
 	align = p_align;
-	mem_ptr = NULL;
+	mem_ptr = nullptr;
 }
 }
 
 
 PoolAllocator::PoolAllocator(int p_align, int p_size, bool p_needs_locking, int p_max_entries) {
 PoolAllocator::PoolAllocator(int p_align, int p_size, bool p_needs_locking, int p_max_entries) {

+ 5 - 5
core/pool_vector.cpp

@@ -32,12 +32,12 @@
 
 
 Mutex pool_vector_lock;
 Mutex pool_vector_lock;
 
 
-PoolAllocator *MemoryPool::memory_pool = NULL;
-uint8_t *MemoryPool::pool_memory = NULL;
-size_t *MemoryPool::pool_size = NULL;
+PoolAllocator *MemoryPool::memory_pool = nullptr;
+uint8_t *MemoryPool::pool_memory = nullptr;
+size_t *MemoryPool::pool_size = nullptr;
 
 
-MemoryPool::Alloc *MemoryPool::allocs = NULL;
-MemoryPool::Alloc *MemoryPool::free_list = NULL;
+MemoryPool::Alloc *MemoryPool::allocs = nullptr;
+MemoryPool::Alloc *MemoryPool::free_list = nullptr;
 uint32_t MemoryPool::alloc_count = 0;
 uint32_t MemoryPool::alloc_count = 0;
 uint32_t MemoryPool::allocs_used = 0;
 uint32_t MemoryPool::allocs_used = 0;
 Mutex MemoryPool::alloc_mutex;
 Mutex MemoryPool::alloc_mutex;

+ 14 - 14
core/pool_vector.h

@@ -56,10 +56,10 @@ struct MemoryPool {
 
 
 		Alloc() :
 		Alloc() :
 				lock(0),
 				lock(0),
-				mem(NULL),
+				mem(nullptr),
 				pool_id(POOL_ALLOCATOR_INVALID_ID),
 				pool_id(POOL_ALLOCATOR_INVALID_ID),
 				size(0),
 				size(0),
-				free_list(NULL) {
+				free_list(nullptr) {
 		}
 		}
 	};
 	};
 
 
@@ -165,7 +165,7 @@ class PoolVector {
 				//if some resize
 				//if some resize
 			} else {
 			} else {
 				memfree(old_alloc->mem);
 				memfree(old_alloc->mem);
-				old_alloc->mem = NULL;
+				old_alloc->mem = nullptr;
 				old_alloc->size = 0;
 				old_alloc->size = 0;
 
 
 				MemoryPool::alloc_mutex.lock();
 				MemoryPool::alloc_mutex.lock();
@@ -197,7 +197,7 @@ class PoolVector {
 			return;
 			return;
 
 
 		if (!alloc->refcount.unref()) {
 		if (!alloc->refcount.unref()) {
-			alloc = NULL;
+			alloc = nullptr;
 			return;
 			return;
 		}
 		}
 
 
@@ -229,7 +229,7 @@ class PoolVector {
 			//if some resize
 			//if some resize
 		} else {
 		} else {
 			memfree(alloc->mem);
 			memfree(alloc->mem);
-			alloc->mem = NULL;
+			alloc->mem = nullptr;
 			alloc->size = 0;
 			alloc->size = 0;
 
 
 			MemoryPool::alloc_mutex.lock();
 			MemoryPool::alloc_mutex.lock();
@@ -239,7 +239,7 @@ class PoolVector {
 			MemoryPool::alloc_mutex.unlock();
 			MemoryPool::alloc_mutex.unlock();
 		}
 		}
 
 
-		alloc = NULL;
+		alloc = nullptr;
 	}
 	}
 
 
 public:
 public:
@@ -271,14 +271,14 @@ public:
 					}
 					}
 				}
 				}
 
 
-				mem = NULL;
-				alloc = NULL;
+				mem = nullptr;
+				alloc = nullptr;
 			}
 			}
 		}
 		}
 
 
 		Access() {
 		Access() {
-			alloc = NULL;
-			mem = NULL;
+			alloc = nullptr;
+			mem = nullptr;
 		}
 		}
 
 
 	public:
 	public:
@@ -442,9 +442,9 @@ public:
 	void invert();
 	void invert();
 
 
 	void operator=(const PoolVector &p_pool_vector) { _reference(p_pool_vector); }
 	void operator=(const PoolVector &p_pool_vector) { _reference(p_pool_vector); }
-	PoolVector() { alloc = NULL; }
+	PoolVector() { alloc = nullptr; }
 	PoolVector(const PoolVector &p_pool_vector) {
 	PoolVector(const PoolVector &p_pool_vector) {
-		alloc = NULL;
+		alloc = nullptr;
 		_reference(p_pool_vector);
 		_reference(p_pool_vector);
 	}
 	}
 	~PoolVector() { _unreference(); }
 	~PoolVector() { _unreference(); }
@@ -491,7 +491,7 @@ template <class T>
 Error PoolVector<T>::resize(int p_size) {
 Error PoolVector<T>::resize(int p_size) {
 	ERR_FAIL_COND_V_MSG(p_size < 0, ERR_INVALID_PARAMETER, "Size of PoolVector cannot be negative.");
 	ERR_FAIL_COND_V_MSG(p_size < 0, ERR_INVALID_PARAMETER, "Size of PoolVector cannot be negative.");
 
 
-	if (alloc == NULL) {
+	if (alloc == nullptr) {
 		if (p_size == 0)
 		if (p_size == 0)
 			return OK; //nothing to do here
 			return OK; //nothing to do here
 
 
@@ -578,7 +578,7 @@ Error PoolVector<T>::resize(int p_size) {
 		} else {
 		} else {
 			if (new_size == 0) {
 			if (new_size == 0) {
 				memfree(alloc->mem);
 				memfree(alloc->mem);
-				alloc->mem = NULL;
+				alloc->mem = nullptr;
 				alloc->size = 0;
 				alloc->size = 0;
 
 
 				MemoryPool::alloc_mutex.lock();
 				MemoryPool::alloc_mutex.lock();

+ 3 - 3
core/print_string.cpp

@@ -34,7 +34,7 @@
 
 
 #include <stdio.h>
 #include <stdio.h>
 
 
-static PrintHandlerList *print_handler_list = NULL;
+static PrintHandlerList *print_handler_list = nullptr;
 bool _print_line_enabled = true;
 bool _print_line_enabled = true;
 bool _print_error_enabled = true;
 bool _print_error_enabled = true;
 
 
@@ -48,7 +48,7 @@ void add_print_handler(PrintHandlerList *p_handler) {
 void remove_print_handler(PrintHandlerList *p_handler) {
 void remove_print_handler(PrintHandlerList *p_handler) {
 	_global_lock();
 	_global_lock();
 
 
-	PrintHandlerList *prev = NULL;
+	PrintHandlerList *prev = nullptr;
 	PrintHandlerList *l = print_handler_list;
 	PrintHandlerList *l = print_handler_list;
 
 
 	while (l) {
 	while (l) {
@@ -65,7 +65,7 @@ void remove_print_handler(PrintHandlerList *p_handler) {
 	//OS::get_singleton()->print("print handler list is %p\n",print_handler_list);
 	//OS::get_singleton()->print("print handler list is %p\n",print_handler_list);
 
 
 	_global_unlock();
 	_global_unlock();
-	ERR_FAIL_COND(l == NULL);
+	ERR_FAIL_COND(l == nullptr);
 }
 }
 
 
 void print_line(String p_string) {
 void print_line(String p_string) {

+ 3 - 3
core/print_string.h

@@ -44,9 +44,9 @@ struct PrintHandlerList {
 	PrintHandlerList *next;
 	PrintHandlerList *next;
 
 
 	PrintHandlerList() {
 	PrintHandlerList() {
-		printfunc = 0;
-		next = 0;
-		userdata = 0;
+		printfunc = nullptr;
+		next = nullptr;
+		userdata = nullptr;
 	}
 	}
 };
 };
 
 

+ 6 - 6
core/project_settings.cpp

@@ -43,7 +43,7 @@
 
 
 #include <zlib.h>
 #include <zlib.h>
 
 
-ProjectSettings *ProjectSettings::singleton = NULL;
+ProjectSettings *ProjectSettings::singleton = nullptr;
 
 
 ProjectSettings *ProjectSettings::get_singleton() {
 ProjectSettings *ProjectSettings::get_singleton() {
 	return singleton;
 	return singleton;
@@ -508,7 +508,7 @@ Error ProjectSettings::_load_settings_binary(const String &p_path) {
 		d.resize(vlen);
 		d.resize(vlen);
 		f->get_buffer(d.ptrw(), vlen);
 		f->get_buffer(d.ptrw(), vlen);
 		Variant value;
 		Variant value;
-		err = decode_variant(value, d.ptr(), d.size(), NULL, true);
+		err = decode_variant(value, d.ptr(), d.size(), nullptr, true);
 		ERR_CONTINUE_MSG(err != OK, "Error decoding property: " + key + ".");
 		ERR_CONTINUE_MSG(err != OK, "Error decoding property: " + key + ".");
 		set(key, value);
 		set(key, value);
 	}
 	}
@@ -545,7 +545,7 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
 		next_tag.fields.clear();
 		next_tag.fields.clear();
 		next_tag.name = String();
 		next_tag.name = String();
 
 
-		err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+		err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
 		if (err == ERR_FILE_EOF) {
 		if (err == ERR_FILE_EOF) {
 			memdelete(f);
 			memdelete(f);
 			// If we're loading a project.godot from source code, we can operate some
 			// If we're loading a project.godot from source code, we can operate some
@@ -654,7 +654,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
 		file->store_string(key);
 		file->store_string(key);
 
 
 		int len;
 		int len;
-		err = encode_variant(p_custom_features, NULL, len, false);
+		err = encode_variant(p_custom_features, nullptr, len, false);
 		if (err != OK) {
 		if (err != OK) {
 			memdelete(file);
 			memdelete(file);
 			ERR_FAIL_V(err);
 			ERR_FAIL_V(err);
@@ -690,7 +690,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
 			file->store_string(key);
 			file->store_string(key);
 
 
 			int len;
 			int len;
-			err = encode_variant(value, NULL, len, true);
+			err = encode_variant(value, nullptr, len, true);
 			if (err != OK)
 			if (err != OK)
 				memdelete(file);
 				memdelete(file);
 			ERR_FAIL_COND_V_MSG(err != OK, ERR_INVALID_DATA, "Error when trying to encode Variant.");
 			ERR_FAIL_COND_V_MSG(err != OK, ERR_INVALID_DATA, "Error when trying to encode Variant.");
@@ -1190,5 +1190,5 @@ ProjectSettings::ProjectSettings() {
 }
 }
 
 
 ProjectSettings::~ProjectSettings() {
 ProjectSettings::~ProjectSettings() {
-	singleton = NULL;
+	singleton = nullptr;
 }
 }

+ 15 - 15
core/reference.h

@@ -145,7 +145,7 @@ public:
 		Ref r;
 		Ref r;
 		r.reference = Object::cast_to<T>(refb);
 		r.reference = Object::cast_to<T>(refb);
 		ref(r);
 		ref(r);
-		r.reference = NULL;
+		r.reference = nullptr;
 	}
 	}
 
 
 	void operator=(const RefPtr &p_refptr) {
 	void operator=(const RefPtr &p_refptr) {
@@ -158,7 +158,7 @@ public:
 		Ref r;
 		Ref r;
 		r.reference = Object::cast_to<T>(refb);
 		r.reference = Object::cast_to<T>(refb);
 		ref(r);
 		ref(r);
-		r.reference = NULL;
+		r.reference = nullptr;
 	}
 	}
 
 
 	void operator=(const Variant &p_variant) {
 	void operator=(const Variant &p_variant) {
@@ -172,7 +172,7 @@ public:
 		Ref r;
 		Ref r;
 		r.reference = Object::cast_to<T>(refb);
 		r.reference = Object::cast_to<T>(refb);
 		ref(r);
 		ref(r);
-		r.reference = NULL;
+		r.reference = nullptr;
 	}
 	}
 
 
 	template <class T_Other>
 	template <class T_Other>
@@ -189,13 +189,13 @@ public:
 	}
 	}
 
 
 	Ref(const Ref &p_from) {
 	Ref(const Ref &p_from) {
-		reference = NULL;
+		reference = nullptr;
 		ref(p_from);
 		ref(p_from);
 	}
 	}
 
 
 	template <class T_Other>
 	template <class T_Other>
 	Ref(const Ref<T_Other> &p_from) {
 	Ref(const Ref<T_Other> &p_from) {
-		reference = NULL;
+		reference = nullptr;
 		Reference *refb = const_cast<Reference *>(static_cast<const Reference *>(p_from.ptr()));
 		Reference *refb = const_cast<Reference *>(static_cast<const Reference *>(p_from.ptr()));
 		if (!refb) {
 		if (!refb) {
 			unref();
 			unref();
@@ -204,11 +204,11 @@ public:
 		Ref r;
 		Ref r;
 		r.reference = Object::cast_to<T>(refb);
 		r.reference = Object::cast_to<T>(refb);
 		ref(r);
 		ref(r);
-		r.reference = NULL;
+		r.reference = nullptr;
 	}
 	}
 
 
 	Ref(T *p_reference) {
 	Ref(T *p_reference) {
-		reference = NULL;
+		reference = nullptr;
 		if (p_reference)
 		if (p_reference)
 			ref_pointer(p_reference);
 			ref_pointer(p_reference);
 	}
 	}
@@ -216,7 +216,7 @@ public:
 	Ref(const Variant &p_variant) {
 	Ref(const Variant &p_variant) {
 		RefPtr refptr = p_variant;
 		RefPtr refptr = p_variant;
 		Ref<Reference> *irr = reinterpret_cast<Ref<Reference> *>(refptr.get_data());
 		Ref<Reference> *irr = reinterpret_cast<Ref<Reference> *>(refptr.get_data());
-		reference = NULL;
+		reference = nullptr;
 		Reference *refb = irr->ptr();
 		Reference *refb = irr->ptr();
 		if (!refb) {
 		if (!refb) {
 			unref();
 			unref();
@@ -225,12 +225,12 @@ public:
 		Ref r;
 		Ref r;
 		r.reference = Object::cast_to<T>(refb);
 		r.reference = Object::cast_to<T>(refb);
 		ref(r);
 		ref(r);
-		r.reference = NULL;
+		r.reference = nullptr;
 	}
 	}
 
 
 	Ref(const RefPtr &p_refptr) {
 	Ref(const RefPtr &p_refptr) {
 		Ref<Reference> *irr = reinterpret_cast<Ref<Reference> *>(p_refptr.get_data());
 		Ref<Reference> *irr = reinterpret_cast<Ref<Reference> *>(p_refptr.get_data());
-		reference = NULL;
+		reference = nullptr;
 		Reference *refb = irr->ptr();
 		Reference *refb = irr->ptr();
 		if (!refb) {
 		if (!refb) {
 			unref();
 			unref();
@@ -239,11 +239,11 @@ public:
 		Ref r;
 		Ref r;
 		r.reference = Object::cast_to<T>(refb);
 		r.reference = Object::cast_to<T>(refb);
 		ref(r);
 		ref(r);
-		r.reference = NULL;
+		r.reference = nullptr;
 	}
 	}
 
 
-	inline bool is_valid() const { return reference != NULL; }
-	inline bool is_null() const { return reference == NULL; }
+	inline bool is_valid() const { return reference != nullptr; }
+	inline bool is_null() const { return reference == nullptr; }
 
 
 	void unref() {
 	void unref() {
 		//TODO this should be moved to mutexes, since this engine does not really
 		//TODO this should be moved to mutexes, since this engine does not really
@@ -253,7 +253,7 @@ public:
 		if (reference && reference->unreference()) {
 		if (reference && reference->unreference()) {
 			memdelete(reference);
 			memdelete(reference);
 		}
 		}
-		reference = NULL;
+		reference = nullptr;
 	}
 	}
 
 
 	void instance() {
 	void instance() {
@@ -261,7 +261,7 @@ public:
 	}
 	}
 
 
 	Ref() {
 	Ref() {
-		reference = NULL;
+		reference = nullptr;
 	}
 	}
 
 
 	~Ref() {
 	~Ref() {

+ 9 - 9
core/register_core_types.cpp

@@ -79,17 +79,17 @@ static Ref<TranslationLoaderPO> resource_format_po;
 static Ref<ResourceFormatSaverCrypto> resource_format_saver_crypto;
 static Ref<ResourceFormatSaverCrypto> resource_format_saver_crypto;
 static Ref<ResourceFormatLoaderCrypto> resource_format_loader_crypto;
 static Ref<ResourceFormatLoaderCrypto> resource_format_loader_crypto;
 
 
-static _ResourceLoader *_resource_loader = NULL;
-static _ResourceSaver *_resource_saver = NULL;
-static _OS *_os = NULL;
-static _Engine *_engine = NULL;
-static _ClassDB *_classdb = NULL;
-static _Marshalls *_marshalls = NULL;
-static _JSON *_json = NULL;
+static _ResourceLoader *_resource_loader = nullptr;
+static _ResourceSaver *_resource_saver = nullptr;
+static _OS *_os = nullptr;
+static _Engine *_engine = nullptr;
+static _ClassDB *_classdb = nullptr;
+static _Marshalls *_marshalls = nullptr;
+static _JSON *_json = nullptr;
 
 
-static IP *ip = NULL;
+static IP *ip = nullptr;
 
 
-static _Geometry *_geometry = NULL;
+static _Geometry *_geometry = nullptr;
 
 
 extern Mutex _global_mutex;
 extern Mutex _global_mutex;
 
 

+ 7 - 7
core/resource.cpp

@@ -289,7 +289,7 @@ Node *Resource::get_local_scene() const {
 		return _get_local_scene_func();
 		return _get_local_scene_func();
 	}
 	}
 
 
-	return NULL;
+	return nullptr;
 }
 }
 
 
 void Resource::setup_local_to_scene() {
 void Resource::setup_local_to_scene() {
@@ -297,7 +297,7 @@ void Resource::setup_local_to_scene() {
 		get_script_instance()->call("_setup_local_to_scene");
 		get_script_instance()->call("_setup_local_to_scene");
 }
 }
 
 
-Node *(*Resource::_get_local_scene_func)() = NULL;
+Node *(*Resource::_get_local_scene_func)() = nullptr;
 
 
 void Resource::set_as_translation_remapped(bool p_remapped) {
 void Resource::set_as_translation_remapped(bool p_remapped) {
 	if (remapped_list.in_list() == p_remapped)
 	if (remapped_list.in_list() == p_remapped)
@@ -377,7 +377,7 @@ Resource::Resource() :
 
 
 	subindex = 0;
 	subindex = 0;
 	local_to_scene = false;
 	local_to_scene = false;
-	local_scene = NULL;
+	local_scene = nullptr;
 }
 }
 
 
 Resource::~Resource() {
 Resource::~Resource() {
@@ -434,7 +434,7 @@ Resource *ResourceCache::get(const String &p_path) {
 	lock.read_unlock();
 	lock.read_unlock();
 
 
 	if (!res) {
 	if (!res) {
-		return NULL;
+		return nullptr;
 	}
 	}
 
 
 	return *res;
 	return *res;
@@ -442,7 +442,7 @@ Resource *ResourceCache::get(const String &p_path) {
 
 
 void ResourceCache::get_cached_resources(List<Ref<Resource>> *p_resources) {
 void ResourceCache::get_cached_resources(List<Ref<Resource>> *p_resources) {
 	lock.read_lock();
 	lock.read_lock();
-	const String *K = NULL;
+	const String *K = nullptr;
 	while ((K = resources.next(K))) {
 	while ((K = resources.next(K))) {
 		Resource *r = resources[*K];
 		Resource *r = resources[*K];
 		p_resources->push_back(Ref<Resource>(r));
 		p_resources->push_back(Ref<Resource>(r));
@@ -464,13 +464,13 @@ void ResourceCache::dump(const char *p_file, bool p_short) {
 
 
 	Map<String, int> type_count;
 	Map<String, int> type_count;
 
 
-	FileAccess *f = NULL;
+	FileAccess *f = nullptr;
 	if (p_file) {
 	if (p_file) {
 		f = FileAccess::open(p_file, FileAccess::WRITE);
 		f = FileAccess::open(p_file, FileAccess::WRITE);
 		ERR_FAIL_COND_MSG(!f, "Cannot create file at path '" + String(p_file) + "'.");
 		ERR_FAIL_COND_MSG(!f, "Cannot create file at path '" + String(p_file) + "'.");
 	}
 	}
 
 
-	const String *K = NULL;
+	const String *K = nullptr;
 	while ((K = resources.next(K))) {
 	while ((K = resources.next(K))) {
 		Resource *r = resources[*K];
 		Resource *r = resources[*K];
 
 

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio