From 95a1400a2ac9de1a29fa305f45b928ce8e3044bd Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Thu, 2 Apr 2020 01:20:12 +0200 Subject: Replace NULL with nullptr --- modules/mono/editor/bindings_generator.cpp | 40 +++++++++++++-------------- modules/mono/editor/bindings_generator.h | 18 ++++++------ modules/mono/editor/csharp_project.cpp | 4 +-- modules/mono/editor/editor_internal_calls.cpp | 18 ++++++------ modules/mono/editor/godotsharp_export.cpp | 10 +++---- 5 files changed, 45 insertions(+), 45 deletions(-) (limited to 'modules/mono/editor') diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 9a5de6db16..6cd10a94f9 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -411,7 +411,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf xml_output.append("\"/>"); } else { // Try to find as global enum constant - const EnumInterface *target_ienum = NULL; + const EnumInterface *target_ienum = nullptr; for (const List::Element *E = global_enums.front(); E; E = E->next()) { target_ienum = &E->get(); @@ -449,7 +449,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf xml_output.append("\"/>"); } else { // Try to find as enum constant in the current class - const EnumInterface *target_ienum = NULL; + const EnumInterface *target_ienum = nullptr; for (const List::Element *E = target_itype->enums.front(); E; E = E->next()) { target_ienum = &E->get(); @@ -782,7 +782,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) { const ConstantInterface &iconstant = E->get(); if (iconstant.const_doc && iconstant.const_doc->description.size()) { - String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), NULL); + String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), nullptr); Vector summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector(); if (summary_lines.size()) { @@ -843,7 +843,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) { const ConstantInterface &iconstant = F->get(); if (iconstant.const_doc && iconstant.const_doc->description.size()) { - String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), NULL); + String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), nullptr); Vector summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector(); if (summary_lines.size()) { @@ -1494,7 +1494,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte if (idx_arg.type.cname != name_cache.type_int) { // Assume the index parameter is an enum const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type); - CRASH_COND(idx_arg_type == NULL); + CRASH_COND(idx_arg_type == nullptr); p_output.append("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index)); } else { p_output.append(itos(p_iprop.index)); @@ -1522,7 +1522,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte if (idx_arg.type.cname != name_cache.type_int) { // Assume the index parameter is an enum const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type); - CRASH_COND(idx_arg_type == NULL); + CRASH_COND(idx_arg_type == nullptr); p_output.append("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index) + ", "); } else { p_output.append(itos(p_iprop.index) + ", "); @@ -2121,7 +2121,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte if (return_type->is_object_type) { ptrcall_return_type = return_type->is_reference ? "Ref" : return_type->c_type; - initialization = return_type->is_reference ? "" : " = NULL"; + initialization = return_type->is_reference ? "" : " = nullptr"; } else { ptrcall_return_type = return_type->c_type; } @@ -2130,10 +2130,10 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte p_output.append(" " C_LOCAL_RET); p_output.append(initialization + ";\n"); - String fail_ret = return_type->c_type_out.ends_with("*") && !return_type->ret_as_byref_arg ? "NULL" : return_type->c_type_out + "()"; + String fail_ret = return_type->c_type_out.ends_with("*") && !return_type->ret_as_byref_arg ? "nullptr" : return_type->c_type_out + "()"; if (return_type->ret_as_byref_arg) { - p_output.append("\tif (" CS_PARAM_INSTANCE " == NULL) { *arg_ret = "); + p_output.append("\tif (" CS_PARAM_INSTANCE " == nullptr) { *arg_ret = "); p_output.append(fail_ret); p_output.append("; ERR_FAIL_MSG(\"Parameter ' arg_ret ' is null.\"); }\n"); } else { @@ -2198,8 +2198,8 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte } } else { p_output.append("\t" CS_PARAM_METHODBIND "->ptrcall(" CS_PARAM_INSTANCE ", "); - p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ", " : "NULL, "); - p_output.append(!ret_void ? "&" C_LOCAL_RET ");\n" : "NULL);\n"); + p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ", " : "nullptr, "); + p_output.append(!ret_void ? "&" C_LOCAL_RET ");\n" : "nullptr);\n"); } if (!ret_void) { @@ -2241,11 +2241,11 @@ const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_null(con // Enum not found. Most likely because none of its constants were bound, so it's empty. That's fine. Use int instead. const Map::Element *int_match = builtin_types.find(name_cache.type_int); - ERR_FAIL_NULL_V(int_match, NULL); + ERR_FAIL_NULL_V(int_match, nullptr); return &int_match->get(); } - return NULL; + return nullptr; } const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_placeholder(const TypeReference &p_typeref) { @@ -2412,7 +2412,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { iprop.proxy_name = iprop.proxy_name.replace("/", "__"); // Some members have a slash... - iprop.prop_doc = NULL; + iprop.prop_doc = nullptr; for (int i = 0; i < itype.class_doc->properties.size(); i++) { const DocData::PropertyDoc &prop_doc = itype.class_doc->properties[i]; @@ -2457,7 +2457,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { PropertyInfo return_info = method_info.return_val; - MethodBind *m = imethod.is_virtual ? NULL : ClassDB::get_method(type_cname, method_info.name); + MethodBind *m = imethod.is_virtual ? nullptr : ClassDB::get_method(type_cname, method_info.name); imethod.is_vararg = m && m->is_vararg(); @@ -2603,7 +2603,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { // Populate signals const HashMap &signal_map = class_info->signal_map; - const StringName *k = NULL; + const StringName *k = nullptr; while ((k = signal_map.next(k))) { SignalInterface isignal; @@ -2685,7 +2685,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { ClassDB::get_integer_constant_list(type_cname, &constants, true); const HashMap> &enum_map = class_info->enum_map; - k = NULL; + k = nullptr; while ((k = enum_map.next(k))) { StringName enum_proxy_cname = *k; @@ -2707,7 +2707,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), *value); - iconstant.const_doc = NULL; + iconstant.const_doc = nullptr; for (int i = 0; i < itype.class_doc->constants.size(); i++) { const DocData::ConstantDoc &const_doc = itype.class_doc->constants[i]; @@ -2742,7 +2742,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), *value); - iconstant.const_doc = NULL; + iconstant.const_doc = nullptr; for (int i = 0; i < itype.class_doc->constants.size(); i++) { const DocData::ConstantDoc &const_doc = itype.class_doc->constants[i]; @@ -3262,7 +3262,7 @@ void BindingsGenerator::_populate_global_constants() { String constant_name = GlobalConstants::get_global_constant_name(i); - const DocData::ConstantDoc *const_doc = NULL; + const DocData::ConstantDoc *const_doc = nullptr; for (int j = 0; j < global_scope_doc.constants.size(); j++) { const DocData::ConstantDoc &curr_const_doc = global_scope_doc.constants[j]; diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h index bebe489d02..7c87c688db 100644 --- a/modules/mono/editor/bindings_generator.h +++ b/modules/mono/editor/bindings_generator.h @@ -176,7 +176,7 @@ class BindingsGenerator { is_virtual = false; requires_object_call = false; is_internal = false; - method_doc = NULL; + method_doc = nullptr; is_deprecated = false; } }; @@ -202,7 +202,7 @@ class BindingsGenerator { } SignalInterface() { - method_doc = NULL; + method_doc = nullptr; is_deprecated = false; } }; @@ -376,7 +376,7 @@ class BindingsGenerator { return &E->get(); } - return NULL; + return nullptr; } const PropertyInterface *find_property_by_name(const StringName &p_cname) const { @@ -385,7 +385,7 @@ class BindingsGenerator { return &E->get(); } - return NULL; + return nullptr; } const PropertyInterface *find_property_by_proxy_name(const String &p_proxy_name) const { @@ -394,7 +394,7 @@ class BindingsGenerator { return &E->get(); } - return NULL; + return nullptr; } const MethodInterface *find_method_by_proxy_name(const String &p_proxy_name) const { @@ -403,7 +403,7 @@ class BindingsGenerator { return &E->get(); } - return NULL; + return nullptr; } private: @@ -498,7 +498,7 @@ class BindingsGenerator { c_arg_in = "%s"; - class_doc = NULL; + class_doc = nullptr; } }; @@ -622,7 +622,7 @@ class BindingsGenerator { if (it->get().name == p_name) return it; it = it->next(); } - return NULL; + return nullptr; } const ConstantInterface *find_constant_by_name(const String &p_name, const List &p_constants) const { @@ -631,7 +631,7 @@ class BindingsGenerator { return &E->get(); } - return NULL; + return nullptr; } inline String get_unique_sig(const TypeInterface &p_type) { diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp index 872f45ba91..e5c2d023d3 100644 --- a/modules/mono/editor/csharp_project.cpp +++ b/modules/mono/editor/csharp_project.cpp @@ -57,8 +57,8 @@ void add_item(const String &p_project_path, const String &p_item_type, const Str Variant item_type = p_item_type; Variant include = p_include; const Variant *args[3] = { &project_path, &item_type, &include }; - MonoException *exc = NULL; - klass->get_method("AddItemToProjectChecked", 3)->invoke(NULL, args, &exc); + MonoException *exc = nullptr; + klass->get_method("AddItemToProjectChecked", 3)->invoke(nullptr, args, &exc); if (exc) { GDMonoUtils::debug_print_unhandled_exception(exc); diff --git a/modules/mono/editor/editor_internal_calls.cpp b/modules/mono/editor/editor_internal_calls.cpp index 31996a03d0..283d4beb8e 100644 --- a/modules/mono/editor/editor_internal_calls.cpp +++ b/modules/mono/editor/editor_internal_calls.cpp @@ -95,7 +95,7 @@ MonoString *godot_icall_GodotSharpDirs_MonoSolutionsDir() { #ifdef TOOLS_ENABLED return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_mono_solutions_dir()); #else - return NULL; + return nullptr; #endif } @@ -103,7 +103,7 @@ MonoString *godot_icall_GodotSharpDirs_BuildLogsDirs() { #ifdef TOOLS_ENABLED return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_build_logs_dir()); #else - return NULL; + return nullptr; #endif } @@ -111,7 +111,7 @@ MonoString *godot_icall_GodotSharpDirs_ProjectSlnPath() { #ifdef TOOLS_ENABLED return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_project_sln_path()); #else - return NULL; + return nullptr; #endif } @@ -119,7 +119,7 @@ MonoString *godot_icall_GodotSharpDirs_ProjectCsProjPath() { #ifdef TOOLS_ENABLED return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_project_csproj_path()); #else - return NULL; + return nullptr; #endif } @@ -127,7 +127,7 @@ MonoString *godot_icall_GodotSharpDirs_DataEditorToolsDir() { #ifdef TOOLS_ENABLED return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_data_editor_tools_dir()); #else - return NULL; + return nullptr; #endif } @@ -135,7 +135,7 @@ MonoString *godot_icall_GodotSharpDirs_DataEditorPrebuiltApiDir() { #ifdef TOOLS_ENABLED return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_data_editor_prebuilt_api_dir()); #else - return NULL; + return nullptr; #endif } @@ -151,7 +151,7 @@ MonoString *godot_icall_GodotSharpDirs_DataMonoBinDir() { #ifdef WINDOWS_ENABLED return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_data_mono_bin_dir()); #else - return NULL; + return nullptr; #endif } @@ -202,7 +202,7 @@ uint32_t godot_icall_BindingsGenerator_CsGlueVersion() { } int32_t godot_icall_ScriptClassParser_ParseFile(MonoString *p_filepath, MonoObject *p_classes, MonoString **r_error_str) { - *r_error_str = NULL; + *r_error_str = nullptr; String filepath = GDMonoMarshal::mono_string_to_godot(p_filepath); @@ -335,7 +335,7 @@ MonoString *godot_icall_Internal_MonoWindowsInstallRoot() { String install_root_dir = GDMono::get_singleton()->get_mono_reg_info().install_root_dir; return GDMonoMarshal::mono_string_from_godot(install_root_dir); #else - return NULL; + return nullptr; #endif } diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp index 19b3bea5cf..324013e5e2 100644 --- a/modules/mono/editor/godotsharp_export.cpp +++ b/modules/mono/editor/godotsharp_export.cpp @@ -59,7 +59,7 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector if (r_dependencies.has(ref_name)) continue; - GDMonoAssembly *ref_assembly = NULL; + GDMonoAssembly *ref_assembly = nullptr; String path; bool has_extension = ref_name.ends_with(".dll") || ref_name.ends_with(".exe"); @@ -70,21 +70,21 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector path = search_dir.plus_file(ref_name); if (FileAccess::exists(path)) { GDMono::get_singleton()->load_assembly_from(ref_name.get_basename(), path, &ref_assembly, true); - if (ref_assembly != NULL) + if (ref_assembly != nullptr) break; } } else { path = search_dir.plus_file(ref_name + ".dll"); if (FileAccess::exists(path)) { GDMono::get_singleton()->load_assembly_from(ref_name, path, &ref_assembly, true); - if (ref_assembly != NULL) + if (ref_assembly != nullptr) break; } path = search_dir.plus_file(ref_name + ".exe"); if (FileAccess::exists(path)) { GDMono::get_singleton()->load_assembly_from(ref_name, path, &ref_assembly, true); - if (ref_assembly != NULL) + if (ref_assembly != nullptr) break; } } @@ -117,7 +117,7 @@ Error get_exported_assembly_dependencies(const Dictionary &p_initial_dependencie String assembly_name = *key; String assembly_path = p_initial_dependencies[*key]; - GDMonoAssembly *assembly = NULL; + GDMonoAssembly *assembly = nullptr; bool load_success = GDMono::get_singleton()->load_assembly_from(assembly_name, assembly_path, &assembly, /* refonly: */ true); ERR_FAIL_COND_V_MSG(!load_success, ERR_CANT_RESOLVE, "Cannot load assembly (refonly): '" + assembly_name + "'."); -- cgit v1.2.3