diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 2 | ||||
-rw-r--r-- | core/class_db.cpp | 8 | ||||
-rw-r--r-- | core/helper/math_fieldwise.cpp | 2 | ||||
-rw-r--r-- | core/helper/math_fieldwise.h | 2 | ||||
-rw-r--r-- | core/image.cpp | 6 | ||||
-rw-r--r-- | core/io/file_access_compressed.h | 10 | ||||
-rw-r--r-- | core/io/file_access_encrypted.cpp | 4 | ||||
-rw-r--r-- | core/io/file_access_encrypted.h | 2 | ||||
-rw-r--r-- | core/io/file_access_network.cpp | 4 | ||||
-rw-r--r-- | core/io/file_access_network.h | 4 | ||||
-rw-r--r-- | core/io/marshalls.cpp | 10 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 6 | ||||
-rw-r--r-- | core/io/translation_loader_po.cpp | 4 | ||||
-rw-r--r-- | core/io/xml_parser.cpp | 2 | ||||
-rw-r--r-- | core/io/xml_parser.h | 2 | ||||
-rw-r--r-- | core/math/a_star.h | 2 | ||||
-rw-r--r-- | core/math/face3.cpp | 2 | ||||
-rw-r--r-- | core/math/quick_hull.cpp | 10 | ||||
-rw-r--r-- | core/os/os.cpp | 3 | ||||
-rw-r--r-- | core/packed_data_container.cpp | 8 | ||||
-rw-r--r-- | core/pool_allocator.cpp | 6 | ||||
-rw-r--r-- | core/project_settings.cpp | 2 | ||||
-rw-r--r-- | core/project_settings.h | 2 | ||||
-rw-r--r-- | core/reference.h | 2 | ||||
-rw-r--r-- | core/ustring.cpp | 22 | ||||
-rw-r--r-- | core/vmap.h | 6 | ||||
-rw-r--r-- | core/vset.h | 7 |
27 files changed, 78 insertions, 62 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index abe8b9b715..a446094643 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1705,7 +1705,7 @@ Variant _File::get_var() const { ERR_FAIL_COND_V(!f, Variant()); uint32_t len = get_32(); PoolVector<uint8_t> buff = get_buffer(len); - ERR_FAIL_COND_V(buff.size() != len, Variant()); + ERR_FAIL_COND_V((uint32_t)buff.size() != len, Variant()); PoolVector<uint8_t>::Read r = buff.read(); diff --git a/core/class_db.cpp b/core/class_db.cpp index 1cb287a143..872e466e72 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -535,7 +535,13 @@ void ClassDB::get_method_list(StringName p_class, List<MethodInfo> *p_methods, b minfo.return_val = method->get_return_info(); minfo.flags = method->get_hint_flags(); - minfo.default_arguments = method->get_default_arguments(); + + int defval_count = method->get_default_argument_count(); + minfo.default_arguments.resize(defval_count); + + for (int i = 0; i < defval_count; i++) { + minfo.default_arguments[i] = method->get_default_argument(defval_count - i - 1); + } p_methods->push_back(minfo); } diff --git a/core/helper/math_fieldwise.cpp b/core/helper/math_fieldwise.cpp index 2ce2a70866..228611f8b3 100644 --- a/core/helper/math_fieldwise.cpp +++ b/core/helper/math_fieldwise.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* fieldwise.cpp */ +/* math_fieldwise.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/core/helper/math_fieldwise.h b/core/helper/math_fieldwise.h index 4671703f41..400df040a4 100644 --- a/core/helper/math_fieldwise.h +++ b/core/helper/math_fieldwise.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* fieldwise.h */ +/* math_fieldwise.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/core/image.cpp b/core/image.cpp index bb1ce2cee3..4d1f32c360 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1256,9 +1256,9 @@ void Image::create(const char **p_xpm) { if (*line_ptr == '#') { line_ptr++; - uint8_t col_r; - uint8_t col_g; - uint8_t col_b; + uint8_t col_r = 0; + uint8_t col_g = 0; + uint8_t col_b = 0; //uint8_t col_a=255; for (int i = 0; i < 6; i++) { diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h index 2fe1428752..ba84c9767c 100644 --- a/core/io/file_access_compressed.h +++ b/core/io/file_access_compressed.h @@ -37,11 +37,11 @@ class FileAccessCompressed : public FileAccess { Compression::Mode cmode; bool writing; - int write_pos; + uint32_t write_pos; uint8_t *write_ptr; - int write_buffer_size; - int write_max; - int block_size; + uint32_t write_buffer_size; + uint32_t write_max; + uint32_t block_size; mutable bool read_eof; mutable bool at_end; @@ -57,7 +57,7 @@ class FileAccessCompressed : public FileAccess { mutable int read_block_size; mutable int read_pos; Vector<ReadBlock> read_blocks; - int read_total; + uint32_t read_total; String magic; mutable Vector<uint8_t> buffer; diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index cf82d04ac5..12503f3be4 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -73,14 +73,14 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8 length = p_base->get_64(); base = p_base->get_pos(); ERR_FAIL_COND_V(p_base->get_len() < base + length, ERR_FILE_CORRUPT); - int ds = length; + uint32_t ds = length; if (ds % 16) { ds += 16 - (ds % 16); } data.resize(ds); - int blen = p_base->get_buffer(data.ptr(), ds); + uint32_t blen = p_base->get_buffer(data.ptr(), ds); ERR_FAIL_COND_V(blen != ds, ERR_FILE_CORRUPT); aes256_context ctx; diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h index 3df2806a7a..74d00a5a8f 100644 --- a/core/io/file_access_encrypted.h +++ b/core/io/file_access_encrypted.h @@ -48,7 +48,7 @@ private: size_t base; size_t length; Vector<uint8_t> data; - mutable size_t pos; + mutable int pos; mutable bool eofed; public: diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index be31076557..d8b8c8c200 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -244,14 +244,14 @@ FileAccessNetworkClient::~FileAccessNetworkClient() { memdelete(sem); } -void FileAccessNetwork::_set_block(size_t p_offset, const Vector<uint8_t> &p_block) { +void FileAccessNetwork::_set_block(int p_offset, const Vector<uint8_t> &p_block) { int page = p_offset / page_size; ERR_FAIL_INDEX(page, pages.size()); if (page < pages.size() - 1) { ERR_FAIL_COND(p_block.size() != page_size); } else { - ERR_FAIL_COND((p_block.size() != (total_size % page_size))); + ERR_FAIL_COND((p_block.size() != (int)(total_size % page_size))); } buffer_mutex->lock(); diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h index d6010cdbac..cd5046f007 100644 --- a/core/io/file_access_network.h +++ b/core/io/file_access_network.h @@ -97,7 +97,7 @@ class FileAccessNetwork : public FileAccess { mutable int last_page; mutable uint8_t *last_page_buff; - uint32_t page_size; + int page_size; int read_ahead; int max_pages; @@ -121,7 +121,7 @@ class FileAccessNetwork : public FileAccess { friend class FileAccessNetworkClient; void _queue_page(int p_page) const; void _respond(size_t p_len, Error p_status); - void _set_block(size_t p_offset, const Vector<uint8_t> &p_block); + void _set_block(int p_offset, const Vector<uint8_t> &p_block); public: enum Command { diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index af7db904e9..0834d6c321 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -333,14 +333,14 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int len -= 12; buf += 12; - int total = namecount + subnamecount; + uint32_t total = namecount + subnamecount; if (flags & 2) total++; if (r_len) (*r_len) += 12; - for (int i = 0; i < total; i++) { + for (uint32_t i = 0; i < total; i++) { ERR_FAIL_COND_V((int)len < 4, ERR_INVALID_DATA); strlen = decode_uint32(buf); @@ -566,7 +566,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (count) { data.resize(count); PoolVector<uint8_t>::Write w = data.write(); - for (int i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { w[i] = buf[i]; } @@ -597,7 +597,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int //const int*rbuf=(const int*)buf; data.resize(count); PoolVector<int>::Write w = data.write(); - for (int i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { w[i] = decode_uint32(&buf[i * 4]); } @@ -624,7 +624,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int //const float*rbuf=(const float*)buf; data.resize(count); PoolVector<float>::Write w = data.write(); - for (int i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { w[i] = decode_float(&buf[i * 4]); } diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index f44492248e..d090d7a20b 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -102,7 +102,7 @@ StringName ResourceInteractiveLoaderBinary::_get_string() { uint32_t id = f->get_32(); if (id & 0x80000000) { - uint32_t len = id & 0x7FFFFFFF; + int len = id & 0x7FFFFFFF; if (len > str_buf.size()) { str_buf.resize(len); } @@ -336,9 +336,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } break; case OBJECT_EXTERNAL_RESOURCE_INDEX: { //new file format, just refers to an index in the external list - uint32_t erindex = f->get_32(); + int erindex = f->get_32(); - if (erindex >= external_resources.size()) { + if (erindex < 0 || erindex >= external_resources.size()) { WARN_PRINT("Broken external resource! (index out of size"); r_v = Variant(); } else { diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 353eabea45..92af247823 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -51,8 +51,8 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error, const S Ref<Translation> translation = Ref<Translation>(memnew(Translation)); int line = 1; - bool skip_this; - bool skip_next; + bool skip_this = false; + bool skip_next = false; while (true) { diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 62110bfe24..3a4be7cd13 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -385,7 +385,7 @@ void XMLParser::_bind_methods() { Error XMLParser::read() { // if not end reached, parse the node - if (P && (P - data) < length - 1 && *P != 0) { + if (P && (P - data) < (int64_t)length - 1 && *P != 0) { _parse_current_node(); return OK; } diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h index 28c57b567f..26616ed94a 100644 --- a/core/io/xml_parser.h +++ b/core/io/xml_parser.h @@ -67,7 +67,7 @@ public: private: char *data; char *P; - int length; + uint64_t length; void unescape(String &p_str); Vector<String> special_characters; String node_name; diff --git a/core/math/a_star.h b/core/math/a_star.h index d2d2166719..75b860d0a4 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* a_star.h */ +/* a_star.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/core/math/face3.cpp b/core/math/face3.cpp index 748faad28f..e1b172e491 100644 --- a/core/math/face3.cpp +++ b/core/math/face3.cpp @@ -296,7 +296,7 @@ void Face3::get_support(const Vector3 &p_normal, const Transform &p_transform, V /** FIND SUPPORT VERTEX **/ int vert_support_idx = -1; - real_t support_max; + real_t support_max = 0; for (int i = 0; i < 3; i++) { diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index e9a383df40..e0137b6921 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -76,7 +76,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me int simplex[4]; { - real_t max, min; + real_t max = 0, min = 0; for (int i = 0; i < p_points.size(); i++) { @@ -99,7 +99,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me //third vertex is one most further away from the line { - real_t maxd; + real_t maxd = 0; Vector3 rel12 = p_points[simplex[0]] - p_points[simplex[1]]; for (int i = 0; i < p_points.size(); i++) { @@ -121,7 +121,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me //fourth vertex is the one most further away from the plane { - real_t maxd; + real_t maxd = 0; Plane p(p_points[simplex[0]], p_points[simplex[1]], p_points[simplex[2]]); for (int i = 0; i < p_points.size(); i++) { @@ -389,8 +389,8 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me for (int i = 0; i < f.indices.size(); i++) { - uint32_t a = E->get().indices[i]; - uint32_t b = E->get().indices[(i + 1) % f.indices.size()]; + int a = E->get().indices[i]; + int b = E->get().indices[(i + 1) % f.indices.size()]; Edge e(a, b); Map<Edge, RetFaceConnect>::Element *F = ret_edges.find(e); diff --git a/core/os/os.cpp b/core/os/os.cpp index 1292b7eeed..764f7fe6e6 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -64,12 +64,13 @@ void OS::debug_break(){ void OS::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) { - const char *err_type; + const char *err_type = "**ERROR**"; switch (p_type) { case ERR_ERROR: err_type = "**ERROR**"; break; case ERR_WARNING: err_type = "**WARNING**"; break; case ERR_SCRIPT: err_type = "**SCRIPT ERROR**"; break; case ERR_SHADER: err_type = "**SHADER ERROR**"; break; + default: ERR_PRINT("Unknown error type"); break; } if (p_rationale && *p_rationale) diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index 4040680c6d..ad8438e416 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -61,7 +61,7 @@ Variant PackedDataContainer::_iter_init_ofs(const Array &p_iter, uint32_t p_offs Variant PackedDataContainer::_iter_next_ofs(const Array &p_iter, uint32_t p_offset) { Array ref = p_iter; - uint32_t size = _size(p_offset); + int size = _size(p_offset); if (ref.size() != 1) return false; int pos = ref[0]; @@ -74,7 +74,7 @@ Variant PackedDataContainer::_iter_next_ofs(const Array &p_iter, uint32_t p_offs Variant PackedDataContainer::_iter_get_ofs(const Variant &p_iter, uint32_t p_offset) { - uint32_t size = _size(p_offset); + int size = _size(p_offset); int pos = p_iter; if (pos < 0 || pos >= size) return Variant(); @@ -164,7 +164,7 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b if (p_key.is_num()) { int idx = p_key; - uint32_t len = decode_uint32(r + 4); + int len = decode_uint32(r + 4); if (idx < 0 || idx >= len) { err = true; return Variant(); @@ -183,7 +183,7 @@ Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, b uint32_t len = decode_uint32(r + 4); bool found = false; - for (int i = 0; i < len; i++) { + for (uint32_t i = 0; i < len; i++) { uint32_t khash = decode_uint32(r + 8 + i * 12 + 0); if (khash == hash) { Variant key = _get_at_ofs(decode_uint32(r + 8 + i * 12 + 4), rd.ptr(), err); diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp index c122d21545..c5f6d0dde0 100644 --- a/core/pool_allocator.cpp +++ b/core/pool_allocator.cpp @@ -339,9 +339,9 @@ Error PoolAllocator::resize(ID p_mem, int p_new_size) { ERR_FAIL_COND_V(e->lock, ERR_ALREADY_IN_USE); } - int alloc_size = aligned(p_new_size); + uint32_t alloc_size = aligned(p_new_size); - if (aligned(e->len) == alloc_size) { + if ((uint32_t)aligned(e->len) == alloc_size) { e->len = p_new_size; mt_unlock(); @@ -374,7 +374,7 @@ Error PoolAllocator::resize(ID p_mem, int p_new_size) { } //no need to move stuff around, it fits before the next block - int next_pos; + uint32_t next_pos; if (entry_indices_pos + 1 == entry_count) { next_pos = pool_size; // - static_area_size; } else { diff --git a/core/project_settings.cpp b/core/project_settings.cpp index ce1d7918db..a74917162b 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* globals.cpp */ +/* project_settings.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/core/project_settings.h b/core/project_settings.h index 5c8907c74e..718ab2a011 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* globals.h */ +/* project_settings.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/core/reference.h b/core/reference.h index 5fe8296314..ca3ae60418 100644 --- a/core/reference.h +++ b/core/reference.h @@ -62,7 +62,7 @@ public: template <class T> class Ref { - T *reference; + T *reference = NULL; void ref(const Ref &p_from) { diff --git a/core/ustring.cpp b/core/ustring.cpp index ee07c7b11b..8273ed144b 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -588,7 +588,7 @@ String String::camelcase_to_underscore(bool lowercase) const { const char a = 'a', z = 'z'; int start_index = 0; - for (size_t i = 1; i < this->size(); i++) { + for (int i = 1; i < this->size(); i++) { bool is_upper = cstr[i] >= A && cstr[i] <= Z; bool is_number = cstr[i] >= '0' && cstr[i] <= '9'; bool are_next_2_lower = false; @@ -3655,12 +3655,12 @@ String String::sprintf(const Array &values, bool *error) const { CharType *self = (CharType *)c_str(); bool in_format = false; int value_index = 0; - int min_chars; - int min_decimals; - bool in_decimals; - bool pad_with_zeroes; - bool left_justified; - bool show_sign; + int min_chars = 0; + int min_decimals = 0; + bool in_decimals = false; + bool pad_with_zeroes = false; + bool left_justified = false; + bool show_sign = false; *error = true; @@ -3687,12 +3687,12 @@ String String::sprintf(const Array &values, bool *error) const { } int64_t value = values[value_index]; - int base; + int base = 16; bool capitalize = false; switch (c) { case 'd': base = 10; break; case 'o': base = 8; break; - case 'x': base = 16; break; + case 'x': break; case 'X': base = 16; capitalize = true; @@ -3842,7 +3842,7 @@ String String::sprintf(const Array &values, bool *error) const { } break; } - case '.': { // Float separtor. + case '.': { // Float separator. if (in_decimals) { return "too many decimal points in format"; } @@ -3851,7 +3851,7 @@ String String::sprintf(const Array &values, bool *error) const { break; } - case '*': { // Dyanmic width, based on value. + case '*': { // Dynamic width, based on value. if (value_index >= values.size()) { return "not enough arguments for format string"; } diff --git a/core/vmap.h b/core/vmap.h index f0977341ec..8165a919b6 100644 --- a/core/vmap.h +++ b/core/vmap.h @@ -60,9 +60,13 @@ class VMap { int low = 0; int high = _data.size() - 1; - int middle; const _Pair *a = &_data[0]; + int middle = 0; +#if DEBUG_ENABLED + if (low > high) + ERR_PRINT("low > high, this may be a bug"); +#endif while (low <= high) { middle = (low + high) / 2; diff --git a/core/vset.h b/core/vset.h index 7b12ae0b25..67af6c1a4c 100644 --- a/core/vset.h +++ b/core/vset.h @@ -46,8 +46,13 @@ class VSet { int low = 0; int high = _data.size() - 1; - int middle; const T *a = &_data[0]; + int middle = 0; + +#if DEBUG_ENABLED + if (low > high) + ERR_PRINT("low > high, this may be a bug"); +#endif while (low <= high) { middle = (low + high) / 2; |