diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_bezier_editor.cpp | 3 | ||||
-rw-r--r-- | editor/editor_asset_installer.cpp | 3 | ||||
-rw-r--r-- | editor/editor_data.cpp | 2 | ||||
-rw-r--r-- | editor/editor_log.cpp | 4 | ||||
-rw-r--r-- | editor/editor_node.cpp | 6 | ||||
-rw-r--r-- | editor/editor_node.h | 2 | ||||
-rw-r--r-- | editor/editor_run.cpp | 5 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 2 | ||||
-rw-r--r-- | editor/editor_settings.h | 2 | ||||
-rw-r--r-- | editor/export_template_manager.cpp | 19 | ||||
-rw-r--r-- | editor/fileserver/editor_file_server.cpp | 4 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 2 | ||||
-rw-r--r-- | editor/find_in_files.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/animation_state_machine_editor.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 23 | ||||
-rw-r--r-- | editor/plugins/material_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/tiles/tiles_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/pot_generator.cpp | 4 | ||||
-rw-r--r-- | editor/project_manager.cpp | 11 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 2 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 2 |
23 files changed, 70 insertions, 48 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 0dbe230699..8239745a3e 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -146,11 +146,10 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) { int iterations = 10; float low = 0; float high = 1; - float middle; //narrow high and low as much as possible for (int k = 0; k < iterations; k++) { - middle = (low + high) / 2; + float middle = (low + high) / 2; Vector2 interp = _bezier_interp(middle, start, out_handle, in_handle, end); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index f1674c47c5..2537c4d4a8 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -259,6 +259,9 @@ void EditorAssetInstaller::ok_pressed() { unz_file_info info; char fname[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); + if (ret != UNZ_OK) { + break; + } String name = String::utf8(fname); diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index a5e76ba0c0..a58a279faa 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -824,7 +824,7 @@ void EditorData::save_edited_scene_state(EditorSelection *p_selection, EditorSel Dictionary EditorData::restore_edited_scene_state(EditorSelection *p_selection, EditorSelectionHistory *p_history) { ERR_FAIL_INDEX_V(current_edited_scene, edited_scene.size(), Dictionary()); - EditedScene &es = edited_scene.write[current_edited_scene]; + const EditedScene &es = edited_scene.write[current_edited_scene]; p_history->current_elem_idx = es.history_current; p_history->history = es.history_stored; diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 97a8aa86ea..ee2d72c5b0 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -38,7 +38,7 @@ #include "scene/resources/font.h" void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_file, int p_line, const char *p_error, const char *p_errorexp, bool p_editor_notify, ErrorHandlerType p_type) { - EditorLog *self = (EditorLog *)p_self; + EditorLog *self = static_cast<EditorLog *>(p_self); if (self->current != Thread::get_caller_id()) { return; } @@ -216,7 +216,7 @@ void EditorLog::set_tool_button(Button *p_tool_button) { } void EditorLog::_undo_redo_cbk(void *p_self, const String &p_name) { - EditorLog *self = (EditorLog *)p_self; + EditorLog *self = static_cast<EditorLog *>(p_self); self->add_message(p_name, EditorLog::MSG_TYPE_EDITOR); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 0cd07333ea..a80c7853f5 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3854,7 +3854,7 @@ void EditorNode::add_io_error(const String &p_error) { } void EditorNode::_load_error_notify(void *p_ud, const String &p_text) { - EditorNode *en = (EditorNode *)p_ud; + EditorNode *en = static_cast<EditorNode *>(p_ud); en->load_errors->add_image(en->gui_base->get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); en->load_errors->add_text(p_text + "\n"); en->load_error_dialog->popup_centered_ratio(0.5); @@ -4261,7 +4261,7 @@ void EditorNode::_copy_warning(const String &p_str) { void EditorNode::_dock_floating_close_request(Control *p_control) { // Through the MarginContainer to the Window. - Window *window = (Window *)p_control->get_parent()->get_parent(); + Window *window = static_cast<Window *>(p_control->get_parent()->get_parent()); int window_slot = window->get_meta("dock_slot"); p_control->get_parent()->remove_child(p_control); @@ -5773,7 +5773,7 @@ static Node *_resource_get_edited_scene() { } void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_error) { - EditorNode *en = (EditorNode *)p_this; + EditorNode *en = static_cast<EditorNode *>(p_this); en->log->add_message(p_string, p_error ? EditorLog::MSG_TYPE_ERROR : EditorLog::MSG_TYPE_STD); } diff --git a/editor/editor_node.h b/editor/editor_node.h index 2e0fb19b87..685714cb47 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -485,7 +485,7 @@ private: static Vector<EditorNodeInitCallback> _init_callbacks; static void _dependency_error_report(void *ud, const String &p_path, const String &p_dep, const String &p_type) { - EditorNode *en = (EditorNode *)ud; + EditorNode *en = static_cast<EditorNode *>(ud); if (!en->dependency_errors.has(p_path)) { en->dependency_errors[p_path] = Set<String>(); } diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp index 4743294967..574acdff1c 100644 --- a/editor/editor_run.cpp +++ b/editor/editor_run.cpp @@ -110,9 +110,10 @@ Error EditorRun::run(const String &p_scene) { } int window_placement = EditorSettings::get_singleton()->get("run/window_placement/rect"); - bool hidpi_proj = ProjectSettings::get_singleton()->get("display/window/dpi/allow_hidpi"); - int display_scale = 1; if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_HIDPI)) { + bool hidpi_proj = ProjectSettings::get_singleton()->get("display/window/dpi/allow_hidpi"); + int display_scale = 1; + if (OS::get_singleton()->is_hidpi_allowed()) { if (hidpi_proj) { display_scale = 1; // Both editor and project runs in hiDPI mode, do not scale. diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 461f640578..4ddc66ed98 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -1389,7 +1389,7 @@ float EditorSettings::get_auto_display_scale() const { // Shortcuts -void EditorSettings::add_shortcut(const String &p_name, Ref<Shortcut> &p_shortcut) { +void EditorSettings::add_shortcut(const String &p_name, const Ref<Shortcut> &p_shortcut) { shortcuts[p_name] = p_shortcut; } diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 4f25259a01..d1b9cabfb7 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -179,7 +179,7 @@ public: String get_editor_layouts_config() const; float get_auto_display_scale() const; - void add_shortcut(const String &p_name, Ref<Shortcut> &p_shortcut); + void add_shortcut(const String &p_name, const Ref<Shortcut> &p_shortcut); bool is_shortcut(const String &p_name, const Ref<InputEvent> &p_event) const; Ref<Shortcut> get_shortcut(const String &p_name) const; void get_shortcut_list(List<String> *r_shortcuts); diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 7320f957c9..f93c2df13d 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -395,6 +395,9 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_ unz_file_info info; char fname[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); + if (ret != UNZ_OK) { + break; + } String file = String::utf8(fname); if (file.ends_with("version.txt")) { @@ -404,6 +407,9 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_ // Read. unzOpenCurrentFile(pkg); ret = unzReadCurrentFile(pkg, data.ptrw(), data.size()); + if (ret != UNZ_OK) { + break; + } unzCloseCurrentFile(pkg); String data_str; @@ -455,7 +461,10 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_ // Get filename. unz_file_info info; char fname[16384]; - unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); + ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); + if (ret != UNZ_OK) { + break; + } String file_path(String::utf8(fname).simplify_path()); @@ -471,7 +480,10 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_ // Read unzOpenCurrentFile(pkg); - unzReadCurrentFile(pkg, data.ptrw(), data.size()); + ret = unzReadCurrentFile(pkg, data.ptrw(), data.size()); + if (ret != UNZ_OK) { + break; + } unzCloseCurrentFile(pkg); String base_dir = file_path.get_base_dir().trim_suffix("/"); @@ -697,6 +709,9 @@ Error ExportTemplateManager::install_android_template_from_file(const String &p_ unz_file_info info; char fpath[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fpath, 16384, nullptr, 0, nullptr, 0); + if (ret != UNZ_OK) { + break; + } String path = String::utf8(fpath); String base_dir = path.get_base_dir(); diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp index df0af69359..30dc9180e3 100644 --- a/editor/fileserver/editor_file_server.cpp +++ b/editor/fileserver/editor_file_server.cpp @@ -53,7 +53,7 @@ void EditorFileServer::_close_client(ClientData *cd) { } void EditorFileServer::_subthread_start(void *s) { - ClientData *cd = (ClientData *)s; + ClientData *cd = static_cast<ClientData *>(s); cd->connection->set_no_delay(true); uint8_t buf4[8]; @@ -259,7 +259,7 @@ void EditorFileServer::_subthread_start(void *s) { } void EditorFileServer::_thread_start(void *s) { - EditorFileServer *self = (EditorFileServer *)s; + EditorFileServer *self = static_cast<EditorFileServer *>(s); while (!self->quit) { if (self->cmd == CMD_ACTIVATE) { self->server->listen(self->port); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index f6d00470d1..bca78d18e4 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1432,7 +1432,7 @@ void FileSystemDock::_make_dir_confirm() { Error err = da->change_dir(directory); ERR_FAIL_COND_MSG(err != OK, "Cannot open directory '" + directory + "'."); - if (da->dir_exists(directory)) { + if (da->dir_exists(dir_name)) { EditorNode::get_singleton()->show_warning(TTR("Could not create folder. File with that name already exists.")); return; } diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 1ce363c651..0dfaaaa1f4 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -449,7 +449,7 @@ Set<String> FindInFilesDialog::get_filter() const { // Could check the _filters_preferences but it might not have been generated yet. Set<String> filters; for (int i = 0; i < _filters_container->get_child_count(); ++i) { - CheckBox *cb = (CheckBox *)_filters_container->get_child(i); + CheckBox *cb = static_cast<CheckBox *>(_filters_container->get_child(i)); if (cb->is_pressed()) { filters.insert(cb->get_text()); } @@ -489,7 +489,7 @@ void FindInFilesDialog::_on_folder_button_pressed() { void FindInFilesDialog::custom_action(const String &p_action) { for (int i = 0; i < _filters_container->get_child_count(); ++i) { - CheckBox *cb = (CheckBox *)_filters_container->get_child(i); + CheckBox *cb = static_cast<CheckBox *>(_filters_container->get_child(i)); _filters_preferences[cb->get_text()] = cb->is_pressed(); } diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index bd0c1afd19..f0dabed652 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -499,7 +499,7 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co accent.a *= 0.6; } - Ref<Texture2D> icons[6] = { + const Ref<Texture2D> icons[6] = { get_theme_icon(SNAME("TransitionImmediateBig"), SNAME("EditorIcons")), get_theme_icon(SNAME("TransitionSyncBig"), SNAME("EditorIcons")), get_theme_icon(SNAME("TransitionEndBig"), SNAME("EditorIcons")), diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 78307fbe7c..a90e151adb 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -860,7 +860,7 @@ void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_ite } void CanvasItemEditor::_snap_changed() { - ((SnapDialog *)snap_dialog)->get_fields(grid_offset, grid_step, primary_grid_steps, snap_rotation_offset, snap_rotation_step, snap_scale_step); + static_cast<SnapDialog *>(snap_dialog)->get_fields(grid_offset, grid_step, primary_grid_steps, snap_rotation_offset, snap_rotation_step, snap_scale_step); grid_step_multiplier = 0; viewport->update(); } @@ -1504,7 +1504,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) { } } - DragType dragger[] = { + const DragType dragger[] = { DRAG_ANCHOR_TOP_LEFT, DRAG_ANCHOR_TOP_RIGHT, DRAG_ANCHOR_BOTTOM_RIGHT, @@ -1635,14 +1635,14 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) { Rect2 rect = canvas_item->_edit_get_rect(); Transform2D xform = transform * canvas_item->get_global_transform_with_canvas(); - Vector2 endpoints[4] = { + const Vector2 endpoints[4] = { xform.xform(rect.position), xform.xform(rect.position + Vector2(rect.size.x, 0)), xform.xform(rect.position + rect.size), xform.xform(rect.position + Vector2(0, rect.size.y)) }; - DragType dragger[] = { + const DragType dragger[] = { DRAG_TOP_LEFT, DRAG_TOP, DRAG_TOP_RIGHT, @@ -2318,7 +2318,6 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { Vector<_SelectResult> selection = Vector<_SelectResult>(); // Retrieve the canvas items - selection = Vector<_SelectResult>(); _get_canvas_items_at_pos(click, selection); if (!selection.is_empty()) { canvas_item = selection[0].item; @@ -2572,7 +2571,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) { void CanvasItemEditor::_update_cursor() { // Compute an eventual rotation of the cursor - CursorShape rotation_array[4] = { CURSOR_HSIZE, CURSOR_BDIAGSIZE, CURSOR_VSIZE, CURSOR_FDIAGSIZE }; + const CursorShape rotation_array[4] = { CURSOR_HSIZE, CURSOR_BDIAGSIZE, CURSOR_VSIZE, CURSOR_FDIAGSIZE }; int rotation_array_index = 0; List<CanvasItem *> selection = _get_edited_canvas_items(); @@ -3150,7 +3149,6 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { if (dragged_anchor >= 0) { // Draw the 4 lines when dragged - bool anchor_snapped; Color color_snapped = Color(0.64, 0.93, 0.67, 0.5); Vector2 corners_pos[4]; @@ -3164,7 +3162,7 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { real_t anchor_val = (i >= 2) ? ANCHOR_END - anchors_values[i] : anchors_values[i]; line_starts[i] = corners_pos[i].lerp(corners_pos[(i + 1) % 4], anchor_val); line_ends[i] = corners_pos[(i + 3) % 4].lerp(corners_pos[(i + 2) % 4], anchor_val); - anchor_snapped = anchors_values[i] == 0.0 || anchors_values[i] == 0.5 || anchors_values[i] == 1.0; + bool anchor_snapped = anchors_values[i] == 0.0 || anchors_values[i] == 0.5 || anchors_values[i] == 1.0; viewport->draw_line(line_starts[i], line_ends[i], anchor_snapped ? color_snapped : color_base, (i == dragged_anchor || (i + 3) % 4 == dragged_anchor) ? 2 : 1); } @@ -3328,7 +3326,7 @@ void CanvasItemEditor::_draw_selection() { // Draw the selected items position / surrounding boxes if (canvas_item->_edit_use_rect()) { Rect2 rect = canvas_item->_edit_get_rect(); - Vector2 endpoints[4] = { + const Vector2 endpoints[4] = { xform.xform(rect.position), xform.xform(rect.position + Vector2(rect.size.x, 0)), xform.xform(rect.position + rect.size), @@ -4103,7 +4101,7 @@ void CanvasItemEditor::_button_tool_select(int p_index) { } void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation, bool p_scale, bool p_on_existing) { - Map<Node *, Object *> &selection = editor_selection->get_selection(); + const Map<Node *, Object *> &selection = editor_selection->get_selection(); for (const KeyValue<Node *, Object *> &E : selection) { CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key); @@ -4269,7 +4267,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { snap_config_menu->get_popup()->set_item_checked(idx, snap_pixel); } break; case SNAP_CONFIGURE: { - ((SnapDialog *)snap_dialog)->set_fields(grid_offset, grid_step, primary_grid_steps, snap_rotation_offset, snap_rotation_step, snap_scale_step); + static_cast<SnapDialog *>(snap_dialog)->set_fields(grid_offset, grid_step, primary_grid_steps, snap_rotation_offset, snap_rotation_step, snap_scale_step); snap_dialog->popup_centered(Size2(220, 160) * EDSCALE); } break; case SKELETON_SHOW_BONES: { @@ -4414,7 +4412,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { case ANIM_COPY_POSE: { pose_clipboard.clear(); - Map<Node *, Object *> &selection = editor_selection->get_selection(); + const Map<Node *, Object *> &selection = editor_selection->get_selection(); for (const KeyValue<Node *, Object *> &E : selection) { CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key); @@ -5735,7 +5733,6 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p if (root_node) { target_node = root_node; } else { - drop_pos = p_point; target_node = nullptr; } } diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index daa864cfa1..eb004568d0 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -270,7 +270,7 @@ void EditorInspectorPluginMaterial::_undo_redo_inspector_callback(Object *p_undo Texture2D *texture = Object::cast_to<Texture2D>(p_new_value); if (texture) { if (p_property == "roughness_texture") { - if (base_material->get_texture(StandardMaterial3D::TEXTURE_ROUGHNESS).is_null() && texture) { + if (base_material->get_texture(StandardMaterial3D::TEXTURE_ROUGHNESS).is_null()) { undo_redo->add_do_property(p_edited, "roughness", 1.0); bool valid = false; @@ -280,7 +280,7 @@ void EditorInspectorPluginMaterial::_undo_redo_inspector_callback(Object *p_undo } } } else if (p_property == "metallic_texture") { - if (base_material->get_texture(StandardMaterial3D::TEXTURE_METALLIC).is_null() && texture) { + if (base_material->get_texture(StandardMaterial3D::TEXTURE_METALLIC).is_null()) { undo_redo->add_do_property(p_edited, "metallic", 1.0); bool valid = false; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 090c140456..855fc2b2a9 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -369,7 +369,7 @@ Transform3D Node3DEditorViewport::to_camera_transform(const Cursor &p_cursor) co } int Node3DEditorViewport::get_selected_count() const { - Map<Node *, Object *> &selection = editor_selection->get_selection(); + const Map<Node *, Object *> &selection = editor_selection->get_selection(); int count = 0; @@ -2467,7 +2467,7 @@ void Node3DEditorViewport::_notification(int p_what) { _update_camera(delta); - Map<Node *, Object *> &selection = editor_selection->get_selection(); + const Map<Node *, Object *> &selection = editor_selection->get_selection(); bool changed = false; bool exist = false; diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp index 4aabe0e6b7..543304346e 100644 --- a/editor/plugins/tiles/tiles_editor_plugin.cpp +++ b/editor/plugins/tiles/tiles_editor_plugin.cpp @@ -56,7 +56,7 @@ void TilesEditorPlugin::_pattern_preview_done() { } void TilesEditorPlugin::_thread_func(void *ud) { - TilesEditorPlugin *te = (TilesEditorPlugin *)ud; + TilesEditorPlugin *te = static_cast<TilesEditorPlugin *>(ud); te->_thread(); } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 6b53ce0660..1e7648bc43 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -2061,10 +2061,8 @@ void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p if (!expression_node.is_null() && text_box) { Size2 box_size = size; - if (gn != nullptr) { - if (box_size.x < 150 * EDSCALE || box_size.y < 0) { - box_size.x = gn->get_size().x; - } + if (box_size.x < 150 * EDSCALE || box_size.y < 0) { + box_size.x = gn->get_size().x; } box_size.x -= text_box->get_offset(SIDE_LEFT); box_size.x -= 28 * EDSCALE; diff --git a/editor/pot_generator.cpp b/editor/pot_generator.cpp index f6839bae6b..5afd460831 100644 --- a/editor/pot_generator.cpp +++ b/editor/pot_generator.cpp @@ -46,8 +46,8 @@ void POTGenerator::_print_all_translation_strings() { print_line("msgid: " + E.key()); print_line("context: " + v_md[i].ctx); print_line("msgid_plural: " + v_md[i].plural); - for (Set<String>::Element *E = v_md[i].locations.front(); E; E = E->next()) { - print_line("location: " + E->get()); + for (Set<String>::Element *F = v_md[i].locations.front(); F; F = F->next()) { + print_line("location: " + F->get()); } } } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index cbc4bb03f6..501cb88547 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -202,6 +202,9 @@ private: unz_file_info info; char fname[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); + if (ret != UNZ_OK) { + break; + } if (String::utf8(fname).ends_with("project.godot")) { break; @@ -534,6 +537,9 @@ private: unz_file_info info; char fname[16384]; ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0); + if (ret != UNZ_OK) { + break; + } String path = String::utf8(fname); @@ -552,7 +558,10 @@ private: //read unzOpenCurrentFile(pkg); - unzReadCurrentFile(pkg, data.ptrw(), data.size()); + ret = unzReadCurrentFile(pkg, data.ptrw(), data.size()); + if (ret != UNZ_OK) { + break; + } unzCloseCurrentFile(pkg); FileAccess *f = FileAccess::open(dir.plus_file(rel_path), FileAccess::WRITE); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 8aaf3ddbef..fa83a58cff 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -351,7 +351,7 @@ void ProjectSettingsEditor::_action_edited(const String &p_name, const Dictionar undo_redo->create_action(TTR("Edit Input Action Event")); } else if (event_count > old_event_count) { undo_redo->create_action(TTR("Add Input Action Event")); - } else if (event_count < old_event_count) { + } else { undo_redo->create_action(TTR("Remove Input Action Event")); } diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 32236b01ed..71ea625013 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -2012,7 +2012,7 @@ void SceneTreeDock::_delete_confirm(bool p_cut) { bool entire_scene = false; - for (Node *E : remove_list) { + for (const Node *E : remove_list) { if (E == edited_scene) { entire_scene = true; } |