1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

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

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

View File

@@ -55,7 +55,7 @@ bool VisualScriptFunctionCall::has_input_sequence_port() const {
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
return NULL;
return nullptr;
Ref<Script> scr = p_current_node->get_script();
@@ -68,7 +68,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
return n;
}
return NULL;
return nullptr;
}
#endif
@@ -76,26 +76,26 @@ Node *VisualScriptFunctionCall::_get_base_node() const {
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
if (!script.is_valid())
return NULL;
return nullptr;
MainLoop *main_loop = OS::get_singleton()->get_main_loop();
SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop);
if (!scene_tree)
return NULL;
return nullptr;
Node *edited_scene = scene_tree->get_edited_scene_root();
if (!edited_scene)
return NULL;
return nullptr;
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
if (!script_node)
return NULL;
return nullptr;
if (!script_node->has_node(base_path))
return NULL;
return nullptr;
Node *path_to = script_node->get_node(base_path);
@@ -879,27 +879,27 @@ Node *VisualScriptPropertySet::_get_base_node() const {
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
if (!script.is_valid())
return NULL;
return nullptr;
MainLoop *main_loop = OS::get_singleton()->get_main_loop();
SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop);
if (!scene_tree)
return NULL;
return nullptr;
Node *edited_scene = scene_tree->get_edited_scene_root();
if (!edited_scene)
return NULL;
return nullptr;
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
if (!script_node)
return NULL;
return nullptr;
if (!script_node->has_node(base_path))
return NULL;
return nullptr;
Node *path_to = script_node->get_node(base_path);
@@ -939,7 +939,7 @@ void VisualScriptPropertySet::_adjust_input_index(PropertyInfo &pinfo) const {
if (index != StringName()) {
Variant v;
Variant::CallError ce;
v = Variant::construct(pinfo.type, NULL, 0, ce);
v = Variant::construct(pinfo.type, nullptr, 0, ce);
Variant i = v.get(index);
pinfo.type = i.get_type();
}
@@ -1074,7 +1074,7 @@ void VisualScriptPropertySet::_update_cache() {
Variant v;
Variant::CallError ce;
v = Variant::construct(basic_type, NULL, 0, ce);
v = Variant::construct(basic_type, nullptr, 0, ce);
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
@@ -1088,7 +1088,7 @@ void VisualScriptPropertySet::_update_cache() {
} else {
StringName type;
Ref<Script> script;
Node *node = NULL;
Node *node = nullptr;
if (call_mode == CALL_MODE_NODE_PATH) {
node = _get_base_node();
@@ -1286,7 +1286,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
if (property.name == "index") {
Variant::CallError ce;
Variant v = Variant::construct(type_cache.type, NULL, 0, ce);
Variant v = Variant::construct(type_cache.type, nullptr, 0, ce);
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
@@ -1593,27 +1593,27 @@ Node *VisualScriptPropertyGet::_get_base_node() const {
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
if (!script.is_valid())
return NULL;
return nullptr;
MainLoop *main_loop = OS::get_singleton()->get_main_loop();
SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop);
if (!scene_tree)
return NULL;
return nullptr;
Node *edited_scene = scene_tree->get_edited_scene_root();
if (!edited_scene)
return NULL;
return nullptr;
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
if (!script_node)
return NULL;
return nullptr;
if (!script_node->has_node(base_path))
return NULL;
return nullptr;
Node *path_to = script_node->get_node(base_path);
@@ -1721,7 +1721,7 @@ void VisualScriptPropertyGet::_update_cache() {
Variant v;
Variant::CallError ce;
v = Variant::construct(basic_type, NULL, 0, ce);
v = Variant::construct(basic_type, nullptr, 0, ce);
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
@@ -1736,7 +1736,7 @@ void VisualScriptPropertyGet::_update_cache() {
} else {
StringName type;
Ref<Script> script;
Node *node = NULL;
Node *node = nullptr;
if (call_mode == CALL_MODE_NODE_PATH) {
node = _get_base_node();
@@ -1940,7 +1940,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
if (property.name == "index") {
Variant::CallError ce;
Variant v = Variant::construct(type_cache, NULL, 0, ce);
Variant v = Variant::construct(type_cache, nullptr, 0, ce);
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
@@ -2287,7 +2287,7 @@ void register_visual_script_func_nodes() {
Variant::Type t = Variant::Type(i);
String type_name = Variant::get_type_name(t);
Variant::CallError ce;
Variant vt = Variant::construct(t, NULL, 0, ce);
Variant vt = Variant::construct(t, nullptr, 0, ce);
List<MethodInfo> ml;
vt.get_method_list(&ml);