From 0a2fa4d892ace40f65453cfe86710c4281230529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 31 Mar 2020 13:50:25 +0200 Subject: Fix more -Wmaybe-uninitialized warnings with target=release_debug I have no idea why those don't get triggered in target=debug builds. Fixes #37461. --- editor/import/resource_importer_texture.cpp | 2 +- editor/plugins/mesh_instance_3d_editor_plugin.cpp | 7 ++----- editor/plugins/polygon_2d_editor_plugin.cpp | 3 +-- modules/basis_universal/register_types.cpp | 2 +- servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp | 3 ++- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index c218697423..c92251ca60 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -424,7 +424,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String String normal_map = p_options["roughness/src_normal"]; Ref normal_image; - Image::RoughnessChannel roughness_channel; + Image::RoughnessChannel roughness_channel = Image::ROUGHNESS_CHANNEL_R; if (mipmaps && roughness > 1 && FileAccess::exists(normal_map)) { normal_image.instance(); diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index f7a90b8ab3..ccefdcd28f 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -337,18 +337,15 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) { const Vector2 *r = uv.ptr(); Vector indices = a[Mesh::ARRAY_INDEX]; - const int *ri; + const int *ri = NULL; int ic; - bool use_indices; if (indices.size()) { ic = indices.size(); ri = indices.ptr(); - use_indices = true; } else { ic = uv.size(); - use_indices = false; } for (int j = 0; j < ic; j += 3) { @@ -356,7 +353,7 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) { for (int k = 0; k < 3; k++) { MeshInstance3DEditorEdgeSort edge; - if (use_indices) { + if (ri) { edge.a = r[ri[j + k]]; edge.b = r[ri[j + ((k + 1) % 3)]]; } else { diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index f570baa885..a5bd5aed6b 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -1031,7 +1031,7 @@ void Polygon2DEditor::_uv_draw() { uvs = node->get_polygon(); } - const float *weight_r; + const float *weight_r = NULL; if (uv_edit_mode[3]->is_pressed()) { int bone_selected = -1; @@ -1044,7 +1044,6 @@ void Polygon2DEditor::_uv_draw() { } if (bone_selected != -1 && node->get_bone_weights(bone_selected).size() == uvs.size()) { - weight_r = node->get_bone_weights(bone_selected).ptr(); } } diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index 6b74b8bf4a..5784341d80 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -98,7 +98,7 @@ static Vector basis_universal_packer(const Ref &p_image, Image:: params.m_mip_gen = false; //sorry, please some day support provided mipmaps. params.m_source_images.push_back(buimg); - BasisDecompressFormat decompress_format; + BasisDecompressFormat decompress_format = BASIS_DECOMPRESS_RG; params.m_check_for_alpha = false; switch (p_channels) { diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp index 83af15602c..b6b6b5a040 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "rasterizer_storage_rd.h" + #include "core/engine.h" #include "core/project_settings.h" #include "servers/rendering/shader_language.h" @@ -1664,7 +1665,7 @@ void RasterizerStorageRD::MaterialData::update_textures(const Map