Style: Apply clang-tidy's `modernize-use-nullptr`
This commit is contained in:
parent
65a2888057
commit
9bbe51dc27
|
@ -61,7 +61,7 @@ DynamicBVH::Node *DynamicBVH::_create_node_with_volume(Node *p_parent, const Vol
|
|||
void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
|
||||
if (!bvh_root) {
|
||||
bvh_root = p_leaf;
|
||||
p_leaf->parent = 0;
|
||||
p_leaf->parent = nullptr;
|
||||
} else {
|
||||
if (!p_root->is_leaf()) {
|
||||
do {
|
||||
|
@ -71,7 +71,7 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
|
|||
} while (!p_root->is_leaf());
|
||||
}
|
||||
Node *prev = p_root->parent;
|
||||
Node *node = _create_node_with_volume(prev, p_leaf->volume.merge(p_root->volume), 0);
|
||||
Node *node = _create_node_with_volume(prev, p_leaf->volume.merge(p_root->volume), nullptr);
|
||||
if (prev) {
|
||||
prev->childs[p_root->get_index_in_parent()] = node;
|
||||
node->childs[0] = p_root;
|
||||
|
@ -85,7 +85,7 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
|
|||
break;
|
||||
}
|
||||
node = prev;
|
||||
} while (0 != (prev = node->parent));
|
||||
} while (nullptr != (prev = node->parent));
|
||||
} else {
|
||||
node->childs[0] = p_root;
|
||||
p_root->parent = node;
|
||||
|
@ -98,8 +98,8 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
|
|||
|
||||
DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
|
||||
if (leaf == bvh_root) {
|
||||
bvh_root = 0;
|
||||
return (0);
|
||||
bvh_root = nullptr;
|
||||
return (nullptr);
|
||||
} else {
|
||||
Node *parent = leaf->parent;
|
||||
Node *prev = parent->parent;
|
||||
|
@ -119,7 +119,7 @@ DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
|
|||
return (prev ? prev : bvh_root);
|
||||
} else {
|
||||
bvh_root = sibling;
|
||||
sibling->parent = 0;
|
||||
sibling->parent = nullptr;
|
||||
_delete_node(parent);
|
||||
return (bvh_root);
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ private:
|
|||
public:
|
||||
// Methods
|
||||
void clear();
|
||||
bool is_empty() const { return (0 == bvh_root); }
|
||||
bool is_empty() const { return (nullptr == bvh_root); }
|
||||
void optimize_bottom_up();
|
||||
void optimize_top_down(int bu_threshold = 128);
|
||||
void optimize_incremental(int passes);
|
||||
|
|
|
@ -505,7 +505,7 @@ Error VulkanContext::_check_capabilities() {
|
|||
if (func != nullptr) {
|
||||
VkPhysicalDeviceSubgroupProperties subgroupProperties;
|
||||
subgroupProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;
|
||||
subgroupProperties.pNext = NULL;
|
||||
subgroupProperties.pNext = nullptr;
|
||||
|
||||
VkPhysicalDeviceProperties2 physicalDeviceProperties;
|
||||
physicalDeviceProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||
|
|
|
@ -2570,9 +2570,9 @@ void EditorInspector::_update_script_class_properties(const Object &p_object, Li
|
|||
}
|
||||
|
||||
// Script Variables -> to insert: NodeC..B..A -> bottom (insert_here)
|
||||
List<PropertyInfo>::Element *script_variables = NULL;
|
||||
List<PropertyInfo>::Element *bottom = NULL;
|
||||
List<PropertyInfo>::Element *insert_here = NULL;
|
||||
List<PropertyInfo>::Element *script_variables = nullptr;
|
||||
List<PropertyInfo>::Element *bottom = nullptr;
|
||||
List<PropertyInfo>::Element *insert_here = nullptr;
|
||||
for (List<PropertyInfo>::Element *E = r_list.front(); E; E = E->next()) {
|
||||
PropertyInfo &pi = E->get();
|
||||
if (pi.name != "Script Variables") {
|
||||
|
|
|
@ -94,7 +94,7 @@ Node3D *EditorSceneImporterFBX::import_scene(const String &p_path, uint32_t p_fl
|
|||
Error err;
|
||||
FileAccessRef f = FileAccess::open(p_path, FileAccess::READ, &err);
|
||||
|
||||
ERR_FAIL_COND_V(!f, NULL);
|
||||
ERR_FAIL_COND_V(!f, nullptr);
|
||||
|
||||
{
|
||||
PackedByteArray data;
|
||||
|
@ -334,7 +334,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
|
|||
ImportState state;
|
||||
state.is_blender_fbx = p_is_blender_fbx;
|
||||
state.path = p_path;
|
||||
state.animation_player = NULL;
|
||||
state.animation_player = nullptr;
|
||||
|
||||
// create new root node for scene
|
||||
Node3D *scene_root = memnew(Node3D);
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
|
||||
virtual void get_extensions(List<String> *r_extensions) const override;
|
||||
virtual uint32_t get_import_flags() const override;
|
||||
virtual Node3D *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL) override;
|
||||
virtual Node3D *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr) override;
|
||||
};
|
||||
|
||||
#endif // TOOLS_ENABLED
|
||||
|
|
|
@ -670,7 +670,7 @@ public:
|
|||
|
||||
uint8_t *RelinquishContent() {
|
||||
uint8_t *ptr = content;
|
||||
content = 0;
|
||||
content = nullptr;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -267,10 +267,10 @@ LayeredTexture::LayeredTexture(uint64_t id, const ElementPtr element, const Docu
|
|||
ElementPtr BlendModes = sc->GetElement("BlendModes");
|
||||
ElementPtr Alphas = sc->GetElement("Alphas");
|
||||
|
||||
if (BlendModes != 0) {
|
||||
if (BlendModes != nullptr) {
|
||||
blendMode = (BlendMode)ParseTokenAsInt(GetRequiredToken(BlendModes, 0));
|
||||
}
|
||||
if (Alphas != 0) {
|
||||
if (Alphas != nullptr) {
|
||||
alpha = ParseTokenAsFloat(GetRequiredToken(Alphas, 0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ inline bool IsLineEnd(char_t c) {
|
|||
// Special version of the function, providing higher accuracy and safety
|
||||
// It is mainly used by fast_atof to prevent ugly and unwanted integer overflows.
|
||||
// ------------------------------------------------------------------------------------
|
||||
inline uint64_t strtoul10_64(const char *in, bool &errored, const char **out = 0, unsigned int *max_inout = 0) {
|
||||
inline uint64_t strtoul10_64(const char *in, bool &errored, const char **out = nullptr, unsigned int *max_inout = nullptr) {
|
||||
unsigned int cur = 0;
|
||||
uint64_t value = 0;
|
||||
|
||||
|
|
|
@ -2301,7 +2301,7 @@ GDScriptLanguage::~GDScriptLanguage() {
|
|||
script->unreference();
|
||||
}
|
||||
|
||||
singleton = NULL;
|
||||
singleton = nullptr;
|
||||
}
|
||||
|
||||
void GDScriptLanguage::add_orphan_subclass(const String &p_qualified_name, const ObjectID &p_subclass) {
|
||||
|
|
|
@ -1037,7 +1037,7 @@ static void _find_identifiers(GDScriptParser::CompletionContext &p_context, bool
|
|||
static const char *_keywords[] = {
|
||||
"false", "PI", "TAU", "INF", "NAN", "self", "true", "breakpoint", "tool", "super",
|
||||
"break", "continue", "pass", "return",
|
||||
0
|
||||
nullptr
|
||||
};
|
||||
|
||||
const char **kw = _keywords;
|
||||
|
@ -1050,7 +1050,7 @@ static void _find_identifiers(GDScriptParser::CompletionContext &p_context, bool
|
|||
static const char *_keywords_with_space[] = {
|
||||
"and", "in", "not", "or", "as", "class", "extends", "is", "func", "signal", "await",
|
||||
"const", "enum", "static", "var", "if", "elif", "else", "for", "match", "while",
|
||||
0
|
||||
nullptr
|
||||
};
|
||||
|
||||
const char **kws = _keywords_with_space;
|
||||
|
@ -1063,7 +1063,7 @@ static void _find_identifiers(GDScriptParser::CompletionContext &p_context, bool
|
|||
|
||||
static const char *_keywords_with_args[] = {
|
||||
"assert", "preload",
|
||||
0
|
||||
nullptr
|
||||
};
|
||||
|
||||
const char **kwa = _keywords_with_args;
|
||||
|
@ -2892,7 +2892,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
|
|||
v = v_ref;
|
||||
} else {
|
||||
Callable::CallError err;
|
||||
Variant::construct(base_type.builtin_type, v, NULL, 0, err);
|
||||
Variant::construct(base_type.builtin_type, v, nullptr, 0, err);
|
||||
if (err.error != Callable::CallError::CALL_OK) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -64,8 +64,8 @@ public:
|
|||
virtual void get_extensions(List<String> *r_extensions) const override;
|
||||
virtual Node *import_scene(const String &p_path, uint32_t p_flags,
|
||||
int p_bake_fps,
|
||||
List<String> *r_missing_deps = NULL,
|
||||
Error *r_err = NULL) override;
|
||||
List<String> *r_missing_deps = nullptr,
|
||||
Error *r_err = nullptr) override;
|
||||
virtual Ref<Animation> import_animation(const String &p_path,
|
||||
uint32_t p_flags, int p_bake_fps) override;
|
||||
};
|
||||
|
@ -80,7 +80,7 @@ protected:
|
|||
public:
|
||||
virtual void save_scene(Node *p_node, const String &p_path, const String &p_src_path,
|
||||
uint32_t p_flags, int p_bake_fps,
|
||||
List<String> *r_missing_deps, Error *r_err = NULL);
|
||||
List<String> *r_missing_deps, Error *r_err = nullptr);
|
||||
virtual void _build_parent_hierachy(Ref<GLTFState> state);
|
||||
virtual Error export_gltf(Node *p_root, String p_path, int32_t p_flags = 0,
|
||||
real_t p_bake_fps = 1000.0f);
|
||||
|
|
|
@ -231,7 +231,7 @@ Dictionary DynamicFontDataAdvanced::get_feature_list() const {
|
|||
|
||||
Dictionary out;
|
||||
// Read feature flags.
|
||||
unsigned int count = hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, NULL, NULL);
|
||||
unsigned int count = hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, nullptr, nullptr);
|
||||
if (count != 0) {
|
||||
hb_tag_t *feature_tags = (hb_tag_t *)memalloc(count * sizeof(hb_tag_t));
|
||||
hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, &count, feature_tags);
|
||||
|
@ -240,7 +240,7 @@ Dictionary DynamicFontDataAdvanced::get_feature_list() const {
|
|||
}
|
||||
memfree(feature_tags);
|
||||
}
|
||||
count = hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, NULL, NULL);
|
||||
count = hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, nullptr, nullptr);
|
||||
if (count != 0) {
|
||||
hb_tag_t *feature_tags = (hb_tag_t *)memalloc(count * sizeof(hb_tag_t));
|
||||
hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, &count, feature_tags);
|
||||
|
@ -639,7 +639,7 @@ bool DynamicFontDataAdvanced::is_script_supported(uint32_t p_script) const {
|
|||
DataAtSize *fds = const_cast<DynamicFontDataAdvanced *>(this)->get_data_for_size(base_size);
|
||||
ERR_FAIL_COND_V(fds == nullptr, false);
|
||||
|
||||
unsigned int count = hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, NULL, NULL);
|
||||
unsigned int count = hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, nullptr, nullptr);
|
||||
if (count != 0) {
|
||||
hb_tag_t *script_tags = (hb_tag_t *)memalloc(count * sizeof(hb_tag_t));
|
||||
hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, &count, script_tags);
|
||||
|
@ -651,7 +651,7 @@ bool DynamicFontDataAdvanced::is_script_supported(uint32_t p_script) const {
|
|||
}
|
||||
memfree(script_tags);
|
||||
}
|
||||
count = hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, NULL, NULL);
|
||||
count = hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, nullptr, nullptr);
|
||||
if (count != 0) {
|
||||
hb_tag_t *script_tags = (hb_tag_t *)memalloc(count * sizeof(hb_tag_t));
|
||||
hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, &count, script_tags);
|
||||
|
|
|
@ -2050,12 +2050,12 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
|
|||
|
||||
instance->id = F->get();
|
||||
instance->input_port_count = node->get_input_value_port_count();
|
||||
instance->input_ports = NULL;
|
||||
instance->input_ports = nullptr;
|
||||
instance->output_port_count = node->get_output_value_port_count();
|
||||
instance->output_ports = NULL;
|
||||
instance->output_ports = nullptr;
|
||||
instance->sequence_output_count = node->get_output_sequence_port_count();
|
||||
instance->sequence_index = function.node_count++;
|
||||
instance->sequence_outputs = NULL;
|
||||
instance->sequence_outputs = nullptr;
|
||||
instance->pass_idx = -1;
|
||||
|
||||
if (instance->input_port_count) {
|
||||
|
@ -2075,7 +2075,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
|
|||
if (instance->sequence_output_count) {
|
||||
instance->sequence_outputs = memnew_arr(VisualScriptNodeInstance *, instance->sequence_output_count);
|
||||
for (int i = 0; i < instance->sequence_output_count; i++) {
|
||||
instance->sequence_outputs[i] = NULL; // If it remains null, flow ends here.
|
||||
instance->sequence_outputs[i] = nullptr; // If it remains null, flow ends here.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2484,7 +2484,7 @@ public:
|
|||
_clear_assets_directory();
|
||||
if (!apk_expansion) {
|
||||
print_verbose("Exporting project files..");
|
||||
err = export_project_files(p_preset, rename_and_store_file_in_gradle_project, NULL, ignore_so_file);
|
||||
err = export_project_files(p_preset, rename_and_store_file_in_gradle_project, nullptr, ignore_so_file);
|
||||
if (err != OK) {
|
||||
EditorNode::add_io_error("Could not export project files to gradle project\n");
|
||||
return err;
|
||||
|
@ -2813,11 +2813,11 @@ public:
|
|||
zipOpenNewFileInZip(unaligned_apk,
|
||||
"assets/_cl_",
|
||||
&zipfi,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0, // No compress (little size gain and potentially slower startup)
|
||||
Z_DEFAULT_COMPRESSION);
|
||||
zipWriteInFileInZip(unaligned_apk, command_line_flags.ptr(), command_line_flags.size());
|
||||
|
|
|
@ -550,7 +550,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
|
|||
if (f) {
|
||||
file_sizes[pck_path.get_file()] = (uint64_t)f->get_len();
|
||||
memdelete(f);
|
||||
f = NULL;
|
||||
f = nullptr;
|
||||
}
|
||||
_fix_html(html, p_preset, p_path.get_file().get_basename(), p_debug, p_flags, shared_objects, file_sizes);
|
||||
f = FileAccess::open(p_path, FileAccess::WRITE);
|
||||
|
|
|
@ -2012,7 +2012,7 @@ int DisplayServerX11::keyboard_get_layout_count() const {
|
|||
XkbGetNames(x11_display, XkbSymbolsNameMask, kbd);
|
||||
|
||||
const Atom *groups = kbd->names->groups;
|
||||
if (kbd->ctrls != NULL) {
|
||||
if (kbd->ctrls != nullptr) {
|
||||
_group_count = kbd->ctrls->num_groups;
|
||||
} else {
|
||||
while (_group_count < XkbNumKbdGroups && groups[_group_count] != None) {
|
||||
|
@ -2046,7 +2046,7 @@ String DisplayServerX11::keyboard_get_layout_language(int p_index) const {
|
|||
|
||||
int _group_count = 0;
|
||||
const Atom *groups = kbd->names->groups;
|
||||
if (kbd->ctrls != NULL) {
|
||||
if (kbd->ctrls != nullptr) {
|
||||
_group_count = kbd->ctrls->num_groups;
|
||||
} else {
|
||||
while (_group_count < XkbNumKbdGroups && groups[_group_count] != None) {
|
||||
|
@ -2085,7 +2085,7 @@ String DisplayServerX11::keyboard_get_layout_name(int p_index) const {
|
|||
|
||||
int _group_count = 0;
|
||||
const Atom *groups = kbd->names->groups;
|
||||
if (kbd->ctrls != NULL) {
|
||||
if (kbd->ctrls != nullptr) {
|
||||
_group_count = kbd->ctrls->num_groups;
|
||||
} else {
|
||||
while (_group_count < XkbNumKbdGroups && groups[_group_count] != None) {
|
||||
|
@ -2684,7 +2684,7 @@ bool DisplayServerX11::_wait_for_events() const {
|
|||
tv.tv_sec = 1;
|
||||
|
||||
// Wait for next event or timeout.
|
||||
int num_ready_fds = select(x11_fd + 1, &in_fds, NULL, NULL, &tv);
|
||||
int num_ready_fds = select(x11_fd + 1, &in_fds, nullptr, nullptr, &tv);
|
||||
|
||||
if (num_ready_fds > 0) {
|
||||
// Event received.
|
||||
|
|
|
@ -178,7 +178,7 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
|
|||
select() ensured that this will not block. */
|
||||
dev = udev_monitor_receive_device(mon);
|
||||
|
||||
if (dev && udev_device_get_devnode(dev) != 0) {
|
||||
if (dev && udev_device_get_devnode(dev) != nullptr) {
|
||||
MutexLock lock(joy_mutex);
|
||||
String action = udev_device_get_action(dev);
|
||||
const char *devnode = udev_device_get_devnode(dev);
|
||||
|
@ -212,7 +212,7 @@ void JoypadLinux::monitor_joypads() {
|
|||
struct dirent *current;
|
||||
char fname[64];
|
||||
|
||||
while ((current = readdir(input_directory)) != NULL) {
|
||||
while ((current = readdir(input_directory)) != nullptr) {
|
||||
if (strncmp(current->d_name, "event", 5) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -454,7 +454,7 @@ void HTTPRequest::_request_done(int p_status, int p_code, const PackedStringArra
|
|||
is_compressed = false;
|
||||
}
|
||||
|
||||
const PackedByteArray *data = NULL;
|
||||
const PackedByteArray *data = nullptr;
|
||||
|
||||
if (accept_gzip && is_compressed && p_data.size() > 0) {
|
||||
// Decompress request body
|
||||
|
|
|
@ -232,7 +232,7 @@ void Step3DSW::step(Space3DSW *p_space, real_t p_delta, int p_iterations) {
|
|||
if (c->get_island_step() == _step)
|
||||
continue;
|
||||
c->set_island_step(_step);
|
||||
c->set_island_next(NULL);
|
||||
c->set_island_next(nullptr);
|
||||
c->set_island_list_next(constraint_island_list);
|
||||
constraint_island_list = c;
|
||||
}
|
||||
|
|
|
@ -6825,7 +6825,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
|||
} else {
|
||||
_set_tkpos(pos2);
|
||||
|
||||
Node *n = _parse_and_reduce_expression(NULL, FunctionInfo());
|
||||
Node *n = _parse_and_reduce_expression(nullptr, FunctionInfo());
|
||||
if (!n || n->type != Node::TYPE_CONSTANT || n->get_datatype() != TYPE_INT) {
|
||||
_set_error("Expected single integer constant > 0");
|
||||
return ERR_PARSE_ERROR;
|
||||
|
@ -6906,7 +6906,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
|||
|
||||
if (tk.type == TK_PARENTHESIS_OPEN || curly) { // initialization
|
||||
while (true) {
|
||||
Node *n = _parse_and_reduce_expression(NULL, FunctionInfo());
|
||||
Node *n = _parse_and_reduce_expression(nullptr, FunctionInfo());
|
||||
if (!n) {
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
@ -6961,7 +6961,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
|||
constant.initializer = static_cast<ConstantNode *>(expr);
|
||||
} else {
|
||||
//variable created with assignment! must parse an expression
|
||||
Node *expr = _parse_and_reduce_expression(NULL, FunctionInfo());
|
||||
Node *expr = _parse_and_reduce_expression(nullptr, FunctionInfo());
|
||||
if (!expr)
|
||||
return ERR_PARSE_ERROR;
|
||||
if (expr->type == Node::TYPE_OPERATOR && ((OperatorNode *)expr)->op == OP_CALL) {
|
||||
|
|
Loading…
Reference in New Issue