Переглянути джерело

Merge pull request #48292 from akien-mga/stay-modern

Replace remaining uses of `NULL` with `nullptr`
Rémi Verschelde 4 роки тому
батько
коміт
aac354709d
32 змінених файлів з 98 додано та 98 видалено
  1. 1 1
      drivers/vulkan/vulkan_context.cpp
  2. 1 1
      editor/editor_properties.cpp
  3. 12 12
      modules/camera/camera_osx.mm
  4. 1 1
      modules/fbx/editor_scene_importer_fbx.cpp
  5. 1 1
      modules/fbx/fbx_parser/FBXAnimation.cpp
  6. 2 2
      modules/fbx/fbx_parser/FBXDocument.h
  7. 4 4
      modules/fbx/fbx_parser/FBXDocumentUtil.cpp
  8. 1 1
      modules/fbx/fbx_parser/FBXMeshGeometry.h
  9. 2 2
      modules/fbx/fbx_parser/FBXParser.cpp
  10. 1 1
      modules/fbx/fbx_parser/FBXProperties.cpp
  11. 2 2
      modules/fbx/tools/import_utils.h
  12. 1 1
      modules/gdnative/tests/test_variant.h
  13. 1 1
      modules/gdscript/gdscript_editor.cpp
  14. 1 1
      modules/mbedtls/stream_peer_mbedtls.cpp
  15. 1 1
      modules/mono/editor/godotsharp_export.cpp
  16. 4 4
      modules/mono/mono_gd/support/ios_support.mm
  17. 1 1
      modules/visual_script/visual_script.cpp
  18. 1 1
      modules/webxr/webxr_interface_js.cpp
  19. 2 2
      platform/iphone/display_server_iphone.mm
  20. 2 2
      platform/iphone/godot_iphone.mm
  21. 5 5
      platform/iphone/godot_view.mm
  22. 4 4
      platform/iphone/ios.mm
  23. 2 2
      platform/iphone/vulkan_context_iphone.mm
  24. 10 10
      platform/javascript/api/javascript_tools_editor_plugin.cpp
  25. 3 3
      platform/javascript/display_server_javascript.cpp
  26. 2 2
      platform/javascript/export/export.cpp
  27. 5 5
      platform/osx/crash_handler_osx.mm
  28. 13 13
      platform/osx/display_server_osx.mm
  29. 3 3
      platform/osx/os_osx.mm
  30. 2 2
      platform/osx/vulkan_context_osx.mm
  31. 6 6
      platform/windows/display_server_windows.cpp
  32. 1 1
      tests/test_string.h

+ 1 - 1
drivers/vulkan/vulkan_context.cpp

@@ -816,7 +816,7 @@ Error VulkanContext::_create_physical_device() {
 		}
 	}
 
-	/* Call with NULL data to get count */
+	/* Call with nullptr data to get count */
 	vkGetPhysicalDeviceQueueFamilyProperties(gpu, &queue_family_count, nullptr);
 	ERR_FAIL_COND_V(queue_family_count == 0, ERR_CANT_CREATE);
 

+ 1 - 1
editor/editor_properties.cpp

@@ -38,7 +38,7 @@
 #include "scene/main/window.h"
 #include "scene/resources/font.h"
 
-///////////////////// NULL /////////////////////////
+///////////////////// Nil /////////////////////////
 
 void EditorPropertyNil::update_property() {
 }

+ 12 - 12
modules/camera/camera_osx.mm

@@ -106,15 +106,15 @@
 	if (input) {
 		[self removeInput:input];
 		// don't release this
-		input = NULL;
+		input = nullptr;
 	}
 
 	// free up our output
 	if (output) {
 		[self removeOutput:output];
-		[output setSampleBufferDelegate:nil queue:NULL];
+		[output setSampleBufferDelegate:nil queue:nullptr];
 		[output release];
-		output = NULL;
+		output = nullptr;
 	}
 
 	[self commitConfiguration];
@@ -141,9 +141,9 @@
 	// get our buffers
 	unsigned char *dataY = (unsigned char *)CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0);
 	unsigned char *dataCbCr = (unsigned char *)CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 1);
-	if (dataY == NULL) {
+	if (dataY == nullptr) {
 		print_line("Couldn't access Y pixel buffer data");
-	} else if (dataCbCr == NULL) {
+	} else if (dataCbCr == nullptr) {
 		print_line("Couldn't access CbCr pixel buffer data");
 	} else {
 		Ref<Image> img[2];
@@ -220,8 +220,8 @@ AVCaptureDevice *CameraFeedOSX::get_device() const {
 };
 
 CameraFeedOSX::CameraFeedOSX() {
-	device = NULL;
-	capture_session = NULL;
+	device = nullptr;
+	capture_session = nullptr;
 };
 
 void CameraFeedOSX::set_device(AVCaptureDevice *p_device) {
@@ -240,14 +240,14 @@ void CameraFeedOSX::set_device(AVCaptureDevice *p_device) {
 };
 
 CameraFeedOSX::~CameraFeedOSX() {
-	if (capture_session != NULL) {
+	if (capture_session != nullptr) {
 		[capture_session release];
-		capture_session = NULL;
+		capture_session = nullptr;
 	};
 
-	if (device != NULL) {
+	if (device != nullptr) {
 		[device release];
-		device = NULL;
+		device = nullptr;
 	};
 };
 
@@ -267,7 +267,7 @@ void CameraFeedOSX::deactivate_feed() {
 	if (capture_session) {
 		[capture_session cleanup];
 		[capture_session release];
-		capture_session = NULL;
+		capture_session = nullptr;
 	};
 };
 

+ 1 - 1
modules/fbx/editor_scene_importer_fbx.cpp

@@ -104,7 +104,7 @@ Node3D *EditorSceneImporterFBX::import_scene(const String &p_path, uint32_t p_fl
 		bool is_binary = false;
 		data.resize(f->get_len());
 
-		ERR_FAIL_COND_V(data.size() < 64, NULL);
+		ERR_FAIL_COND_V(data.size() < 64, nullptr);
 
 		f->get_buffer(data.ptrw(), data.size());
 		PackedByteArray fbx_header;

+ 1 - 1
modules/fbx/fbx_parser/FBXAnimation.cpp

@@ -128,7 +128,7 @@ AnimationCurve::~AnimationCurve() {
 
 // ------------------------------------------------------------------------------------------------
 AnimationCurveNode::AnimationCurveNode(uint64_t id, const ElementPtr element, const std::string &name,
-		const Document &doc, const char *const *target_prop_whitelist /*= NULL*/,
+		const Document &doc, const char *const *target_prop_whitelist /*= nullptr*/,
 		size_t whitelist_size /*= 0*/) :
 		Object(id, element, name), target(), doc(doc) {
 	// find target node

+ 2 - 2
modules/fbx/fbx_parser/FBXDocument.h

@@ -759,7 +759,7 @@ public:
 
 	const AnimationMap &Curves() const;
 
-	/** Object the curve is assigned to, this can be NULL if the
+	/** Object the curve is assigned to, this can be nullptr if the
      *  target object has no DOM representation or could not
      *  be read for other reasons.*/
 	Object *Target() const {
@@ -989,7 +989,7 @@ public:
 
 	// note: a connection ensures that the source and dest objects exist, but
 	// not that they have DOM representations, so the return value of one of
-	// these functions can still be NULL.
+	// these functions can still be nullptr.
 	Object *SourceObject() const;
 	Object *DestinationObject() const;
 

+ 4 - 4
modules/fbx/fbx_parser/FBXDocumentUtil.cpp

@@ -95,14 +95,14 @@ void DOMError(const std::string &message, const std::shared_ptr<Token> token) {
 	print_error("[FBX-DOM]" + String(message.c_str()) + ";" + String(token->StringContents().c_str()));
 }
 
-void DOMError(const std::string &message, const Element *element /*= NULL*/) {
+void DOMError(const std::string &message, const Element *element /*= nullptr*/) {
 	if (element) {
 		DOMError(message, element->KeyToken());
 	}
 	print_error("[FBX-DOM] " + String(message.c_str()));
 }
 
-void DOMError(const std::string &message, const std::shared_ptr<Element> element /*= NULL*/) {
+void DOMError(const std::string &message, const std::shared_ptr<Element> element /*= nullptr*/) {
 	if (element) {
 		DOMError(message, element->KeyToken());
 	}
@@ -117,7 +117,7 @@ void DOMWarning(const std::string &message, const Token *token) {
 	print_verbose("[FBX-DOM] warning:" + String(message.c_str()) + ";" + String(token->StringContents().c_str()));
 }
 
-void DOMWarning(const std::string &message, const Element *element /*= NULL*/) {
+void DOMWarning(const std::string &message, const Element *element /*= nullptr*/) {
 	if (element) {
 		DOMWarning(message, element->KeyToken());
 		return;
@@ -129,7 +129,7 @@ void DOMWarning(const std::string &message, const std::shared_ptr<Token> token)
 	print_verbose("[FBX-DOM] warning:" + String(message.c_str()) + ";" + String(token->StringContents().c_str()));
 }
 
-void DOMWarning(const std::string &message, const std::shared_ptr<Element> element /*= NULL*/) {
+void DOMWarning(const std::string &message, const std::shared_ptr<Element> element /*= nullptr*/) {
 	if (element) {
 		DOMWarning(message, element->KeyToken());
 		return;

+ 1 - 1
modules/fbx/fbx_parser/FBXMeshGeometry.h

@@ -96,7 +96,7 @@ public:
 	Geometry(uint64_t id, const ElementPtr element, const std::string &name, const Document &doc);
 	virtual ~Geometry();
 
-	/** Get the Skin attached to this geometry or NULL */
+	/** Get the Skin attached to this geometry or nullptr */
 	const Skin *DeformerSkin() const;
 
 	const std::vector<const BlendShape *> &get_blend_shapes() const;

+ 2 - 2
modules/fbx/fbx_parser/FBXParser.cpp

@@ -1206,7 +1206,7 @@ std::string ParseTokenAsString(const TokenPtr t) {
 
 // ------------------------------------------------------------------------------------------------
 // extract a required element from a scope, abort if the element cannot be found
-ElementPtr GetRequiredElement(const ScopePtr sc, const std::string &index, const ElementPtr element /*= NULL*/) {
+ElementPtr GetRequiredElement(const ScopePtr sc, const std::string &index, const ElementPtr element /*= nullptr*/) {
 	const ElementPtr el = sc->GetElement(index);
 	TokenPtr token = el->KeyToken();
 	ERR_FAIL_COND_V(!token, nullptr);
@@ -1227,7 +1227,7 @@ bool HasElement(const ScopePtr sc, const std::string &index) {
 
 // ------------------------------------------------------------------------------------------------
 // extract a required element from a scope, abort if the element cannot be found
-ElementPtr GetOptionalElement(const ScopePtr sc, const std::string &index, const ElementPtr element /*= NULL*/) {
+ElementPtr GetOptionalElement(const ScopePtr sc, const std::string &index, const ElementPtr element /*= nullptr*/) {
 	const ElementPtr el = sc->GetElement(index);
 	return el;
 }

+ 1 - 1
modules/fbx/fbx_parser/FBXProperties.cpp

@@ -94,7 +94,7 @@ Property::~Property() {
 namespace {
 
 // ------------------------------------------------------------------------------------------------
-// read a typed property out of a FBX element. The return value is NULL if the property cannot be read.
+// read a typed property out of a FBX element. The return value is nullptr if the property cannot be read.
 PropertyPtr ReadTypedProperty(const ElementPtr element) {
 	//ai_assert(element.KeyToken().StringContents() == "P");
 

+ 2 - 2
modules/fbx/tools/import_utils.h

@@ -267,7 +267,7 @@ public:
 	  */
 	// static void set_texture_mapping_mode(aiTextureMapMode *map_mode, Ref<ImageTexture> texture) {
 	// 	ERR_FAIL_COND(texture.is_null());
-	// 	ERR_FAIL_COND(map_mode == NULL);
+	// 	ERR_FAIL_COND(map_mode == nullptr);
 	// 	aiTextureMapMode tex_mode = map_mode[0];
 
 	// 	int32_t flags = Texture::FLAGS_DEFAULT;
@@ -382,7 +382,7 @@ public:
 	// 		String &path,
 	// 		AssimpImageData &image_state) {
 	// 	aiString ai_filename = aiString();
-	// 	if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, NULL, NULL, NULL, NULL, image_state.map_mode)) {
+	// 	if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, nullptr, nullptr, nullptr, nullptr, image_state.map_mode)) {
 	// 		return CreateAssimpTexture(state, ai_filename, filename, path, image_state);
 	// 	}
 

+ 1 - 1
modules/gdnative/tests/test_variant.h

@@ -107,7 +107,7 @@ TEST_CASE("[GDNative Variant] Variant call") {
 	godot_string_name_new_with_latin1_chars(&method, "is_valid_identifier");
 
 	godot_variant_call_error error;
-	godot_variant_call(&self, &method, NULL, 0, &ret, &error);
+	godot_variant_call(&self, &method, nullptr, 0, &ret, &error);
 
 	CHECK(godot_variant_get_type(&ret) == GODOT_VARIANT_TYPE_BOOL);
 	CHECK(godot_variant_as_bool(&ret));

+ 1 - 1
modules/gdscript/gdscript_editor.cpp

@@ -3070,7 +3070,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
 						// We cannot determine the exact nature of the identifier here
 						// Otherwise these codes would work
 						StringName enumName = ClassDB::get_integer_constant_enum("@GlobalScope", p_symbol, true);
-						if (enumName != NULL) {
+						if (enumName != nullptr) {
 							r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_ENUM;
 							r_result.class_name = "@GlobalScope";
 							r_result.class_member = enumName;

+ 1 - 1
modules/mbedtls/stream_peer_mbedtls.cpp

@@ -242,7 +242,7 @@ void StreamPeerMbedTLS::poll() {
 		return;
 	}
 
-	// We could pass NULL as second parameter, but some behaviour sanitizers don't seem to like that.
+	// We could pass nullptr as second parameter, but some behaviour sanitizers don't seem to like that.
 	// Passing a 1 byte buffer to workaround it.
 	uint8_t byte;
 	int ret = mbedtls_ssl_read(ssl_ctx->get_context(), &byte, 0);

+ 1 - 1
modules/mono/editor/godotsharp_export.cpp

@@ -91,7 +91,7 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, MonoAssemblyName *re
 
 		mono_assembly_get_assemblyref(image, i, reusable_aname);
 
-		GDMonoAssembly *ref_assembly = NULL;
+		GDMonoAssembly *ref_assembly = nullptr;
 		if (!GDMono::get_singleton()->load_assembly(ref_name, reusable_aname, &ref_assembly, /* refonly: */ true, p_search_dirs)) {
 			ERR_FAIL_V_MSG(ERR_CANT_RESOLVE, "Cannot load assembly (refonly): '" + ref_name + "'.");
 		}

+ 4 - 4
modules/mono/mono_gd/support/ios_support.mm

@@ -57,9 +57,9 @@ void ios_mono_log_callback(const char *log_domain, const char *log_level, const
 }
 
 void initialize() {
-	mono_dllmap_insert(NULL, "System.Native", NULL, "__Internal", NULL);
-	mono_dllmap_insert(NULL, "System.IO.Compression.Native", NULL, "__Internal", NULL);
-	mono_dllmap_insert(NULL, "System.Security.Cryptography.Native.Apple", NULL, "__Internal", NULL);
+	mono_dllmap_insert(nullptr, "System.Native", nullptr, "__Internal", nullptr);
+	mono_dllmap_insert(nullptr, "System.IO.Compression.Native", nullptr, "__Internal", nullptr);
+	mono_dllmap_insert(nullptr, "System.Security.Cryptography.Native.Apple", nullptr, "__Internal", nullptr);
 
 #ifdef IOS_DEVICE
 	// This function is defined in an auto-generated source file
@@ -85,7 +85,7 @@ void cleanup() {
 GD_PINVOKE_EXPORT const char *xamarin_get_locale_country_code() {
 	NSLocale *locale = [NSLocale currentLocale];
 	NSString *countryCode = [locale objectForKey:NSLocaleCountryCode];
-	if (countryCode == NULL) {
+	if (countryCode == nullptr) {
 		return strdup("US");
 	}
 	return strdup([countryCode UTF8String]);

+ 1 - 1
modules/visual_script/visual_script.cpp

@@ -1607,7 +1607,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
 			}
 
 			next = node->sequence_outputs[output];
-			VSDEBUG("GOT NEXT NODE - " + (next ? itos(next->get_id()) : "NULL"));
+			VSDEBUG("GOT NEXT NODE - " + (next ? itos(next->get_id()) : "Null"));
 		}
 
 		if (flow_stack) {

+ 1 - 1
modules/webxr/webxr_interface_js.cpp

@@ -253,7 +253,7 @@ bool WebXRInterfaceJS::initialize() {
 void WebXRInterfaceJS::uninitialize() {
 	if (initialized) {
 		XRServer *xr_server = XRServer::get_singleton();
-		if (xr_server != NULL) {
+		if (xr_server != nullptr) {
 			// no longer our primary interface
 			xr_server->clear_primary_interface_if(this);
 		}

+ 2 - 2
platform/iphone/display_server_iphone.mm

@@ -136,13 +136,13 @@ DisplayServerIPhone::~DisplayServerIPhone() {
 		if (rendering_device_vulkan) {
 			rendering_device_vulkan->finalize();
 			memdelete(rendering_device_vulkan);
-			rendering_device_vulkan = NULL;
+			rendering_device_vulkan = nullptr;
 		}
 
 		if (context_vulkan) {
 			context_vulkan->window_destroy(MAIN_WINDOW_ID);
 			memdelete(context_vulkan);
-			context_vulkan = NULL;
+			context_vulkan = nullptr;
 		}
 	}
 #endif

+ 2 - 2
platform/iphone/godot_iphone.mm

@@ -50,7 +50,7 @@ int add_path(int p_argc, char **p_args) {
 
 	p_args[p_argc++] = (char *)"--path";
 	p_args[p_argc++] = (char *)[str cStringUsingEncoding:NSUTF8StringEncoding];
-	p_args[p_argc] = NULL;
+	p_args[p_argc] = nullptr;
 
 	return p_argc;
 };
@@ -69,7 +69,7 @@ int add_cmdline(int p_argc, char **p_args) {
 		p_args[p_argc++] = (char *)[str cStringUsingEncoding:NSUTF8StringEncoding];
 	};
 
-	p_args[p_argc] = NULL;
+	p_args[p_argc] = nullptr;
 
 	return p_argc;
 };

+ 5 - 5
platform/iphone/godot_view.mm

@@ -291,14 +291,14 @@ static const float earth_gravity = 9.80665;
 
 - (void)initTouches {
 	for (int i = 0; i < max_touches; i++) {
-		godot_touches[i] = NULL;
+		godot_touches[i] = nullptr;
 	}
 }
 
 - (int)getTouchIDForTouch:(UITouch *)p_touch {
 	int first = -1;
 	for (int i = 0; i < max_touches; i++) {
-		if (first == -1 && godot_touches[i] == NULL) {
+		if (first == -1 && godot_touches[i] == nullptr) {
 			first = i;
 			continue;
 		}
@@ -318,11 +318,11 @@ static const float earth_gravity = 9.80665;
 - (int)removeTouch:(UITouch *)p_touch {
 	int remaining = 0;
 	for (int i = 0; i < max_touches; i++) {
-		if (godot_touches[i] == NULL) {
+		if (godot_touches[i] == nullptr) {
 			continue;
 		}
 		if (godot_touches[i] == p_touch) {
-			godot_touches[i] = NULL;
+			godot_touches[i] = nullptr;
 		} else {
 			++remaining;
 		}
@@ -332,7 +332,7 @@ static const float earth_gravity = 9.80665;
 
 - (void)clearTouches {
 	for (int i = 0; i < max_touches; i++) {
-		godot_touches[i] = NULL;
+		godot_touches[i] = nullptr;
 	}
 }
 

+ 4 - 4
platform/iphone/ios.mm

@@ -56,16 +56,16 @@ void iOS::alert(const char *p_alert, const char *p_title) {
 String iOS::get_model() const {
 	// [[UIDevice currentDevice] model] only returns "iPad" or "iPhone".
 	size_t size;
-	sysctlbyname("hw.machine", NULL, &size, NULL, 0);
+	sysctlbyname("hw.machine", nullptr, &size, nullptr, 0);
 	char *model = (char *)malloc(size);
-	if (model == NULL) {
+	if (model == nullptr) {
 		return "";
 	}
-	sysctlbyname("hw.machine", model, &size, NULL, 0);
+	sysctlbyname("hw.machine", model, &size, nullptr, 0);
 	NSString *platform = [NSString stringWithCString:model encoding:NSUTF8StringEncoding];
 	free(model);
 	const char *str = [platform UTF8String];
-	return String(str != NULL ? str : "");
+	return String(str != nullptr ? str : "");
 }
 
 String iOS::get_rate_url(int p_app_id) const {

+ 2 - 2
platform/iphone/vulkan_context_iphone.mm

@@ -38,13 +38,13 @@ const char *VulkanContextIPhone::_get_platform_surface_extension() const {
 Error VulkanContextIPhone::window_create(DisplayServer::WindowID p_window_id, CALayer *p_metal_layer, int p_width, int p_height) {
 	VkIOSSurfaceCreateInfoMVK createInfo;
 	createInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK;
-	createInfo.pNext = NULL;
+	createInfo.pNext = nullptr;
 	createInfo.flags = 0;
 	createInfo.pView = (__bridge const void *)p_metal_layer;
 
 	VkSurfaceKHR surface;
 	VkResult err =
-			vkCreateIOSSurfaceMVK(_get_instance(), &createInfo, NULL, &surface);
+			vkCreateIOSSurfaceMVK(_get_instance(), &createInfo, nullptr, &surface);
 	ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
 
 	return _window_create(p_window_id, surface, p_width, p_height);

+ 10 - 10
platform/javascript/api/javascript_tools_editor_plugin.cpp

@@ -65,10 +65,10 @@ void JavaScriptToolsEditorPlugin::_download_zip(Variant p_v) {
 
 	FileAccess *src_f;
 	zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
-	zipFile zip = zipOpen2("/tmp/project.zip", APPEND_STATUS_CREATE, NULL, &io);
+	zipFile zip = zipOpen2("/tmp/project.zip", APPEND_STATUS_CREATE, nullptr, &io);
 	String base_path = resource_path.substr(0, resource_path.rfind("/")) + "/";
 	_zip_recursive(resource_path, base_path, zip);
-	zipClose(zip, NULL);
+	zipClose(zip, nullptr);
 	godot_js_editor_download_file("/tmp/project.zip", "project.zip", "application/zip");
 }
 
@@ -88,12 +88,12 @@ void JavaScriptToolsEditorPlugin::_zip_file(String p_path, String p_base_path, z
 	String path = p_path.replace_first(p_base_path, "");
 	zipOpenNewFileInZip(p_zip,
 			path.utf8().get_data(),
-			NULL,
-			NULL,
+			nullptr,
+			nullptr,
 			0,
-			NULL,
+			nullptr,
 			0,
-			NULL,
+			nullptr,
 			Z_DEFLATED,
 			Z_DEFAULT_COMPRESSION);
 	zipWriteInFileInZip(p_zip, data.ptr(), data.size());
@@ -116,12 +116,12 @@ void JavaScriptToolsEditorPlugin::_zip_recursive(String p_path, String p_base_pa
 			String path = cs.replace_first(p_base_path, "") + "/";
 			zipOpenNewFileInZip(p_zip,
 					path.utf8().get_data(),
-					NULL,
-					NULL,
+					nullptr,
+					nullptr,
 					0,
-					NULL,
+					nullptr,
 					0,
-					NULL,
+					nullptr,
 					Z_DEFLATED,
 					Z_DEFAULT_COMPRESSION);
 			zipCloseFileInZip(p_zip);

+ 3 - 3
platform/javascript/display_server_javascript.cpp

@@ -399,7 +399,7 @@ void DisplayServerJavaScript::cursor_set_custom_image(const RES &p_cursor, Curso
 		godot_js_display_cursor_set_custom_shape(godot2dom_cursor(p_shape), png.ptr(), len, p_hotspot.x, p_hotspot.y);
 
 	} else {
-		godot_js_display_cursor_set_custom_shape(godot2dom_cursor(p_shape), NULL, 0, 0, 0);
+		godot_js_display_cursor_set_custom_shape(godot2dom_cursor(p_shape), nullptr, 0, 0, 0);
 	}
 
 	cursor_set_shape(cursor_shape);
@@ -771,8 +771,8 @@ DisplayServerJavaScript::DisplayServerJavaScript(const String &p_rendering_drive
 #define SET_EM_CALLBACK(target, ev, cb)                                  \
 	result = emscripten_set_##ev##_callback(target, nullptr, true, &cb); \
 	EM_CHECK(ev)
-#define SET_EM_WINDOW_CALLBACK(ev, cb)                                                         \
-	result = emscripten_set_##ev##_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, false, &cb); \
+#define SET_EM_WINDOW_CALLBACK(ev, cb)                                                            \
+	result = emscripten_set_##ev##_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, false, &cb); \
 	EM_CHECK(ev)
 	// These callbacks from Emscripten's html5.h suffice to access most
 	// JavaScript APIs.

+ 2 - 2
platform/javascript/export/export.cpp

@@ -353,7 +353,7 @@ public:
 };
 
 Error EditorExportPlatformJavaScript::_extract_template(const String &p_template, const String &p_dir, const String &p_name, bool pwa) {
-	FileAccess *src_f = NULL;
+	FileAccess *src_f = nullptr;
 	zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
 	unzFile pkg = unzOpen2(p_template.utf8().get_data(), &io);
 
@@ -372,7 +372,7 @@ Error EditorExportPlatformJavaScript::_extract_template(const String &p_template
 		//get filename
 		unz_file_info info;
 		char fname[16384];
-		unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+		unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
 
 		String file = fname;
 

+ 5 - 5
platform/osx/crash_handler_osx.mm

@@ -70,7 +70,7 @@ static uint64_t load_address() {
 }
 
 static void handle_crash(int sig) {
-	if (OS::get_singleton() == NULL) {
+	if (OS::get_singleton() == nullptr) {
 		abort();
 	}
 
@@ -105,7 +105,7 @@ static void handle_crash(int sig) {
 			if (dladdr(bt_buffer[i], &info) && info.dli_sname) {
 				if (info.dli_sname[0] == '_') {
 					int status;
-					char *demangled = abi::__cxa_demangle(info.dli_sname, NULL, 0, &status);
+					char *demangled = abi::__cxa_demangle(info.dli_sname, nullptr, 0, &status);
 
 					if (status == 0 && demangled) {
 						snprintf(fname, 1024, "%s", demangled);
@@ -167,9 +167,9 @@ void CrashHandler::disable() {
 		return;
 
 #ifdef CRASH_HANDLER_ENABLED
-	signal(SIGSEGV, NULL);
-	signal(SIGFPE, NULL);
-	signal(SIGILL, NULL);
+	signal(SIGSEGV, nullptr);
+	signal(SIGFPE, nullptr);
+	signal(SIGILL, nullptr);
 #endif
 
 	disabled = true;

+ 13 - 13
platform/osx/display_server_osx.mm

@@ -1640,7 +1640,7 @@ String DisplayServerOSX::get_name() const {
 }
 
 const NSMenu *DisplayServerOSX::_get_menu_root(const String &p_menu_root) const {
-	const NSMenu *menu = NULL;
+	const NSMenu *menu = nullptr;
 	if (p_menu_root == "") {
 		// Main menu.x
 		menu = [NSApp mainMenu];
@@ -1655,13 +1655,13 @@ const NSMenu *DisplayServerOSX::_get_menu_root(const String &p_menu_root) const
 	}
 	if (menu == apple_menu) {
 		// Do not allow to change Apple menu.
-		return NULL;
+		return nullptr;
 	}
 	return menu;
 }
 
 NSMenu *DisplayServerOSX::_get_menu_root(const String &p_menu_root) {
-	NSMenu *menu = NULL;
+	NSMenu *menu = nullptr;
 	if (p_menu_root == "") {
 		// Main menu.
 		menu = [NSApp mainMenu];
@@ -1678,7 +1678,7 @@ NSMenu *DisplayServerOSX::_get_menu_root(const String &p_menu_root) {
 	}
 	if (menu == apple_menu) {
 		// Do not allow to change Apple menu.
-		return NULL;
+		return nullptr;
 	}
 	return menu;
 }
@@ -3029,7 +3029,7 @@ void DisplayServerOSX::cursor_set_shape(CursorShape p_shape) {
 		return;
 	}
 
-	if (cursors[p_shape] != NULL) {
+	if (cursors[p_shape] != nullptr) {
 		[cursors[p_shape] set];
 	} else {
 		switch (p_shape) {
@@ -3202,9 +3202,9 @@ void DisplayServerOSX::cursor_set_custom_image(const RES &p_cursor, CursorShape
 		[nsimage release];
 	} else {
 		// Reset to default system cursor
-		if (cursors[p_shape] != NULL) {
+		if (cursors[p_shape] != nullptr) {
 			[cursors[p_shape] release];
-			cursors[p_shape] = NULL;
+			cursors[p_shape] = nullptr;
 		}
 
 		CursorShape c = cursor_shape;
@@ -3759,12 +3759,12 @@ DisplayServerOSX::DisplayServerOSX(const String &p_rendering_driver, WindowMode
 
 	// Register to be notified on keyboard layout changes
 	CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(),
-			NULL, keyboard_layout_changed,
-			kTISNotifySelectedKeyboardInputSourceChanged, NULL,
+			nullptr, keyboard_layout_changed,
+			kTISNotifySelectedKeyboardInputSourceChanged, nullptr,
 			CFNotificationSuspensionBehaviorDeliverImmediately);
 
 	// Register to be notified on displays arrangement changes
-	CGDisplayRegisterReconfigurationCallback(displays_arrangement_changed, NULL);
+	CGDisplayRegisterReconfigurationCallback(displays_arrangement_changed, nullptr);
 
 	// Menu bar setup must go between sharedApplication above and
 	// finishLaunching below, in order to properly emulate the behavior
@@ -3854,7 +3854,7 @@ DisplayServerOSX::DisplayServerOSX(const String &p_rendering_driver, WindowMode
 		context_vulkan = memnew(VulkanContextOSX);
 		if (context_vulkan->initialize() != OK) {
 			memdelete(context_vulkan);
-			context_vulkan = NULL;
+			context_vulkan = nullptr;
 			r_error = ERR_CANT_CREATE;
 			ERR_FAIL_MSG("Could not initialize Vulkan");
 		}
@@ -3926,8 +3926,8 @@ DisplayServerOSX::~DisplayServerOSX() {
 	}
 #endif
 
-	CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL);
-	CGDisplayRemoveReconfigurationCallback(displays_arrangement_changed, NULL);
+	CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), nullptr, kTISNotifySelectedKeyboardInputSourceChanged, nullptr);
+	CGDisplayRemoveReconfigurationCallback(displays_arrangement_changed, nullptr);
 
 	cursors_cache.clear();
 }

+ 3 - 3
platform/osx/os_osx.mm

@@ -101,7 +101,7 @@ String OS_OSX::get_unique_id() const {
 
 	if (serial_number.is_empty()) {
 		io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
-		CFStringRef serialNumberAsCFString = NULL;
+		CFStringRef serialNumberAsCFString = nullptr;
 		if (platformExpert) {
 			serialNumberAsCFString = (CFStringRef)IORegistryEntryCreateCFProperty(platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0);
 			IOObjectRelease(platformExpert);
@@ -158,7 +158,7 @@ void OS_OSX::delete_main_loop() {
 	if (!main_loop)
 		return;
 	memdelete(main_loop);
-	main_loop = NULL;
+	main_loop = nullptr;
 }
 
 String OS_OSX::get_name() const {
@@ -346,7 +346,7 @@ Error OS_OSX::move_to_trash(const String &p_path) {
 }
 
 OS_OSX::OS_OSX() {
-	main_loop = NULL;
+	main_loop = nullptr;
 	force_quit = false;
 
 	Vector<Logger *> loggers;

+ 2 - 2
platform/osx/vulkan_context_osx.mm

@@ -38,12 +38,12 @@ const char *VulkanContextOSX::_get_platform_surface_extension() const {
 Error VulkanContextOSX::window_create(DisplayServer::WindowID p_window_id, id p_window, int p_width, int p_height) {
 	VkMacOSSurfaceCreateInfoMVK createInfo;
 	createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK;
-	createInfo.pNext = NULL;
+	createInfo.pNext = nullptr;
 	createInfo.flags = 0;
 	createInfo.pView = p_window;
 
 	VkSurfaceKHR surface;
-	VkResult err = vkCreateMacOSSurfaceMVK(_get_instance(), &createInfo, NULL, &surface);
+	VkResult err = vkCreateMacOSSurfaceMVK(_get_instance(), &createInfo, nullptr, &surface);
 	ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
 	return _window_create(p_window_id, surface, p_width, p_height);
 }

+ 6 - 6
platform/windows/display_server_windows.cpp

@@ -1419,13 +1419,13 @@ void DisplayServerWindows::enable_for_stealing_focus(OS::ProcessID pid) {
 }
 
 int DisplayServerWindows::keyboard_get_layout_count() const {
-	return GetKeyboardLayoutList(0, NULL);
+	return GetKeyboardLayoutList(0, nullptr);
 }
 
 int DisplayServerWindows::keyboard_get_current_layout() const {
 	HKL cur_layout = GetKeyboardLayout(0);
 
-	int layout_count = GetKeyboardLayoutList(0, NULL);
+	int layout_count = GetKeyboardLayoutList(0, nullptr);
 	HKL *layouts = (HKL *)memalloc(layout_count * sizeof(HKL));
 	GetKeyboardLayoutList(layout_count, layouts);
 
@@ -1440,7 +1440,7 @@ int DisplayServerWindows::keyboard_get_current_layout() const {
 }
 
 void DisplayServerWindows::keyboard_set_current_layout(int p_index) {
-	int layout_count = GetKeyboardLayoutList(0, NULL);
+	int layout_count = GetKeyboardLayoutList(0, nullptr);
 
 	ERR_FAIL_INDEX(p_index, layout_count);
 
@@ -1451,7 +1451,7 @@ void DisplayServerWindows::keyboard_set_current_layout(int p_index) {
 }
 
 String DisplayServerWindows::keyboard_get_layout_language(int p_index) const {
-	int layout_count = GetKeyboardLayoutList(0, NULL);
+	int layout_count = GetKeyboardLayoutList(0, nullptr);
 
 	ERR_FAIL_INDEX_V(p_index, layout_count, "");
 
@@ -1481,7 +1481,7 @@ String _get_full_layout_name_from_registry(HKL p_layout) {
 
 	DWORD buffer = 1024;
 	DWORD vtype = REG_SZ;
-	if (RegQueryValueExW(hkey, L"Layout Text", NULL, &vtype, (LPBYTE)layout_text, &buffer) == ERROR_SUCCESS) {
+	if (RegQueryValueExW(hkey, L"Layout Text", nullptr, &vtype, (LPBYTE)layout_text, &buffer) == ERROR_SUCCESS) {
 		ret = String::utf16((const char16_t *)layout_text);
 	}
 	RegCloseKey(hkey);
@@ -1489,7 +1489,7 @@ String _get_full_layout_name_from_registry(HKL p_layout) {
 }
 
 String DisplayServerWindows::keyboard_get_layout_name(int p_index) const {
-	int layout_count = GetKeyboardLayoutList(0, NULL);
+	int layout_count = GetKeyboardLayoutList(0, nullptr);
 
 	ERR_FAIL_INDEX_V(p_index, layout_count, "");
 

+ 1 - 1
tests/test_string.h

@@ -1045,7 +1045,7 @@ TEST_CASE("[String] lstrip and rstrip") {
 
 TEST_CASE("[String] ensuring empty string into parse_utf8 passes empty string") {
 	String empty;
-	CHECK(empty.parse_utf8(NULL, -1));
+	CHECK(empty.parse_utf8(nullptr, -1));
 }
 
 TEST_CASE("[String] Cyrillic to_lower()") {