Add const references detected by clang-tidy

This commit is contained in:
Wilson E. Alvarez 2023-11-18 17:40:56 -05:00
parent 2d0ee20ff3
commit a3cb1b096f
No known key found for this signature in database
GPG key ID: A32174A3D2ED3F9E
57 changed files with 120 additions and 120 deletions

View file

@ -561,7 +561,7 @@ bool ProjectConverter3To4::validate_conversion() {
// Check file by file.
for (int i = 0; i < collected_files.size(); i++) {
String file_name = collected_files[i];
const String &file_name = collected_files[i];
Vector<String> lines;
uint32_t ignored_lines = 0;
uint64_t file_size = 0;
@ -2732,7 +2732,7 @@ void ProjectConverter3To4::rename_joypad_buttons_and_axes(Vector<SourceLine> &so
for (int i = 0; i < reg_match.size(); ++i) {
Ref<RegExMatch> match = reg_match[i];
PackedStringArray strings = match->get_strings();
String button_index_entry = strings[0];
const String &button_index_entry = strings[0];
int button_index_value = strings[1].to_int();
if (button_index_value == 6) { // L2 and R2 are mapped to joypad axes in Godot 4.
line = line.replace("InputEventJoypadButton", "InputEventJoypadMotion");
@ -2741,7 +2741,7 @@ void ProjectConverter3To4::rename_joypad_buttons_and_axes(Vector<SourceLine> &so
line = line.replace("InputEventJoypadButton", "InputEventJoypadMotion");
line = line.replace(button_index_entry, ",\"axis\":5,\"axis_value\":1.0");
} else if (button_index_value < 22) { // There are no mappings for indexes greater than 22 in both Godot 3 & 4.
String pressure_and_pressed_properties = strings[2];
const String &pressure_and_pressed_properties = strings[2];
line = line.replace(button_index_entry, ",\"button_index\":" + String::num_int64(reg_container.joypad_button_mappings[button_index_value]) + "," + pressure_and_pressed_properties);
}
}
@ -2750,7 +2750,7 @@ void ProjectConverter3To4::rename_joypad_buttons_and_axes(Vector<SourceLine> &so
for (int i = 0; i < reg_match.size(); ++i) {
Ref<RegExMatch> match = reg_match[i];
PackedStringArray strings = match->get_strings();
String axis_entry = strings[0];
const String &axis_entry = strings[0];
int axis_value = strings[1].to_int();
if (axis_value == 6) {
line = line.replace(axis_entry, ",\"axis\":4");
@ -2772,7 +2772,7 @@ Vector<String> ProjectConverter3To4::check_for_rename_joypad_buttons_and_axes(Ve
for (int i = 0; i < reg_match.size(); ++i) {
Ref<RegExMatch> match = reg_match[i];
PackedStringArray strings = match->get_strings();
String button_index_entry = strings[0];
const String &button_index_entry = strings[0];
int button_index_value = strings[1].to_int();
if (button_index_value == 6) { // L2 and R2 are mapped to joypad axes in Godot 4.
found_renames.append(line_formatter(current_line, "InputEventJoypadButton", "InputEventJoypadMotion", line));
@ -2789,7 +2789,7 @@ Vector<String> ProjectConverter3To4::check_for_rename_joypad_buttons_and_axes(Ve
for (int i = 0; i < reg_match.size(); ++i) {
Ref<RegExMatch> match = reg_match[i];
PackedStringArray strings = match->get_strings();
String axis_entry = strings[0];
const String &axis_entry = strings[0];
int axis_value = strings[1].to_int();
if (axis_value == 6) {
found_renames.append(line_formatter(current_line, axis_entry, ",\"axis\":4", line));