diff options
author | lupoDharkael <izhe@hotmail.es> | 2020-04-02 01:20:12 +0200 |
---|---|---|
committer | lupoDharkael <izhe@hotmail.es> | 2020-04-02 13:38:00 +0200 |
commit | 95a1400a2ac9de1a29fa305f45b928ce8e3044bd (patch) | |
tree | be0cd59e5a90926e9d653fed9f3b1b77e735ca2f /main | |
parent | 5f11e1557156617366d2c316a97716172103980d (diff) |
Replace NULL with nullptr
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 54 | ||||
-rw-r--r-- | main/performance.cpp | 2 | ||||
-rw-r--r-- | main/tests/test_astar.cpp | 4 | ||||
-rw-r--r-- | main/tests/test_gdscript.cpp | 20 | ||||
-rw-r--r-- | main/tests/test_main.cpp | 8 | ||||
-rw-r--r-- | main/tests/test_math.cpp | 10 | ||||
-rw-r--r-- | main/tests/test_oa_hash_map.cpp | 2 | ||||
-rw-r--r-- | main/tests/test_ordered_hash_map.cpp | 4 | ||||
-rw-r--r-- | main/tests/test_shader_lang.cpp | 8 | ||||
-rw-r--r-- | main/tests/test_string.cpp | 6 |
10 files changed, 59 insertions, 59 deletions
diff --git a/main/main.cpp b/main/main.cpp index 89c8832731..2a525dbe5a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -87,29 +87,29 @@ // Singletons // Initialized in setup() -static Engine *engine = NULL; -static ProjectSettings *globals = NULL; -static InputFilter *input = NULL; -static InputMap *input_map = NULL; -static TranslationServer *translation_server = NULL; -static Performance *performance = NULL; -static PackedData *packed_data = NULL; +static Engine *engine = nullptr; +static ProjectSettings *globals = nullptr; +static InputFilter *input = nullptr; +static InputMap *input_map = nullptr; +static TranslationServer *translation_server = nullptr; +static Performance *performance = nullptr; +static PackedData *packed_data = nullptr; #ifdef MINIZIP_ENABLED -static ZipArchive *zip_packed_data = NULL; +static ZipArchive *zip_packed_data = nullptr; #endif -static FileAccessNetworkClient *file_access_network_client = NULL; -static MessageQueue *message_queue = NULL; +static FileAccessNetworkClient *file_access_network_client = nullptr; +static MessageQueue *message_queue = nullptr; // Initialized in setup2() -static AudioServer *audio_server = NULL; -static DisplayServer *display_server = NULL; -static RenderingServer *rendering_server = NULL; -static CameraServer *camera_server = NULL; -static ARVRServer *arvr_server = NULL; -static PhysicsServer3D *physics_server = NULL; -static PhysicsServer2D *physics_2d_server = NULL; -static NavigationServer3D *navigation_server = NULL; -static NavigationServer2D *navigation_2d_server = NULL; +static AudioServer *audio_server = nullptr; +static DisplayServer *display_server = nullptr; +static RenderingServer *rendering_server = nullptr; +static CameraServer *camera_server = nullptr; +static ARVRServer *arvr_server = nullptr; +static PhysicsServer3D *physics_server = nullptr; +static PhysicsServer2D *physics_2d_server = nullptr; +static NavigationServer3D *navigation_server = nullptr; +static NavigationServer2D *navigation_2d_server = nullptr; // We error out if setup2() doesn't turn this true static bool _start_success = false; @@ -220,7 +220,7 @@ void finalize_display() { } void initialize_navigation_server() { - ERR_FAIL_COND(navigation_server != NULL); + ERR_FAIL_COND(navigation_server != nullptr); navigation_server = NavigationServer3DManager::new_default_server(); navigation_2d_server = memnew(NavigationServer2D); @@ -228,10 +228,10 @@ void initialize_navigation_server() { void finalize_navigation_server() { memdelete(navigation_server); - navigation_server = NULL; + navigation_server = nullptr; memdelete(navigation_2d_server); - navigation_2d_server = NULL; + navigation_2d_server = nullptr; } //#define DEBUG_INIT @@ -1642,7 +1642,7 @@ bool Main::start() { game_path = GLOBAL_DEF("application/run/main_scene", ""); } - MainLoop *main_loop = NULL; + MainLoop *main_loop = nullptr; if (editor) { main_loop = memnew(SceneTree); }; @@ -1772,7 +1772,7 @@ bool Main::start() { RES res = ResourceLoader::load(path); ERR_CONTINUE_MSG(res.is_null(), "Can't autoload: " + path); - Node *n = NULL; + Node *n = nullptr; if (res->is_class("PackedScene")) { Ref<PackedScene> ps = res; n = ps->instance(); @@ -1784,7 +1784,7 @@ bool Main::start() { Object *obj = ClassDB::instance(ibt); - ERR_CONTINUE_MSG(obj == NULL, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt)); + ERR_CONTINUE_MSG(obj == nullptr, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt)); n = Object::cast_to<Node>(obj); n->set_script(script_res); @@ -1811,7 +1811,7 @@ bool Main::start() { } #ifdef TOOLS_ENABLED - EditorNode *editor_node = NULL; + EditorNode *editor_node = nullptr; if (editor) { editor_node = memnew(EditorNode); sml->get_root()->add_child(editor_node); @@ -1961,7 +1961,7 @@ bool Main::start() { Crypto::load_default_certificates(GLOBAL_DEF("network/ssl/certificates", "")); if (game_path != "") { - Node *scene = NULL; + Node *scene = nullptr; Ref<PackedScene> scenedata = ResourceLoader::load(local_game_path); if (scenedata.is_valid()) scene = scenedata->instance(); diff --git a/main/performance.cpp b/main/performance.cpp index 335407c9eb..3ca7d7bed8 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -39,7 +39,7 @@ #include "servers/physics_server_3d.h" #include "servers/rendering_server.h" -Performance *Performance::singleton = NULL; +Performance *Performance::singleton = nullptr; void Performance::_bind_methods() { diff --git a/main/tests/test_astar.cpp b/main/tests/test_astar.cpp index e82d885af2..e0b4a7f2c8 100644 --- a/main/tests/test_astar.cpp +++ b/main/tests/test_astar.cpp @@ -351,7 +351,7 @@ TestFunc test_funcs[] = { test_abcx, test_add_remove, test_solutions, - NULL + nullptr }; MainLoop *test() { @@ -370,7 +370,7 @@ MainLoop *test() { } OS::get_singleton()->print("\n"); OS::get_singleton()->print("Passed %i of %i tests\n", passed, count); - return NULL; + return nullptr; } } // namespace TestAStar diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 0e7c45f603..971460c655 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -396,7 +396,7 @@ static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_i } } -static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, int p_indent, GDScriptParser::BlockNode *p_initializer = NULL) { +static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, int p_indent, GDScriptParser::BlockNode *p_initializer = nullptr) { String txt; if (p_func->_static) @@ -947,17 +947,17 @@ MainLoop *test(TestType p_type) { List<String> cmdlargs = OS::get_singleton()->get_cmdline_args(); if (cmdlargs.empty()) { - return NULL; + return nullptr; } String test = cmdlargs.back()->get(); if (!test.ends_with(".gd") && !test.ends_with(".gdc")) { print_line("This test expects a path to a GDScript file as its last parameter. Got: " + test); - return NULL; + return nullptr; } FileAccess *fa = FileAccess::open(test, FileAccess::READ); - ERR_FAIL_COND_V_MSG(!fa, NULL, "Could not open file: " + test); + ERR_FAIL_COND_V_MSG(!fa, nullptr, "Could not open file: " + test); Vector<uint8_t> buf; int flen = fa->get_len(); @@ -1030,11 +1030,11 @@ MainLoop *test(TestType p_type) { if (err) { print_line("Parse Error:\n" + itos(parser.get_error_line()) + ":" + itos(parser.get_error_column()) + ":" + parser.get_error()); memdelete(fa); - return NULL; + return nullptr; } const GDScriptParser::Node *root = parser.get_parse_tree(); - ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, NULL); + ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, nullptr); const GDScriptParser::ClassNode *cnode = static_cast<const GDScriptParser::ClassNode *>(root); _parser_show_class(cnode, 0, lines); @@ -1048,7 +1048,7 @@ MainLoop *test(TestType p_type) { if (err) { print_line("Parse Error:\n" + itos(parser.get_error_line()) + ":" + itos(parser.get_error_column()) + ":" + parser.get_error()); memdelete(fa); - return NULL; + return nullptr; } Ref<GDScript> gds; @@ -1059,7 +1059,7 @@ MainLoop *test(TestType p_type) { if (err) { print_line("Compile Error:\n" + itos(gdc.get_error_line()) + ":" + itos(gdc.get_error_column()) + ":" + gdc.get_error()); - return NULL; + return nullptr; } Ref<GDScript> current = gds; @@ -1083,7 +1083,7 @@ MainLoop *test(TestType p_type) { memdelete(fa); - return NULL; + return nullptr; } } // namespace TestGDScript @@ -1093,7 +1093,7 @@ namespace TestGDScript { MainLoop *test(TestType p_type) { ERR_PRINT("The GDScript module is disabled, therefore GDScript tests cannot be used."); - return NULL; + return nullptr; } } // namespace TestGDScript diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp index a9a671e2f1..922a55b88e 100644 --- a/main/tests/test_main.cpp +++ b/main/tests/test_main.cpp @@ -63,7 +63,7 @@ const char **tests_get_names() { "gd_bytecode", "ordered_hash_map", "astar", - NULL + nullptr }; return test_names; @@ -144,7 +144,7 @@ MainLoop *test_main(String p_test, const List<String> &p_args) { } print_line("Unknown test: " + p_test); - return NULL; + return nullptr; } #else @@ -152,7 +152,7 @@ MainLoop *test_main(String p_test, const List<String> &p_args) { const char **tests_get_names() { static const char *test_names[] = { - NULL + nullptr }; return test_names; @@ -160,7 +160,7 @@ const char **tests_get_names() { MainLoop *test_main(String p_test, const List<String> &p_args) { - return NULL; + return nullptr; } #endif diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp index 29fa5e73a7..38f7371802 100644 --- a/main/tests/test_math.cpp +++ b/main/tests/test_math.cpp @@ -475,18 +475,18 @@ MainLoop *test() { if (cmdlargs.empty()) { //try editor! - return NULL; + return nullptr; } String test = cmdlargs.back()->get(); if (test == "math") { // Not a file name but the test name, abort. // FIXME: This test is ugly as heck, needs fixing :) - return NULL; + return nullptr; } FileAccess *fa = FileAccess::open(test, FileAccess::READ); - ERR_FAIL_COND_V_MSG(!fa, NULL, "Could not open file: " + test); + ERR_FAIL_COND_V_MSG(!fa, nullptr, "Could not open file: " + test); Vector<uint8_t> buf; int flen = fa->get_len(); @@ -580,7 +580,7 @@ MainLoop *test() { List<String> args; args.push_back("-l"); - Error err = OS::get_singleton()->execute("/bin/ls", args, true, NULL, &ret); + Error err = OS::get_singleton()->execute("/bin/ls", args, true, nullptr, &ret); print_line("error: " + itos(err)); print_line(ret); @@ -660,6 +660,6 @@ MainLoop *test() { print_line("scalar /=: " + v); } - return NULL; + return nullptr; } } // namespace TestMath diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp index ac53f124d2..cffec7fa77 100644 --- a/main/tests/test_oa_hash_map.cpp +++ b/main/tests/test_oa_hash_map.cpp @@ -152,6 +152,6 @@ MainLoop *test() { map.set(5, 1); } - return NULL; + return nullptr; } } // namespace TestOAHashMap diff --git a/main/tests/test_ordered_hash_map.cpp b/main/tests/test_ordered_hash_map.cpp index a5553217e2..0720eebaf9 100644 --- a/main/tests/test_ordered_hash_map.cpp +++ b/main/tests/test_ordered_hash_map.cpp @@ -141,7 +141,7 @@ TestFunc test_funcs[] = { test_size, test_iteration, test_const_iteration, - 0 + nullptr }; @@ -168,6 +168,6 @@ MainLoop *test() { OS::get_singleton()->print("Passed %i of %i tests\n", passed, count); - return NULL; + return nullptr; } } // namespace TestOrderedHashMap diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp index dd525d7653..1e85f7f1d2 100644 --- a/main/tests/test_shader_lang.cpp +++ b/main/tests/test_shader_lang.cpp @@ -310,7 +310,7 @@ MainLoop *test() { if (cmdlargs.empty()) { //try editor! print_line("usage: godot -test shader_lang <shader>"); - return NULL; + return nullptr; } String test = cmdlargs.back()->get(); @@ -318,7 +318,7 @@ MainLoop *test() { FileAccess *fa = FileAccess::open(test, FileAccess::READ); if (!fa) { - ERR_FAIL_V(NULL); + ERR_FAIL_V(nullptr); } String code; @@ -347,13 +347,13 @@ MainLoop *test() { if (err) { print_line("Error at line: " + rtos(sl.get_error_line()) + ": " + sl.get_error_text()); - return NULL; + return nullptr; } else { String code2; recreate_code(&code2, sl.get_shader()); print_line("code:\n\n" + code2); } - return NULL; + return nullptr; } } // namespace TestShaderLang diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp index 84731746fa..7438e2bae9 100644 --- a/main/tests/test_string.cpp +++ b/main/tests/test_string.cpp @@ -1071,7 +1071,7 @@ bool test_33() { OS::get_singleton()->print("\n\nTest 33: parse_utf8(null, -1)\n"); String empty; - return empty.parse_utf8(NULL, -1); + return empty.parse_utf8(nullptr, -1); } bool test_34() { @@ -1164,7 +1164,7 @@ TestFunc test_funcs[] = { test_33, test_34, test_35, - 0 + nullptr }; @@ -1195,6 +1195,6 @@ MainLoop *test() { OS::get_singleton()->print("Passed %i of %i tests\n", passed, count); - return NULL; + return nullptr; } } // namespace TestString |