mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4.
This commit is contained in:
@@ -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--;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user