From 072e40368e19e0f88ec1fbb61fe463a6fffcca36 Mon Sep 17 00:00:00 2001 From: qarmin Date: Thu, 20 Jun 2019 16:59:48 +0200 Subject: Fix always true/false values --- core/io/file_access_buffered.cpp | 4 +--- core/io/marshalls.cpp | 5 +---- core/io/resource_format_binary.cpp | 10 +++------- core/io/xml_parser.cpp | 4 +--- 4 files changed, 6 insertions(+), 17 deletions(-) (limited to 'core/io') 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 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()); - } + ERR_FAIL_COND_V(err != OK, Ref()); Ref 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 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 4638ddcc09..4407ddb7d3 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); -- cgit v1.2.3