diff options
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/logger.h | 12 | ||||
-rw-r--r-- | core/io/packet_peer.cpp | 2 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 2 | ||||
-rw-r--r-- | core/io/resource_importer.cpp | 17 | ||||
-rw-r--r-- | core/io/resource_importer.h | 9 |
5 files changed, 24 insertions, 18 deletions
diff --git a/core/io/logger.h b/core/io/logger.h index 0b871a13de..ff5b8ce489 100644 --- a/core/io/logger.h +++ b/core/io/logger.h @@ -49,11 +49,11 @@ public: ERR_SHADER }; - virtual void logv(const char *p_format, va_list p_list, bool p_err) = 0; + virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0 = 0; virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR); - void logf(const char *p_format, ...); - void logf_error(const char *p_format, ...); + void logf(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3; + void logf_error(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3; virtual ~Logger(); }; @@ -64,7 +64,7 @@ public: class StdLogger : public Logger { public: - virtual void logv(const char *p_format, va_list p_list, bool p_err); + virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0; virtual ~StdLogger(); }; @@ -88,7 +88,7 @@ class RotatedFileLogger : public Logger { public: RotatedFileLogger(const String &p_base_path, int p_max_files = 10); - virtual void logv(const char *p_format, va_list p_list, bool p_err); + virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0; virtual ~RotatedFileLogger(); }; @@ -99,7 +99,7 @@ class CompositeLogger : public Logger { public: CompositeLogger(Vector<Logger *> p_loggers); - virtual void logv(const char *p_format, va_list p_list, bool p_err); + virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0; virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR); void add_logger(Logger *p_logger); diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 3aa1fcfd8f..d7bfdbbb37 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -224,7 +224,7 @@ Error PacketPeerStream::get_packet(const uint8_t **r_buffer, int &r_buffer_size) uint32_t len = decode_uint32(lbuf); ERR_FAIL_COND_V(remaining < (int)len, ERR_UNAVAILABLE); - ERR_FAIL_COND_V(input_buffer.size() < len, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(input_buffer.size() < (int)len, ERR_UNAVAILABLE); ring_buffer.read(lbuf, 4); //get rid of first 4 bytes ring_buffer.read(input_buffer.ptrw(), len); // read packet diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 6c48942d72..42070cd132 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -106,7 +106,7 @@ StringName ResourceInteractiveLoaderBinary::_get_string() { uint32_t id = f->get_32(); if (id & 0x80000000) { uint32_t len = id & 0x7FFFFFFF; - if (len > str_buf.size()) { + if ((int)len > str_buf.size()) { str_buf.resize(len); } if (len == 0) diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp index ef834921b6..69907a710a 100644 --- a/core/io/resource_importer.cpp +++ b/core/io/resource_importer.cpp @@ -32,7 +32,8 @@ #include "core/os/os.h" #include "core/variant_parser.h" -bool ResourceFormatImporter::SortImporterByName::operator() ( const Ref<ResourceImporter>& p_a,const Ref<ResourceImporter>& p_b) const { + +bool ResourceFormatImporter::SortImporterByName::operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &p_b) const { return p_a->get_importer_name() < p_b->get_importer_name(); } @@ -321,7 +322,6 @@ Variant ResourceFormatImporter::get_resource_metadata(const String &p_path) cons return pat.metadata; } - void ResourceFormatImporter::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) { PathAndType pat; @@ -394,7 +394,7 @@ bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) con return false; } - for(int i=0;i<importers.size();i++) { + for (int i = 0; i < importers.size(); i++) { if (importers[i]->get_importer_name() == pat.importer) { if (!importers[i]->are_import_settings_valid(p_path)) { //importer thinks this is not valid return false; @@ -405,10 +405,15 @@ bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) con return true; } - String ResourceFormatImporter::get_import_settings_hash() const { +String ResourceFormatImporter::get_import_settings_hash() const { + + Vector<Ref<ResourceImporter> > sorted_importers = importers; + + sorted_importers.sort_custom<SortImporterByName>(); + String hash; - for(int i=0;i<importers.size();i++) { - hash+=":"+importers[i]->get_importer_name()+":"+importers[i]->get_import_settings_string(); + for (int i = 0; i < sorted_importers.size(); i++) { + hash += ":" + sorted_importers[i]->get_importer_name() + ":" + sorted_importers[i]->get_import_settings_string(); } return hash.md5_text(); } diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index 0ae6bf9090..1d27d4dec3 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -52,7 +52,7 @@ class ResourceFormatImporter : public ResourceFormatLoader { //need them to stay in order to compute the settings hash struct SortImporterByName { - bool operator() ( const Ref<ResourceImporter>& p_a,const Ref<ResourceImporter>& p_b) const; + bool operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &p_b) const; }; Vector<Ref<ResourceImporter> > importers; @@ -75,7 +75,9 @@ public: String get_internal_resource_path(const String &p_path) const; void get_internal_resource_path_list(const String &p_path, List<String> *r_paths); - void add_importer(const Ref<ResourceImporter> &p_importer) { importers.push_back(p_importer); importers.sort_custom<SortImporterByName>();} + void add_importer(const Ref<ResourceImporter> &p_importer) { + importers.push_back(p_importer); + } void remove_importer(const Ref<ResourceImporter> &p_importer) { importers.erase(p_importer); } Ref<ResourceImporter> get_importer_by_name(const String &p_name) const; Ref<ResourceImporter> get_importer_by_extension(const String &p_extension) const; @@ -117,10 +119,9 @@ public: virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const = 0; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const = 0; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata=NULL) = 0; + virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL) = 0; virtual bool are_import_settings_valid(const String &p_path) const { return true; } virtual String get_import_settings_string() const { return String(); } - }; #endif // RESOURCE_IMPORTER_H |