1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

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 16:41:43 +02:00
parent 07bc4e2f96
commit 0ee0fa42e6
683 changed files with 22803 additions and 12225 deletions

View File

@@ -54,12 +54,14 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o
pf.pack = pkg_path;
pf.offset = ofs;
pf.size = size;
for (int i = 0; i < 16; i++)
for (int i = 0; i < 16; i++) {
pf.md5[i] = p_md5[i];
}
pf.src = p_src;
if (!exists || p_replace_files)
if (!exists || p_replace_files) {
files[pmd5] = pf;
}
if (!exists) {
//search for dir
@@ -106,8 +108,9 @@ PackedData::PackedData() {
}
void PackedData::_free_packed_dirs(PackedDir *p_dir) {
for (Map<String, PackedDir *>::Element *E = p_dir->subdirs.front(); E; E = E->next())
for (Map<String, PackedDir *>::Element *E = p_dir->subdirs.front(); E; E = E->next()) {
_free_packed_dirs(E->get());
}
memdelete(p_dir);
}
@@ -122,8 +125,9 @@ PackedData::~PackedData() {
bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files) {
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f)
if (!f) {
return false;
}
uint32_t magic = f->get_32();
@@ -252,8 +256,9 @@ uint8_t FileAccessPack::get_8() const {
}
int FileAccessPack::get_buffer(uint8_t *p_dst, int p_length) const {
if (eof)
if (eof) {
return 0;
}
uint64_t to_read = p_length;
if (to_read + pos > pf.size) {
@@ -263,8 +268,9 @@ int FileAccessPack::get_buffer(uint8_t *p_dst, int p_length) const {
pos += p_length;
if (to_read <= 0)
if (to_read <= 0) {
return 0;
}
f->get_buffer(p_dst, to_read);
return to_read;
@@ -276,8 +282,9 @@ void FileAccessPack::set_endian_swap(bool p_swap) {
}
Error FileAccessPack::get_error() const {
if (eof)
if (eof) {
return ERR_FILE_EOF;
}
return OK;
}
@@ -308,8 +315,9 @@ FileAccessPack::FileAccessPack(const String &p_path, const PackedData::PackedFil
}
FileAccessPack::~FileAccessPack() {
if (f)
if (f) {
memdelete(f);
}
}
//////////////////////////////////////////////////////////////////////////////////
@@ -378,8 +386,9 @@ Error DirAccessPack::change_dir(String p_dir) {
nd = nd.simplify_path();
if (nd == "")
if (nd == "") {
nd = ".";
}
if (nd.begins_with("/")) {
nd = nd.replace_first("/", "");
@@ -390,10 +399,11 @@ Error DirAccessPack::change_dir(String p_dir) {
PackedData::PackedDir *pd;
if (absolute)
if (absolute) {
pd = PackedData::get_singleton()->root;
else
} else {
pd = current;
}
for (int i = 0; i < paths.size(); i++) {
String p = paths[i];