diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/crypto/crypto.h | 14 | ||||
-rw-r--r-- | core/extension/gdextension.h | 8 | ||||
-rw-r--r-- | core/input/input_builders.py | 2 | ||||
-rw-r--r-- | core/io/image_loader.h | 8 | ||||
-rw-r--r-- | core/io/json.h | 14 | ||||
-rw-r--r-- | core/io/resource_format_binary.h | 28 | ||||
-rw-r--r-- | core/io/resource_importer.h | 30 | ||||
-rw-r--r-- | core/io/translation_loader_po.h | 8 | ||||
-rw-r--r-- | core/string/ustring.cpp | 7 |
9 files changed, 59 insertions, 60 deletions
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h index 0248b04034..fbd01be86d 100644 --- a/core/crypto/crypto.h +++ b/core/crypto/crypto.h @@ -153,17 +153,17 @@ public: class ResourceFormatLoaderCrypto : public ResourceFormatLoader { public: - virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; + virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; + virtual void get_recognized_extensions(List<String> *p_extensions) const override; + virtual bool handles_type(const String &p_type) const override; + virtual String get_resource_type(const String &p_path) const override; }; class ResourceFormatSaverCrypto : public ResourceFormatSaver { public: - virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0); - virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const; - virtual bool recognize(const Ref<Resource> &p_resource) const; + virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override; + virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override; + virtual bool recognize(const Ref<Resource> &p_resource) const override; }; #endif // CRYPTO_H diff --git a/core/extension/gdextension.h b/core/extension/gdextension.h index a2b948a38a..2d0cb6a5ba 100644 --- a/core/extension/gdextension.h +++ b/core/extension/gdextension.h @@ -176,10 +176,10 @@ class GDExtensionResourceLoader : public ResourceFormatLoader { public: static Error load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension); - virtual Ref<Resource> load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; + virtual Ref<Resource> load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; + virtual void get_recognized_extensions(List<String> *p_extensions) const override; + virtual bool handles_type(const String &p_type) const override; + virtual String get_resource_type(const String &p_path) const override; }; #ifdef TOOLS_ENABLED diff --git a/core/input/input_builders.py b/core/input/input_builders.py index eabdefe543..ae848f4e7c 100644 --- a/core/input/input_builders.py +++ b/core/input/input_builders.py @@ -13,7 +13,7 @@ def make_default_controller_mappings(target, source, env): # ensure mappings have a consistent order platform_mappings: dict = OrderedDict() for src_path in source: - with open(str(src_path), "r") as f: + with open(str(src_path), "r", encoding="utf-8") as f: # read mapping file and skip header mapping_file_lines = f.readlines()[2:] diff --git a/core/io/image_loader.h b/core/io/image_loader.h index e9b434522d..26af650344 100644 --- a/core/io/image_loader.h +++ b/core/io/image_loader.h @@ -103,10 +103,10 @@ public: class ResourceFormatLoaderImage : public ResourceFormatLoader { public: - virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; + virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; + virtual void get_recognized_extensions(List<String> *p_extensions) const override; + virtual bool handles_type(const String &p_type) const override; + virtual String get_resource_type(const String &p_path) const override; }; #endif // IMAGE_LOADER_H diff --git a/core/io/json.h b/core/io/json.h index a21cc542fd..801fa29b4b 100644 --- a/core/io/json.h +++ b/core/io/json.h @@ -98,17 +98,17 @@ public: class ResourceFormatLoaderJSON : public ResourceFormatLoader { public: - virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; + virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; + virtual void get_recognized_extensions(List<String> *p_extensions) const override; + virtual bool handles_type(const String &p_type) const override; + virtual String get_resource_type(const String &p_path) const override; }; class ResourceFormatSaverJSON : public ResourceFormatSaver { public: - virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0); - virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const; - virtual bool recognize(const Ref<Resource> &p_resource) const; + virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override; + virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override; + virtual bool recognize(const Ref<Resource> &p_resource) const override; }; #endif // JSON_H diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h index e01c5fa467..222e633e58 100644 --- a/core/io/resource_format_binary.h +++ b/core/io/resource_format_binary.h @@ -110,16 +110,16 @@ public: class ResourceFormatLoaderBinary : public ResourceFormatLoader { public: - virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); - virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const; - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; - virtual String get_resource_script_class(const String &p_path) const; - virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes); - virtual ResourceUID::ID get_resource_uid(const String &p_path) const; - virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false); - virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map); + virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; + virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const override; + virtual void get_recognized_extensions(List<String> *p_extensions) const override; + virtual bool handles_type(const String &p_type) const override; + virtual String get_resource_type(const String &p_path) const override; + virtual String get_resource_script_class(const String &p_path) const override; + virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes) override; + virtual ResourceUID::ID get_resource_uid(const String &p_path) const override; + virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false) override; + virtual Error rename_dependencies(const String &p_path, const HashMap<String, String> &p_map) override; }; class ResourceFormatSaverBinaryInstance { @@ -181,10 +181,10 @@ public: class ResourceFormatSaverBinary : public ResourceFormatSaver { public: static ResourceFormatSaverBinary *singleton; - virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0); - virtual Error set_uid(const String &p_path, ResourceUID::ID p_uid); - virtual bool recognize(const Ref<Resource> &p_resource) const; - virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const; + virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override; + virtual Error set_uid(const String &p_path, ResourceUID::ID p_uid) override; + virtual bool recognize(const Ref<Resource> &p_resource) const override; + virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override; ResourceFormatSaverBinary(); }; diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index e17644058a..dbd9e70d16 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -59,22 +59,22 @@ class ResourceFormatImporter : public ResourceFormatLoader { public: static ResourceFormatImporter *get_singleton() { return singleton; } - virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const; - virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; - virtual ResourceUID::ID get_resource_uid(const String &p_path) const; + virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; + virtual void get_recognized_extensions(List<String> *p_extensions) const override; + virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const override; + virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const override; + virtual bool handles_type(const String &p_type) const override; + virtual String get_resource_type(const String &p_path) const override; + virtual ResourceUID::ID get_resource_uid(const String &p_path) const override; virtual Variant get_resource_metadata(const String &p_path) const; - virtual bool is_import_valid(const String &p_path) const; - virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false); - virtual bool is_imported(const String &p_path) const { return recognize_path(p_path); } - virtual String get_import_group_file(const String &p_path) const; - virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes); - virtual bool exists(const String &p_path) const; - - virtual int get_import_order(const String &p_path) const; + virtual bool is_import_valid(const String &p_path) const override; + virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false) override; + virtual bool is_imported(const String &p_path) const override { return recognize_path(p_path); } + virtual String get_import_group_file(const String &p_path) const override; + virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes) override; + virtual bool exists(const String &p_path) const override; + + virtual int get_import_order(const String &p_path) const override; Error get_import_order_threads_and_importer(const String &p_path, int &r_order, bool &r_can_threads, String &r_importer) const; diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h index 16e7c28cbe..a695826e59 100644 --- a/core/io/translation_loader_po.h +++ b/core/io/translation_loader_po.h @@ -38,10 +38,10 @@ class TranslationLoaderPO : public ResourceFormatLoader { public: static Ref<Resource> load_translation(Ref<FileAccess> f, Error *r_error = nullptr); - virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; + virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; + virtual void get_recognized_extensions(List<String> *p_extensions) const override; + virtual bool handles_type(const String &p_type) const override; + virtual String get_resource_type(const String &p_path) const override; TranslationLoaderPO() {} }; diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 93a08fd8b5..bdef1b9bbe 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -1043,12 +1043,11 @@ signed char String::naturalnocasecmp_to(const String &p_str) const { static _FORCE_INLINE_ signed char file_cmp_common(const char32_t *&r_this_str, const char32_t *&r_that_str) { // Compare leading `_` sequences. - while (*r_this_str && *r_that_str) { + while ((*r_this_str == '_' && *r_that_str) || (*r_this_str && *r_that_str == '_')) { // Sort `_` lower than everything except `.` - if (*r_this_str != '_' && *r_that_str == '_') { + if (*r_this_str != '_') { return *r_this_str == '.' ? -1 : 1; - } - if (*r_this_str == '_' && *r_that_str != '_') { + } else if (*r_that_str != '_') { return *r_that_str == '.' ? 1 : -1; } r_this_str++; |