diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-09-29 12:53:28 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-10-07 11:32:33 +0300 |
commit | 0103af1ddda6a2aa31227965141dd7d3a513e081 (patch) | |
tree | b0965bb65919bc1495ee02204a91e5ed3a9b56a7 /editor/debugger | |
parent | 5b7f62af55b7f322192f95258d825b163cbf9dc1 (diff) |
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4.
Diffstat (limited to 'editor/debugger')
-rw-r--r-- | editor/debugger/debug_adapter/debug_adapter_protocol.cpp | 12 | ||||
-rw-r--r-- | editor/debugger/debug_adapter/debug_adapter_server.cpp | 8 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_inspector.cpp | 10 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_node.cpp | 7 | ||||
-rw-r--r-- | editor/debugger/editor_performance_profiler.cpp | 8 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 24 |
6 files changed, 33 insertions, 36 deletions
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp index 4c445eb766..809c0c2cff 100644 --- a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp @@ -921,11 +921,11 @@ void DebugAdapterProtocol::on_debug_stack_frame_vars(const int &p_size) { ERR_FAIL_COND(!stackframe_list.has(frame)); List<int> scope_ids = stackframe_list.find(frame)->value; for (List<int>::Element *E = scope_ids.front(); E; E = E->next()) { - int variable_id = E->get(); - if (variable_list.has(variable_id)) { - variable_list.find(variable_id)->value.clear(); + int var_id = E->get(); + if (variable_list.has(var_id)) { + variable_list.find(var_id)->value.clear(); } else { - variable_list.insert(variable_id, Array()); + variable_list.insert(var_id, Array()); } } } @@ -941,7 +941,7 @@ void DebugAdapterProtocol::on_debug_stack_frame_var(const Array &p_data) { List<int> scope_ids = stackframe_list.find(frame)->value; ERR_FAIL_COND(scope_ids.size() != 3); ERR_FAIL_INDEX(stack_var.type, 3); - int variable_id = scope_ids[stack_var.type]; + int var_id = scope_ids[stack_var.type]; DAP::Variable variable; @@ -950,7 +950,7 @@ void DebugAdapterProtocol::on_debug_stack_frame_var(const Array &p_data) { variable.type = Variant::get_type_name(stack_var.value.get_type()); variable.variablesReference = parse_variant(stack_var.value); - variable_list.find(variable_id)->value.push_back(variable.to_json()); + variable_list.find(var_id)->value.push_back(variable.to_json()); _remaining_vars--; } diff --git a/editor/debugger/debug_adapter/debug_adapter_server.cpp b/editor/debugger/debug_adapter/debug_adapter_server.cpp index 41e6b1f308..37da64beae 100644 --- a/editor/debugger/debug_adapter/debug_adapter_server.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_server.cpp @@ -64,10 +64,10 @@ void DebugAdapterServer::_notification(int p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { protocol._request_timeout = EditorSettings::get_singleton()->get("network/debug_adapter/request_timeout"); protocol._sync_breakpoints = EditorSettings::get_singleton()->get("network/debug_adapter/sync_breakpoints"); - int remote_port = (int)_EDITOR_GET("network/debug_adapter/remote_port"); - if (remote_port != this->remote_port) { - this->stop(); - this->start(); + int port = (int)_EDITOR_GET("network/debug_adapter/remote_port"); + if (port != remote_port) { + stop(); + start(); } } break; } diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index 7ea6cedd2b..371aaf8617 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -166,11 +166,11 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { if (pinfo.hint_string == "Script") { if (debug_obj->get_script() != var) { debug_obj->set_script(Ref<RefCounted>()); - Ref<Script> script(var); - if (!script.is_null()) { - ScriptInstance *script_instance = script->placeholder_instance_create(debug_obj); - if (script_instance) { - debug_obj->set_script_and_instance(var, script_instance); + Ref<Script> scr(var); + if (!scr.is_null()) { + ScriptInstance *scr_instance = scr->placeholder_instance_create(debug_obj); + if (scr_instance) { + debug_obj->set_script_and_instance(var, scr_instance); } } } diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 9fd7fa578f..06b73cf296 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -477,13 +477,10 @@ void EditorDebuggerNode::_menu_option(int p_id) { } void EditorDebuggerNode::_update_debug_options() { - bool keep_debugger_open = EditorSettings::get_singleton()->get_project_metadata("debug_options", "keep_debugger_open", false); - bool debug_with_external_editor = EditorSettings::get_singleton()->get_project_metadata("debug_options", "debug_with_external_editor", false); - - if (keep_debugger_open) { + if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "keep_debugger_open", false).operator bool()) { _menu_option(DEBUG_KEEP_DEBUGGER_OPEN); } - if (debug_with_external_editor) { + if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "debug_with_external_editor", false).operator bool()) { _menu_option(DEBUG_WITH_EXTERNAL_EDITOR); } } diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index 10b50a81e4..e2fd462f3a 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -349,12 +349,12 @@ void EditorPerformanceProfiler::update_monitors(const Vector<StringName> &p_name void EditorPerformanceProfiler::add_profile_frame(const Vector<float> &p_values) { for (KeyValue<StringName, Monitor> &E : monitors) { - float data = 0.0f; + float value = 0.0f; if (E.value.frame_index >= 0 && E.value.frame_index < p_values.size()) { - data = p_values[E.value.frame_index]; + value = p_values[E.value.frame_index]; } - E.value.history.push_front(data); - E.value.update_value(data); + E.value.history.push_front(value); + E.value.update_value(value); } marker_frame++; monitor_draw->queue_redraw(); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 622ad00502..f1fc1019b9 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -747,8 +747,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da if (element) { Callable &c = element->value; ERR_FAIL_COND_MSG(c.is_null(), "Invalid callable registered: " + cap); - Variant cmd = p_msg.substr(colon_index + 1), data = p_data; - const Variant *args[2] = { &cmd, &data }; + Variant cmd = p_msg.substr(colon_index + 1), cmd_data = p_data; + const Variant *args[2] = { &cmd, &cmd_data }; Variant retval; Callable::CallError err; c.callp(args, 2, retval, err); @@ -895,9 +895,9 @@ void ScriptEditorDebugger::_clear_execution() { } void ScriptEditorDebugger::_set_breakpoint(const String &p_file, const int &p_line, const bool &p_enabled) { - Ref<Script> script = ResourceLoader::load(p_file); - emit_signal(SNAME("set_breakpoint"), script, p_line - 1, p_enabled); - script.unref(); + Ref<Script> scr = ResourceLoader::load(p_file); + emit_signal(SNAME("set_breakpoint"), scr, p_line - 1, p_enabled); + scr.unref(); } void ScriptEditorDebugger::_clear_breakpoints() { @@ -979,15 +979,15 @@ void ScriptEditorDebugger::stop() { } void ScriptEditorDebugger::_profiler_activate(bool p_enable, int p_type) { - Array data; - data.push_back(p_enable); + Array msg_data; + msg_data.push_back(p_enable); switch (p_type) { case PROFILER_NETWORK: - _put_msg("profiler:multiplayer", data); - _put_msg("profiler:rpc", data); + _put_msg("profiler:multiplayer", msg_data); + _put_msg("profiler:rpc", msg_data); break; case PROFILER_VISUAL: - _put_msg("profiler:visual", data); + _put_msg("profiler:visual", msg_data); break; case PROFILER_SCRIPTS_SERVERS: if (p_enable) { @@ -997,9 +997,9 @@ void ScriptEditorDebugger::_profiler_activate(bool p_enable, int p_type) { Array opts; int max_funcs = EditorSettings::get_singleton()->get("debugger/profiler_frame_max_functions"); opts.push_back(CLAMP(max_funcs, 16, 512)); - data.push_back(opts); + msg_data.push_back(opts); } - _put_msg("profiler:servers", data); + _put_msg("profiler:servers", msg_data); break; default: ERR_FAIL_MSG("Invalid profiler type"); |