From f725bd99f4cedc9ce9cfc602b1aae8ee7b5a6a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 27 Mar 2020 12:36:59 +0100 Subject: Fix some -Wmaybe-uninitialized warnings Namely: ``` modules/basis_universal/register_types.cpp: In function 'Ref basis_universal_unpacker(const Vector&)': modules/basis_universal/register_types.cpp:266:15: warning: 'imgfmt' may be used uninitialized in this function [-Wmaybe-uninitialized] 266 | image->create(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ modules/basis_universal/register_types.cpp:255:39: warning: 'format' may be used uninitialized in this function [-Wmaybe-uninitialized] 255 | bool ret = tr.transcode_image_level(ptr, size, 0, i, dst + ofs, level.m_total_blocks - i, format); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` ``` servers/visual_server.cpp: In member function 'Error VisualServer::_surface_set_data(Array, uint32_t, uint32_t*, uint32_t, Vector&, int, Vector&, int, AABB&, Vector&)': servers/visual_server.cpp:636:15: warning: 'iw' may be used uninitialized in this function [-Wmaybe-uninitialized] 636 | copymem(&iw[i * 2], &v, 2); | ^ ``` ``` core/image.cpp: In member function 'Error Image::generate_mipmap_roughness(Image::RoughnessChannel, const Ref&)': core/image.cpp:1683:11: warning: 'roughness' may be used uninitialized in this function [-Wmaybe-uninitialized] 1683 | float roughness; | ^~~~~~~~~ ``` --- core/image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/image.cpp') diff --git a/core/image.cpp b/core/image.cpp index 2c39c9b882..d691c4f442 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1680,7 +1680,7 @@ Error Image::generate_mipmap_roughness(RoughnessChannel p_roughness_channel, con int pixel_ofs = y * w + x; Color c = _get_color_at_ofs(ptr, pixel_ofs); - float roughness; + float roughness = 0; switch (p_roughness_channel) { case ROUGHNESS_CHANNEL_R: { -- cgit v1.2.3