Style: Enforce braces around if blocks and loops

Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
This commit is contained in:
Rémi Verschelde
2020-05-14 21:57:34 +02:00
parent 07bc4e2f96
commit 0ee0fa42e6
683 changed files with 22803 additions and 12225 deletions
+25 -14
View File
@@ -415,8 +415,9 @@ String EditorExportPlatformIOS::_get_linker_flags() {
String result;
for (int i = 0; i < export_plugins.size(); ++i) {
String flags = export_plugins[i]->get_ios_linker_flags();
if (flags.length() == 0)
if (flags.length() == 0) {
continue;
}
if (result.length() > 0) {
result += ' ';
}
@@ -448,10 +449,12 @@ void EditorExportPlatformIOS::_blend_and_rotate(Ref<Image> &p_dst, Ref<Image> &p
int xs = (x_pos >= 0) ? 0 : -x_pos;
int ys = (y_pos >= 0) ? 0 : -y_pos;
if (sw + x_pos > p_dst->get_width())
if (sw + x_pos > p_dst->get_width()) {
sw = p_dst->get_width() - x_pos;
if (sh + y_pos > p_dst->get_height())
}
if (sh + y_pos > p_dst->get_height()) {
sh = p_dst->get_height() - y_pos;
}
for (int y = ys; y < sh; y++) {
for (int x = xs; x < sw; x++) {
@@ -921,8 +924,9 @@ Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir
ERR_FAIL_COND_V(err, err);
Vector<String> project_static_libs = export_plugins[i]->get_ios_project_static_libs();
for (int j = 0; j < project_static_libs.size(); j++)
for (int j = 0; j < project_static_libs.size(); j++) {
project_static_libs.write[j] = project_static_libs[j].get_file(); // Only the file name as it's copied to the project
}
err = _export_additional_assets(p_out_dir, project_static_libs, true, r_exported_assets);
ERR_FAIL_COND_V(err, err);
@@ -981,10 +985,11 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
String team_id = p_preset->get("application/app_store_team_id");
ERR_FAIL_COND_V_MSG(team_id.length() == 0, ERR_CANT_OPEN, "App Store Team ID not specified - cannot configure the project.");
if (p_debug)
if (p_debug) {
src_pkg_name = p_preset->get("custom_template/debug");
else
} else {
src_pkg_name = p_preset->get("custom_template/release");
}
if (src_pkg_name == "") {
String err;
@@ -1030,8 +1035,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
String pack_path = dest_dir + binary_name + ".pck";
Vector<SharedObject> libraries;
Error err = save_pack(p_preset, pack_path, &libraries);
if (err)
if (err) {
return err;
}
if (ep.step("Extracting and configuring Xcode project", 1)) {
return ERR_SKIP;
@@ -1041,12 +1047,13 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
print_line("Static library: " + library_to_use);
String pkg_name;
if (p_preset->get("application/name") != "")
if (p_preset->get("application/name") != "") {
pkg_name = p_preset->get("application/name"); // app_name
else if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "")
} else if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") {
pkg_name = String(ProjectSettings::get_singleton()->get("application/config/name"));
else
} else {
pkg_name = "Unnamed";
}
bool found_library = false;
int total_size = 0;
@@ -1225,16 +1232,19 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
err = tmp_app_path->make_dir_recursive(iconset_dir);
}
memdelete(tmp_app_path);
if (err)
if (err) {
return err;
}
err = _export_icons(p_preset, iconset_dir);
if (err)
if (err) {
return err;
}
err = _export_loading_screens(p_preset, dest_dir + binary_name + "/Images.xcassets/LaunchImage.launchimage/");
if (err)
if (err) {
return err;
}
print_line("Exporting additional assets");
Vector<IOSExportAsset> assets;
@@ -1361,8 +1371,9 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset
err += etc_error;
}
if (!err.empty())
if (!err.empty()) {
r_error = err;
}
return valid;
}