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

@@ -34,8 +34,9 @@
Error StreamPeer::_put_data(const Vector<uint8_t> &p_data) {
int len = p_data.size();
if (len == 0)
if (len == 0) {
return OK;
}
const uint8_t *r = p_data.ptr();
return put_data(&r[0], len);
}
@@ -318,8 +319,9 @@ double StreamPeer::get_double() {
}
String StreamPeer::get_string(int p_bytes) {
if (p_bytes < 0)
if (p_bytes < 0) {
p_bytes = get_u32();
}
ERR_FAIL_COND_V(p_bytes < 0, String());
Vector<char> buf;
@@ -332,8 +334,9 @@ String StreamPeer::get_string(int p_bytes) {
}
String StreamPeer::get_utf8_string(int p_bytes) {
if (p_bytes < 0)
if (p_bytes < 0) {
p_bytes = get_u32();
}
ERR_FAIL_COND_V(p_bytes < 0, String());
Vector<uint8_t> buf;
@@ -421,8 +424,9 @@ void StreamPeerBuffer::_bind_methods() {
}
Error StreamPeerBuffer::put_data(const uint8_t *p_data, int p_bytes) {
if (p_bytes <= 0)
if (p_bytes <= 0) {
return OK;
}
if (pointer + p_bytes > data.size()) {
data.resize(pointer + p_bytes);
@@ -443,8 +447,9 @@ Error StreamPeerBuffer::put_partial_data(const uint8_t *p_data, int p_bytes, int
Error StreamPeerBuffer::get_data(uint8_t *p_buffer, int p_bytes) {
int recv;
get_partial_data(p_buffer, p_bytes, recv);
if (recv != p_bytes)
if (recv != p_bytes) {
return ERR_INVALID_PARAMETER;
}
return OK;
}