diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 2 | ||||
-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/xml_parser.cpp | 2 | ||||
-rw-r--r-- | core/io/xml_parser.h | 2 | ||||
-rw-r--r-- | core/math/quick_hull.cpp | 4 | ||||
-rw-r--r-- | core/packed_data_container.cpp | 8 | ||||
-rw-r--r-- | core/pool_allocator.cpp | 6 | ||||
-rw-r--r-- | core/ustring.cpp | 2 |
14 files changed, 33 insertions, 33 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/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/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/quick_hull.cpp b/core/math/quick_hull.cpp index e9a383df40..2f3445bdcd 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -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/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/ustring.cpp b/core/ustring.cpp index ee07c7b11b..7f073b4e02 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; |