diff options
34 files changed, 105 insertions, 105 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; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index a492629dae..047b2375f8 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -247,7 +247,7 @@ bool RasterizerSceneGLES3::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int qidx = p_in_quadrants[i]; - if (shadow_atlas->quadrants[qidx].subdivision == p_current_subdiv) { + if (shadow_atlas->quadrants[qidx].subdivision == (uint32_t)p_current_subdiv) { return false; } @@ -349,7 +349,7 @@ bool RasterizerSceneGLES3::shadow_atlas_update_light(RID p_atlas, RID p_light_in uint32_t q = (key >> ShadowAtlas::QUADRANT_SHIFT) & 0x3; uint32_t s = key & ShadowAtlas::SHADOW_INDEX_MASK; - bool should_realloc = shadow_atlas->quadrants[q].subdivision != best_subdiv && (shadow_atlas->quadrants[q].shadows[s].alloc_tick - tick > shadow_atlas_realloc_tolerance_msec); + bool should_realloc = shadow_atlas->quadrants[q].subdivision != (uint32_t)best_subdiv && (shadow_atlas->quadrants[q].shadows[s].alloc_tick - tick > shadow_atlas_realloc_tolerance_msec); bool should_redraw = shadow_atlas->quadrants[q].shadows[s].version != p_light_version; if (!should_realloc) { @@ -554,7 +554,7 @@ void RasterizerSceneGLES3::reflection_atlas_set_subdivision(RID p_ref_atlas, int ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(p_ref_atlas); ERR_FAIL_COND(!reflection_atlas); - uint32_t subdiv = next_power_of_2(p_subdiv); + int subdiv = next_power_of_2(p_subdiv); if (subdiv & 0xaaaaaaaa) { //sqrt(subdiv) must be integer subdiv <<= 1; } @@ -2700,7 +2700,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c uint32_t quadrant = (key >> ShadowAtlas::QUADRANT_SHIFT) & 0x3; uint32_t shadow = key & ShadowAtlas::SHADOW_INDEX_MASK; - ERR_CONTINUE(shadow >= shadow_atlas->quadrants[quadrant].shadows.size()); + ERR_CONTINUE(shadow >= (uint32_t)shadow_atlas->quadrants[quadrant].shadows.size()); uint32_t atlas_size = shadow_atlas->size; uint32_t quadrant_size = atlas_size >> 1; @@ -2787,7 +2787,7 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c uint32_t quadrant = (key >> ShadowAtlas::QUADRANT_SHIFT) & 0x3; uint32_t shadow = key & ShadowAtlas::SHADOW_INDEX_MASK; - ERR_CONTINUE(shadow >= shadow_atlas->quadrants[quadrant].shadows.size()); + ERR_CONTINUE(shadow >= (uint32_t)shadow_atlas->quadrants[quadrant].shadows.size()); uint32_t atlas_size = shadow_atlas->size; uint32_t quadrant_size = atlas_size >> 1; @@ -4467,7 +4467,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_ uint32_t quadrant = (key >> ShadowAtlas::QUADRANT_SHIFT) & 0x3; uint32_t shadow = key & ShadowAtlas::SHADOW_INDEX_MASK; - ERR_FAIL_INDEX(shadow, shadow_atlas->quadrants[quadrant].shadows.size()); + ERR_FAIL_INDEX((int)shadow, shadow_atlas->quadrants[quadrant].shadows.size()); uint32_t quadrant_size = shadow_atlas->size >> 1; diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 659408b455..c4dab1290b 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -244,7 +244,7 @@ public: GLuint fbo_id[6]; GLuint cubemap; - int size; + uint32_t size; }; Vector<ShadowCubeMap> shadow_cubemaps; diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 46c9442ffc..246d4d7650 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -216,8 +216,8 @@ void ImageLoaderPNG::get_recognized_extensions(List<String> *p_extensions) const struct PNGReadStatus { - int offset; - int size; + uint32_t offset; + uint32_t size; const unsigned char *image; }; diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 2f03e72851..5fa46fac2c 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -474,7 +474,7 @@ Error EditorSceneImporterGLTF::_decode_buffer_view(GLTFState &state, int p_buffe int buffer_end = (stride * (count - 1)) + element_size; ERR_FAIL_COND_V(buffer_end > bv.byte_length, ERR_PARSE_ERROR); - ERR_FAIL_COND_V((offset + buffer_end) > buffer.size(), ERR_PARSE_ERROR); + ERR_FAIL_COND_V((int)(offset + buffer_end) > buffer.size(), ERR_PARSE_ERROR); //fill everything as doubles diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 4f3472bf03..601842799a 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -409,7 +409,7 @@ bool CanvasItemEditor::_is_part_of_subscene(CanvasItem *p_item) { return item_owner && item_owner != scene_node && p_item != scene_node && item_owner->get_filename() != ""; } -void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, unsigned int limit) { +void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, int limit) { if (!p_node) return; if (Object::cast_to<Viewport>(p_node)) diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 8f67d641f5..da217007ea 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -291,7 +291,7 @@ class CanvasItemEditor : public VBoxContainer { int handle_len; bool _is_part_of_subscene(CanvasItem *p_item); - void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, unsigned int limit = 0); + void _find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, Vector<_SelectResult> &r_items, int limit = 0); void _find_canvas_items_at_rect(const Rect2 &p_rect, Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform, List<CanvasItem *> *r_items); void _select_click_on_empty_area(Point2 p_click_pos, bool p_append, bool p_box_selection); diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp index a5f854e1b1..84620a75a5 100644 --- a/editor/plugins/line_2d_editor_plugin.cpp +++ b/editor/plugins/line_2d_editor_plugin.cpp @@ -211,7 +211,7 @@ void Line2DEditor::_bind_methods() { } void Line2DEditor::_mode_selected(int p_mode) { - for (unsigned int i = 0; i < _MODE_COUNT; ++i) { + for (int i = 0; i < _MODE_COUNT; ++i) { toolbar_buttons[i]->set_pressed(i == p_mode); } mode = Mode(p_mode); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index bc5c700959..4e6c9fa23f 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2958,7 +2958,7 @@ void SpatialEditor::update_transform_gizmo() { gizmo.transform.origin = pcenter; gizmo.transform.basis = gizmo_basis; - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i]->update_transform_gizmo_view(); } } @@ -3108,7 +3108,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) { Array vp = d["viewports"]; ERR_FAIL_COND(vp.size() > 4); - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i]->set_state(vp[i]); } } @@ -3852,15 +3852,15 @@ void SpatialEditor::_toggle_maximize_view(Object *p_viewport) { if (!maximized) { - for (int i = 0; i < VIEWPORTS_COUNT; i++) { - if (i == index) + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { + if (i == (uint32_t)index) viewports[i]->set_area_as_parent_rect(); else viewports[i]->hide(); } } else { - for (int i = 0; i < VIEWPORTS_COUNT; i++) + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) viewports[i]->show(); if (view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT))) @@ -3904,7 +3904,7 @@ void SpatialEditor::clear() { settings_znear->set_value(EDITOR_DEF("editors/3d/default_z_near", 0.1)); settings_zfar->set_value(EDITOR_DEF("editors/3d/default_z_far", 1500.0)); - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i]->reset(); } @@ -3917,7 +3917,7 @@ void SpatialEditor::clear() { } } - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i]->view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(SpatialEditorViewport::VIEW_AUDIO_LISTENER), i == 0); viewports[i]->viewport->set_as_audio_listener(i == 0); @@ -4074,7 +4074,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { viewport_base = memnew(SpatialEditorViewportContainer); shader_split->add_child(viewport_base); viewport_base->set_v_size_flags(SIZE_EXPAND_FILL); - for (int i = 0; i < VIEWPORTS_COUNT; i++) { + for (uint32_t i = 0; i < VIEWPORTS_COUNT; i++) { viewports[i] = memnew(SpatialEditorViewport(this, editor, i)); viewports[i]->connect("toggle_maximize_view", this, "_toggle_maximize_view"); diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp index 9a15beb6eb..e86fd06d81 100644 --- a/modules/etc/image_etc.cpp +++ b/modules/etc/image_etc.cpp @@ -117,7 +117,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f return; } - int imgw = p_img->get_width(), imgh = p_img->get_height(); + uint32_t imgw = p_img->get_width(), imgh = p_img->get_height(); ERR_FAIL_COND(next_power_of_2(imgw) != imgw || next_power_of_2(imgh) != imgh); Image::Format etc_format = force_etc1_format ? Image::FORMAT_ETC : _get_etc2_mode(detected_channels); diff --git a/modules/gdnative/godot/array.cpp b/modules/gdnative/godot/array.cpp index c15ba30ca2..c3fde0e954 100644 --- a/modules/gdnative/godot/array.cpp +++ b/modules/gdnative/godot/array.cpp @@ -61,7 +61,7 @@ void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_poo memnew_placement(dest, Array); dest->resize(pca->size()); - for (size_t i = 0; i < dest->size(); i++) { + for (int i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); dest->operator[](i) = v; } @@ -73,7 +73,7 @@ void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_p memnew_placement(dest, Array); dest->resize(pca->size()); - for (size_t i = 0; i < dest->size(); i++) { + for (int i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); dest->operator[](i) = v; } @@ -85,7 +85,7 @@ void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_p memnew_placement(dest, Array); dest->resize(pca->size()); - for (size_t i = 0; i < dest->size(); i++) { + for (int i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); dest->operator[](i) = v; } @@ -97,7 +97,7 @@ void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_po memnew_placement(dest, Array); dest->resize(pca->size()); - for (size_t i = 0; i < dest->size(); i++) { + for (int i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); dest->operator[](i) = v; } @@ -109,7 +109,7 @@ void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool memnew_placement(dest, Array); dest->resize(pca->size()); - for (size_t i = 0; i < dest->size(); i++) { + for (int i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); dest->operator[](i) = v; } @@ -121,7 +121,7 @@ void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_ memnew_placement(dest, Array); dest->resize(pca->size()); - for (size_t i = 0; i < dest->size(); i++) { + for (int i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); dest->operator[](i) = v; } @@ -133,7 +133,7 @@ void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool memnew_placement(dest, Array); dest->resize(pca->size()); - for (size_t i = 0; i < dest->size(); i++) { + for (int i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); dest->operator[](i) = v; } diff --git a/modules/gdnative/godot/pool_arrays.cpp b/modules/gdnative/godot/pool_arrays.cpp index 2e533077f6..49bf851051 100644 --- a/modules/gdnative/godot/pool_arrays.cpp +++ b/modules/gdnative/godot/pool_arrays.cpp @@ -65,7 +65,7 @@ void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, c memnew_placement(dest, PoolVector<uint8_t>); dest->resize(a->size()); - for (size_t i = 0; i < a->size(); i++) { + for (int i = 0; i < a->size(); i++) { dest->set(i, (*a)[i]); } } @@ -144,7 +144,7 @@ void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, con memnew_placement(dest, PoolVector<godot_int>); dest->resize(a->size()); - for (size_t i = 0; i < a->size(); i++) { + for (int i = 0; i < a->size(); i++) { dest->set(i, (*a)[i]); } } @@ -223,7 +223,7 @@ void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, c memnew_placement(dest, PoolVector<godot_real>); dest->resize(a->size()); - for (size_t i = 0; i < a->size(); i++) { + for (int i = 0; i < a->size(); i++) { dest->set(i, (*a)[i]); } } @@ -302,7 +302,7 @@ void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_des memnew_placement(dest, PoolVector<String>); dest->resize(a->size()); - for (size_t i = 0; i < a->size(); i++) { + for (int i = 0; i < a->size(); i++) { dest->set(i, (*a)[i]); } } @@ -389,7 +389,7 @@ void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_d memnew_placement(dest, PoolVector<Vector2>); dest->resize(a->size()); - for (size_t i = 0; i < a->size(); i++) { + for (int i = 0; i < a->size(); i++) { dest->set(i, (*a)[i]); } } @@ -475,7 +475,7 @@ void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_d memnew_placement(dest, PoolVector<Vector3>); dest->resize(a->size()); - for (size_t i = 0; i < a->size(); i++) { + for (int i = 0; i < a->size(); i++) { dest->set(i, (*a)[i]); } } @@ -561,7 +561,7 @@ void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, memnew_placement(dest, PoolVector<Color>); dest->resize(a->size()); - for (size_t i = 0; i < a->size(); i++) { + for (int i = 0; i < a->size(); i++) { dest->set(i, (*a)[i]); } } diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index 8afd01e20b..00e8ce0f54 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -309,7 +309,7 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end) _pattern_info(PCRE2_INFO_NAMETABLE, &table); _pattern_info(PCRE2_INFO_NAMEENTRYSIZE, &entry_size); - for (int i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { CharType id = table[i * entry_size]; if (result->data[id].start == -1) @@ -338,7 +338,7 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a PCRE2_SIZE olength = output.length(); PCRE2_SIZE length = p_subject.length(); - if (p_end >= 0 && p_end < length) + if (p_end >= 0 && (uint32_t)p_end < length) length = p_end; if (sizeof(CharType) == 2) { @@ -430,7 +430,7 @@ Array RegEx::get_names() const { _pattern_info(PCRE2_INFO_NAMETABLE, &table); _pattern_info(PCRE2_INFO_NAMEENTRYSIZE, &entry_size); - for (int i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { String name = &table[i * entry_size + 1]; if (result.find(name) < 0) { diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp index 379c894550..8b1d422ce2 100644 --- a/modules/tga/image_loader_tga.cpp +++ b/modules/tga/image_loader_tga.cpp @@ -53,19 +53,19 @@ Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t count = (c & 0x7f) + 1; if (c & 0x80) { - for (int i = 0; i < p_pixel_size; i++) { + for (size_t i = 0; i < p_pixel_size; i++) { pixels_w.ptr()[i] = p_compressed_buffer[compressed_pos]; compressed_pos += 1; } - for (int i = 0; i < count; i++) { - for (int j = 0; j < p_pixel_size; j++) { + for (size_t i = 0; i < count; i++) { + for (size_t j = 0; j < p_pixel_size; j++) { p_uncompressed_buffer[output_pos + j] = pixels_w.ptr()[j]; } output_pos += p_pixel_size; } } else { count *= p_pixel_size; - for (int i = 0; i < count; i++) { + for (size_t i = 0; i < count; i++) { p_uncompressed_buffer[output_pos] = p_compressed_buffer[compressed_pos]; compressed_pos += 1; output_pos += 1; @@ -208,7 +208,7 @@ Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force PoolVector<uint8_t> src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); - ERR_FAIL_COND_V(src_image_len < sizeof(tga_header_s), ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(src_image_len < (int)sizeof(tga_header_s), ERR_FILE_CORRUPT); src_image.resize(src_image_len); Error err = OK; diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index c129743507..f9b8422004 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -501,7 +501,7 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t size_t block_size = (p_len - step) > BLOCK_SIZE ? BLOCK_SIZE : (p_len - step); - for (int i = 0; i < block_size; i++) { + for (uint32_t i = 0; i < block_size; i++) { strm_in[i] = p_buffer[step + i]; } @@ -523,14 +523,14 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t //package->store_buffer(strm_out.ptr(), strm.total_out - total_out_before); int start = file_buffer.size(); file_buffer.resize(file_buffer.size() + bh.compressed_size); - for (int i = 0; i < bh.compressed_size; i++) + for (uint32_t i = 0; i < bh.compressed_size; i++) file_buffer[start + i] = strm_out[i]; } else { bh.compressed_size = block_size; //package->store_buffer(strm_in.ptr(), block_size); int start = file_buffer.size(); file_buffer.resize(file_buffer.size() + block_size); - for (int i = 0; i < bh.compressed_size; i++) + for (uint32_t i = 0; i < bh.compressed_size; i++) file_buffer[start + i] = strm_in[i]; } @@ -553,7 +553,7 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t //package->store_buffer(strm_out.ptr(), strm.total_out - total_out_before); int start = file_buffer.size(); file_buffer.resize(file_buffer.size() + (strm.total_out - total_out_before)); - for (int i = 0; i < (strm.total_out - total_out_before); i++) + for (uint32_t i = 0; i < (strm.total_out - total_out_before); i++) file_buffer[start + i] = strm_out[i]; deflateEnd(&strm); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 9bad871ef9..f8d82a339c 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -534,7 +534,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { uint64_t now = OS::get_singleton()->get_ticks_msec(); uint64_t diff = now - search_time_msec; - if (diff < int(ProjectSettings::get_singleton()->get("gui/timers/incremental_search_max_interval_msec")) * 2) { + if (diff < uint64_t(ProjectSettings::get_singleton()->get("gui/timers/incremental_search_max_interval_msec")) * 2) { for (int i = current - 1; i >= 0; i--) { @@ -569,7 +569,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { uint64_t now = OS::get_singleton()->get_ticks_msec(); uint64_t diff = now - search_time_msec; - if (diff < int(ProjectSettings::get_singleton()->get("gui/timers/incremental_search_max_interval_msec")) * 2) { + if (diff < uint64_t(ProjectSettings::get_singleton()->get("gui/timers/incremental_search_max_interval_msec")) * 2) { for (int i = current + 1; i < items.size(); i++) { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 9751d6e711..6a9ded9ea3 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -501,9 +501,9 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla Vector<Ref<Image> > mipmap_images; int total_size = 0; - for (int i = 0; i < mipmaps; i++) { + for (uint32_t i = 0; i < mipmaps; i++) { - if (i > 0) { + if (i) { size = f->get_32(); } diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp index 2f160fd7cd..113e356612 100644 --- a/servers/audio/audio_rb_resampler.cpp +++ b/servers/audio/audio_rb_resampler.cpp @@ -176,7 +176,7 @@ bool AudioRBResampler::mix(int32_t *p_dest, int p_frames) { { - uint32_t read = 0; + int read = 0; switch (channels) { case 1: read = _resample<1>(p_dest, todo, increment); break; case 2: read = _resample<2>(p_dest, todo, increment); break; @@ -189,7 +189,7 @@ bool AudioRBResampler::mix(int32_t *p_dest, int p_frames) { if (remaining && todo > 0) { //print_line("fadeout"); - for (int c = 0; c < channels; c++) { + for (uint32_t c = 0; c < channels; c++) { for (int i = 0; i < todo; i++) { @@ -202,7 +202,7 @@ bool AudioRBResampler::mix(int32_t *p_dest, int p_frames) { } //zero out what remains there to avoid glitches - for (int i = todo * channels; i < int(p_frames) * channels; i++) { + for (uint32_t i = todo * channels; i < int(p_frames) * channels; i++) { p_dest[i] = 0; } @@ -250,7 +250,7 @@ Error AudioRBResampler::setup(int p_channels, int p_src_mix_rate, int p_target_m rb_write_pos = 0; //avoid maybe strange noises upon load - for (int i = 0; i < (rb_len * channels); i++) { + for (unsigned int i = 0; i < (rb_len * channels); i++) { rb[i] = 0; read_buf[i] = 0; diff --git a/servers/audio/effects/audio_effect_chorus.cpp b/servers/audio/effects/audio_effect_chorus.cpp index 4075bc3e63..76dd585ffa 100644 --- a/servers/audio/effects/audio_effect_chorus.cpp +++ b/servers/audio/effects/audio_effect_chorus.cpp @@ -78,7 +78,7 @@ void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, A uint64_t increment = llrint(cycles_to_mix / (double)p_frame_count * (double)(1 << AudioEffectChorus::CYCLES_FRAC)); //check the LFO doesn't read ahead of the write pos - if ((((int)max_depth_frames) + 10) > delay_frames) { //10 as some threshold to avoid precision stuff + if ((((unsigned int)max_depth_frames) + 10) > delay_frames) { //10 as some threshold to avoid precision stuff delay_frames += (int)max_depth_frames - delay_frames; delay_frames += 10; //threshold to avoid precision stuff } diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp index 6c800a4b49..db18995bee 100644 --- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp +++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp @@ -640,7 +640,7 @@ BroadPhase2DHashGrid::BroadPhase2DHashGrid() { cell_size = GLOBAL_DEF("physics/2d/cell_size", 128); large_object_min_surface = GLOBAL_DEF("physics/2d/large_object_surface_threshold_in_cells", 512); - for (int i = 0; i < hash_table_size; i++) + for (uint32_t i = 0; i < hash_table_size; i++) hash_table[i] = NULL; pass = 1; @@ -649,7 +649,7 @@ BroadPhase2DHashGrid::BroadPhase2DHashGrid() { BroadPhase2DHashGrid::~BroadPhase2DHashGrid() { - for (int i = 0; i < hash_table_size; i++) { + for (uint32_t i = 0; i < hash_table_size; i++) { while (hash_table[i]) { PosBin *pb = hash_table[i]; hash_table[i] = pb->next; diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index cd68c14de8..1d9e6bef24 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1687,7 +1687,7 @@ bool VisualServerScene::_render_reflection_probe_step(Instance *p_instance, int void VisualServerScene::_gi_probe_fill_local_data(int p_idx, int p_level, int p_x, int p_y, int p_z, const GIProbeDataCell *p_cell, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data, Vector<uint32_t> *prev_cell) { - if (p_level == p_header->cell_subdiv - 1) { + if ((uint32_t)p_level == p_header->cell_subdiv - 1) { Vector3 emission; emission.x = (p_cell[p_idx].emission >> 24) / 255.0; @@ -1798,9 +1798,9 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { } for (int i = 0; i < (int)header->cell_subdiv; i++) { - uint32_t x = header->width >> i; - uint32_t y = header->height >> i; - uint32_t z = header->depth >> i; + int x = header->width >> i; + int y = header->height >> i; + int z = header->depth >> i; //create and clear mipmap PoolVector<uint8_t> mipmap; @@ -1896,7 +1896,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { uint8_t alpha_block[4][4] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; - for (int j = 0; j < k.source_count; j++) { + for (uint32_t j = 0; j < k.source_count; j++) { int alpha = (cells[k.sources[j]].level_alpha >> 8) & 0xFF; if (alpha < min_alpha) @@ -2389,7 +2389,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { Vector3 colors[16]; - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { colors[j].x = (local_data[b.sources[j]].energy[0] / float(probe_data->dynamic.bake_dynamic_range)) / 1024.0; colors[j].y = (local_data[b.sources[j]].energy[1] / float(probe_data->dynamic.bake_dynamic_range)) / 1024.0; @@ -2403,8 +2403,8 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { if (b.source_count == 16) { //all cells are used so, find minmax between them int further_apart[2] = { 0, 0 }; - for (int j = 0; j < b.source_count; j++) { - for (int k = j + 1; k < b.source_count; k++) { + for (uint32_t j = 0; j < b.source_count; j++) { + for (uint32_t k = j + 1; k < b.source_count; k++) { float d = colors[j].distance_squared_to(colors[k]); if (d > distance) { distance = d; @@ -2424,12 +2424,12 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { //average all colors first Vector3 average; - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { average += colors[j]; } average.normalize(); //find max distance in normal from average - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { float d = average.dot(colors[j]); distance = MAX(d, distance); } @@ -2459,7 +2459,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { Vector3 dir = (to - from).normalized(); - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { float d = (colors[j] - from).dot(dir) / distance; indices[j] = int(d * 3 + 0.5); @@ -2469,7 +2469,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { indices[j] = index_swap[CLAMP(indices[j], 0, 3)]; } } else { - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { indices[j] = 0; } } @@ -2478,7 +2478,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { uint32_t index_block[16] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - for (int j = 0; j < b.source_count; j++) { + for (uint32_t j = 0; j < b.source_count; j++) { int x = local_data[b.sources[j]].pos[0] % 4; int y = local_data[b.sources[j]].pos[1] % 4; |