summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-06-20 21:10:10 +0200
committerGitHub <noreply@github.com>2019-06-20 21:10:10 +0200
commit5c66771e3ebccdfec55bb94ea521d2f24cb6200a (patch)
tree80bea3ee8792cb19e719221987faf1a2bf1e88a3 /core
parent7b88ac08437d3bd062efcbdd40c215b533032412 (diff)
parent072e40368e19e0f88ec1fbb61fe463a6fffcca36 (diff)
downloadredot-engine-5c66771e3ebccdfec55bb94ea521d2f24cb6200a.tar.gz
Merge pull request #29283 from qarmin/fix_some_always_same_values
Remove always true/false values
Diffstat (limited to 'core')
-rw-r--r--core/class_db.cpp4
-rw-r--r--core/io/file_access_buffered.cpp4
-rw-r--r--core/io/marshalls.cpp5
-rw-r--r--core/io/resource_format_binary.cpp10
-rw-r--r--core/io/xml_parser.cpp4
-rw-r--r--core/os/file_access.cpp6
-rw-r--r--core/pool_allocator.cpp4
7 files changed, 10 insertions, 27 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp
index 0c844657a4..ec07ee98e2 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -666,10 +666,8 @@ void ClassDB::bind_integer_constant(const StringName &p_class, const StringName
OBJTYPE_WLOCK;
ClassInfo *type = classes.getptr(p_class);
- if (!type) {
- ERR_FAIL_COND(!type);
- }
+ ERR_FAIL_COND(!type);
if (type->constant_map.has(p_name)) {
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index 83ff532aa4..93eaeb08c5 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -141,9 +141,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_length) const {
int left = cache_data_left();
if (left == 0) {
- if (to_read > 0) {
- file.offset += to_read;
- };
+ file.offset += to_read;
return total_read;
};
if (left < 0) {
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index d1b6b82cf0..7494603462 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -103,10 +103,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
const uint8_t *buf = p_buffer;
int len = p_len;
- if (len < 4) {
-
- ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
- }
+ ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
uint32_t type = decode_uint32(buf);
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index f25abc4aab..aef2dcfff3 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -991,10 +991,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
- if (err != OK) {
-
- ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
- }
+ ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
String path = p_original_path != "" ? p_original_path : p_path;
@@ -1129,9 +1126,8 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
Error err;
f = FileAccess::open(p_path, FileAccess::READ, &err);
- if (err != OK) {
- ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN);
- }
+
+ ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN);
Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path);
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index f55af5a96a..82527d3f38 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -486,9 +486,7 @@ Error XMLParser::open(const String &p_path) {
Error err;
FileAccess *file = FileAccess::open(p_path, FileAccess::READ, &err);
- if (err) {
- ERR_FAIL_COND_V(err != OK, err);
- }
+ ERR_FAIL_COND_V(err != OK, err);
length = file->get_len();
ERR_FAIL_COND_V(length < 1, ERR_FILE_CORRUPT);
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 079f51bada..913caf6584 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -600,9 +600,8 @@ Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path, Error *r_err
if (!f) {
if (r_error) { // if error requested, do not throw error
return Vector<uint8_t>();
- } else {
- ERR_FAIL_COND_V(!f, Vector<uint8_t>());
}
+ ERR_FAIL_COND_V(!f, Vector<uint8_t>());
}
Vector<uint8_t> data;
data.resize(f->get_len());
@@ -621,9 +620,8 @@ String FileAccess::get_file_as_string(const String &p_path, Error *r_error) {
if (err != OK) {
if (r_error) {
return String();
- } else {
- ERR_FAIL_COND_V(err != OK, String());
}
+ ERR_FAIL_COND_V(err != OK, String());
}
String ret;
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index a283d8db1d..11a3be89bd 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -500,9 +500,7 @@ void *PoolAllocator::get(ID p_mem) {
if (!needs_locking) {
Entry *e = get_entry(p_mem);
- if (!e) {
- ERR_FAIL_COND_V(!e, NULL);
- };
+ ERR_FAIL_COND_V(!e, NULL);
return &pool[e->pos];
}