summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-10-18 18:47:44 +0200
committerkobewi <kobewi4e@gmail.com>2022-10-19 00:05:48 +0200
commitd06a8320e5d5117f8a057da16d33443f410a5d9f (patch)
tree895f507322e9b4371c6fd7141e2c6d3d3c67278a /core/io
parent4a96fce801cae2d3e0fe42005c74ca7d60cc1582 (diff)
Simplify GDVIRTUAL_CALL calls
Diffstat (limited to 'core/io')
-rw-r--r--core/io/image_loader.cpp6
-rw-r--r--core/io/resource_loader.cpp31
-rw-r--r--core/io/resource_saver.cpp14
3 files changed, 15 insertions, 36 deletions
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index 397984a2ab..6c00ca4b67 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -52,10 +52,8 @@ bool ImageFormatLoader::recognize(const String &p_extension) const {
Error ImageFormatLoaderExtension::load_image(Ref<Image> p_image, Ref<FileAccess> p_fileaccess, BitField<ImageFormatLoader::LoaderFlags> p_flags, float p_scale) {
Error err = ERR_UNAVAILABLE;
- if (GDVIRTUAL_CALL(_load_image, p_image, p_fileaccess, p_flags, p_scale, err)) {
- return err;
- }
- return ERR_UNAVAILABLE;
+ GDVIRTUAL_CALL(_load_image, p_image, p_fileaccess, p_flags, p_scale, err);
+ return err;
}
void ImageFormatLoaderExtension::get_recognized_extensions(List<String> *p_extension) const {
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 2fb357b520..4e9e8dabb8 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -74,11 +74,8 @@ bool ResourceFormatLoader::recognize_path(const String &p_path, const String &p_
bool ResourceFormatLoader::handles_type(const String &p_type) const {
bool success = false;
- if (GDVIRTUAL_CALL(_handles_type, p_type, success)) {
- return success;
- }
-
- return false;
+ GDVIRTUAL_CALL(_handles_type, p_type, success);
+ return success;
}
void ResourceFormatLoader::get_classes_used(const String &p_path, HashSet<StringName> *r_classes) {
@@ -98,21 +95,14 @@ void ResourceFormatLoader::get_classes_used(const String &p_path, HashSet<String
String ResourceFormatLoader::get_resource_type(const String &p_path) const {
String ret;
-
- if (GDVIRTUAL_CALL(_get_resource_type, p_path, ret)) {
- return ret;
- }
-
- return "";
+ GDVIRTUAL_CALL(_get_resource_type, p_path, ret);
+ return ret;
}
ResourceUID::ID ResourceFormatLoader::get_resource_uid(const String &p_path) const {
int64_t uid = ResourceUID::INVALID_ID;
- if (GDVIRTUAL_CALL(_get_resource_uid, p_path, uid)) {
- return uid;
- }
-
- return ResourceUID::INVALID_ID;
+ GDVIRTUAL_CALL(_get_resource_uid, p_path, uid);
+ return uid;
}
void ResourceFormatLoader::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const {
@@ -132,7 +122,7 @@ bool ResourceFormatLoader::exists(const String &p_path) const {
if (GDVIRTUAL_CALL(_exists, p_path, success)) {
return success;
}
- return FileAccess::exists(p_path); //by default just check file
+ return FileAccess::exists(p_path); // By default just check file.
}
void ResourceFormatLoader::get_recognized_extensions(List<String> *p_extensions) const {
@@ -181,11 +171,8 @@ Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Hash
}
int64_t err = OK;
- if (GDVIRTUAL_CALL(_rename_dependencies, p_path, deps_dict, err)) {
- return (Error)err;
- }
-
- return OK;
+ GDVIRTUAL_CALL(_rename_dependencies, p_path, deps_dict, err);
+ return (Error)err;
}
void ResourceFormatLoader::_bind_methods() {
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 2f863baaac..f55b4c971a 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -43,20 +43,14 @@ ResourceSaverGetResourceIDForPath ResourceSaver::save_get_id_for_path = nullptr;
Error ResourceFormatSaver::save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags) {
int64_t res = ERR_METHOD_NOT_FOUND;
- if (GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, res)) {
- return (Error)res;
- }
-
- return ERR_METHOD_NOT_FOUND;
+ GDVIRTUAL_CALL(_save, p_resource, p_path, p_flags, res);
+ return (Error)res;
}
bool ResourceFormatSaver::recognize(const Ref<Resource> &p_resource) const {
bool success = false;
- if (GDVIRTUAL_CALL(_recognize, p_resource, success)) {
- return success;
- }
-
- return false;
+ GDVIRTUAL_CALL(_recognize, p_resource, success);
+ return success;
}
void ResourceFormatSaver::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {