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

@ -186,7 +186,7 @@ void EditorPropertyArray::_change_type_menu(int p_index) {
Variant value;
Variant::CallError ce;
value = Variant::construct(Variant::Type(p_index), NULL, 0, ce);
value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
Variant array = object->get_array();
array.set(changing_type_idx, value);
@ -247,9 +247,9 @@ void EditorPropertyArray::update_property() {
edit->set_text(String("(Nil) ") + arrtype);
edit->set_pressed(false);
if (vbox) {
set_bottom_editor(NULL);
set_bottom_editor(nullptr);
memdelete(vbox);
vbox = NULL;
vbox = nullptr;
}
return;
}
@ -322,7 +322,7 @@ void EditorPropertyArray::update_property() {
for (int i = 0; i < amount; i++) {
String prop_name = "indices/" + itos(i + offset);
EditorProperty *prop = NULL;
EditorProperty *prop = nullptr;
Variant value = array.get(i + offset);
Variant::Type value_type = value.get_type();
@ -335,7 +335,7 @@ void EditorPropertyArray::update_property() {
editor->setup("Object");
prop = editor;
} else {
prop = EditorInspector::instantiate_property_editor(NULL, value_type, "", subtype_hint, subtype_hint_string, 0);
prop = EditorInspector::instantiate_property_editor(nullptr, value_type, "", subtype_hint, subtype_hint_string, 0);
}
prop->set_object_and_property(object.ptr(), prop_name);
@ -371,9 +371,9 @@ void EditorPropertyArray::update_property() {
} else {
if (vbox) {
set_bottom_editor(NULL);
set_bottom_editor(nullptr);
memdelete(vbox);
vbox = NULL;
vbox = nullptr;
}
}
}
@ -397,7 +397,7 @@ void EditorPropertyArray::_edit_pressed() {
Variant array = get_edited_object()->get(get_edited_property());
if (!array.is_array()) {
Variant::CallError ce;
array = Variant::construct(array_type, NULL, 0, ce);
array = Variant::construct(array_type, nullptr, 0, ce);
get_edited_object()->set(get_edited_property(), array);
}
@ -428,7 +428,7 @@ void EditorPropertyArray::_length_changed(double p_page) {
for (int i = previous_size; i < size; i++) {
if (array.get(i).get_type() == Variant::NIL) {
Variant::CallError ce;
array.set(i, Variant::construct(subtype, NULL, 0, ce));
array.set(i, Variant::construct(subtype, nullptr, 0, ce));
}
}
}
@ -438,7 +438,7 @@ void EditorPropertyArray::_length_changed(double p_page) {
// Pool*Array don't initialize their elements, have to do it manually
for (int i = previous_size; i < size; i++) {
Variant::CallError ce;
array.set(i, Variant::construct(array.get(i).get_type(), NULL, 0, ce));
array.set(i, Variant::construct(array.get(i).get_type(), nullptr, 0, ce));
}
}
@ -488,9 +488,9 @@ EditorPropertyArray::EditorPropertyArray() {
edit->set_toggle_mode(true);
add_child(edit);
add_focusable(edit);
vbox = NULL;
page = NULL;
length = NULL;
vbox = nullptr;
page = nullptr;
length = nullptr;
updating = false;
change_type = memnew(PopupMenu);
add_child(change_type);
@ -562,7 +562,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
if (changing_type_idx < 0) {
Variant value;
Variant::CallError ce;
value = Variant::construct(Variant::Type(p_index), NULL, 0, ce);
value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
if (changing_type_idx == -1) {
object->set_new_item_key(value);
} else {
@ -577,7 +577,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
if (p_index < Variant::VARIANT_MAX) {
Variant value;
Variant::CallError ce;
value = Variant::construct(Variant::Type(p_index), NULL, 0, ce);
value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
Variant key = dict.get_key_at_index(changing_type_idx);
dict[key] = value;
} else {
@ -599,9 +599,9 @@ void EditorPropertyDictionary::update_property() {
edit->set_text("Dictionary (Nil)"); //This provides symmetry with the array property.
edit->set_pressed(false);
if (vbox) {
set_bottom_editor(NULL);
set_bottom_editor(nullptr);
memdelete(vbox);
vbox = NULL;
vbox = nullptr;
}
return;
}
@ -656,7 +656,7 @@ void EditorPropertyDictionary::update_property() {
dict = dict.duplicate();
object->set_dict(dict);
VBoxContainer *add_vbox = NULL;
VBoxContainer *add_vbox = nullptr;
for (int i = 0; i < amount + 2; i++) {
String prop_name;
@ -675,7 +675,7 @@ void EditorPropertyDictionary::update_property() {
value = object->get_new_item_value();
}
EditorProperty *prop = NULL;
EditorProperty *prop = nullptr;
switch (value.get_type()) {
case Variant::NIL: {
@ -897,9 +897,9 @@ void EditorPropertyDictionary::update_property() {
} else {
if (vbox) {
set_bottom_editor(NULL);
set_bottom_editor(nullptr);
memdelete(vbox);
vbox = NULL;
vbox = nullptr;
}
}
}
@ -915,7 +915,7 @@ void EditorPropertyDictionary::_edit_pressed() {
Variant prop_val = get_edited_object()->get(get_edited_property());
if (prop_val.get_type() == Variant::NIL) {
Variant::CallError ce;
prop_val = Variant::construct(Variant::DICTIONARY, NULL, 0, ce);
prop_val = Variant::construct(Variant::DICTIONARY, nullptr, 0, ce);
get_edited_object()->set(get_edited_property(), prop_val);
}
@ -951,8 +951,8 @@ EditorPropertyDictionary::EditorPropertyDictionary() {
edit->set_toggle_mode(true);
add_child(edit);
add_focusable(edit);
vbox = NULL;
page = NULL;
vbox = nullptr;
page = nullptr;
updating = false;
change_type = memnew(PopupMenu);
add_child(change_type);