From aab8da25ad2c3e6d2df03abbc8e35c1725938c40 Mon Sep 17 00:00:00 2001 From: qarmin Date: Tue, 23 Jul 2019 09:14:31 +0200 Subject: Fix some code found by Coverity Scan and PVS Studio --- servers/visual_server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'servers/visual_server.cpp') diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index c6468694fd..25e18d0623 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1118,7 +1118,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim } offsets[i] = elem_size; continue; - } break; + } default: { ERR_FAIL(); } @@ -1286,7 +1286,7 @@ Array VisualServer::_get_array_from_surface(uint32_t p_format, PoolVector Date: Thu, 8 Aug 2019 17:08:27 -0300 Subject: Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "main" and "servers" directories --- servers/visual_server.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'servers/visual_server.cpp') diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 25e18d0623..13fcda2402 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1145,11 +1145,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim Vector bone_aabb; Error err = _surface_set_data(p_arrays, format, offsets, total_elem_size, vertex_array, array_len, index_array, index_array_len, aabb, bone_aabb); - - if (err) { - ERR_EXPLAIN("Invalid array format for surface"); - ERR_FAIL(); - } + ERR_FAIL_COND_MSG(err, "Invalid array format for surface."); Vector > blend_shape_data; @@ -1162,10 +1158,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim AABB laabb; Error err2 = _surface_set_data(p_blend_shapes[i], format & ~ARRAY_FORMAT_INDEX, offsets, total_elem_size, vertex_array_shape, array_len, noindex, 0, laabb, bone_aabb); aabb.merge_with(laabb); - if (err2 != OK) { - ERR_EXPLAIN("Invalid blend shape array format for surface"); - ERR_FAIL(); - } + ERR_FAIL_COND_MSG(err2 != OK, "Invalid blend shape array format for surface."); blend_shape_data.push_back(vertex_array_shape); } -- cgit v1.2.3