From f50488a36188d5975bfa8554687a1acdd394d6a9 Mon Sep 17 00:00:00 2001 From: Thaer Razeq Date: Thu, 23 Feb 2017 02:28:09 -0600 Subject: Various fixes detected using PVS-Studio static analyzer. - Add FIXME tags comments to some unfixed potential bugs - Remove some checks (always false: unsigned never < 0) - Fix some if statements based on reviews. - Bunch of missing `else` statements --- tools/editor/collada/collada.cpp | 8 ++++---- tools/editor/import/resource_importer_obj.cpp | 2 +- tools/editor/import/resource_importer_scene.cpp | 2 +- tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp | 2 +- tools/editor/plugins/light_occluder_2d_editor_plugin.cpp | 2 +- tools/editor/plugins/navigation_polygon_editor_plugin.cpp | 2 +- tools/editor/plugins/polygon_2d_editor_plugin.cpp | 2 +- tools/editor/plugins/texture_region_editor_plugin.cpp | 1 + tools/editor/property_editor.cpp | 4 +++- 9 files changed, 14 insertions(+), 11 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/collada/collada.cpp b/tools/editor/collada/collada.cpp index a23fd84aa0..2ba4f648a3 100644 --- a/tools/editor/collada/collada.cpp +++ b/tools/editor/collada/collada.cpp @@ -352,7 +352,7 @@ void Collada::_parse_image(XMLParser& parser) { image.path=path; - } if (name=="data") { + } else if (name=="data") { ERR_PRINT("COLLADA Embedded image data not supported!"); @@ -728,7 +728,7 @@ void Collada::_parse_effect_material(XMLParser& parser,Effect &effect,String &id #endif } - } if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END && ( + } else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END && ( parser.get_node_name()=="constant" || parser.get_node_name()=="lambert" || parser.get_node_name()=="phong" || @@ -1100,7 +1100,7 @@ void Collada::_parse_mesh_geometry(XMLParser& parser,String p_id,String p_name) current_source=id; COLLADA_PRINT("source data: "+id); - } else if (section=="float_array" || section=="array" || section=="float_array") { + } else if (section=="float_array" || section=="array") { // create a new array and read it. if (meshdata.sources.has(current_source)) { @@ -2192,7 +2192,7 @@ void Collada::_parse_scene(XMLParser& parser) { state.root_visual_scene=_uri_to_id(parser.get_attribute_value("url")); print_line("***ROOT VISUAL SCENE: "+state.root_visual_scene); - } if (name=="instance_physics_scene") { + } else if (name=="instance_physics_scene") { state.root_physics_scene=_uri_to_id(parser.get_attribute_value("url")); diff --git a/tools/editor/import/resource_importer_obj.cpp b/tools/editor/import/resource_importer_obj.cpp index e6e23366f6..aacb5fbb2d 100644 --- a/tools/editor/import/resource_importer_obj.cpp +++ b/tools/editor/import/resource_importer_obj.cpp @@ -118,7 +118,7 @@ Error ResourceImporterOBJ::import(const String& p_source_file, const String& p_s nrm.y=v[2].to_float(); nrm.z=v[3].to_float(); normals.push_back(nrm); - } if (l.begins_with("f ")) { + } else if (l.begins_with("f ")) { //vertex has_index_data=true; diff --git a/tools/editor/import/resource_importer_scene.cpp b/tools/editor/import/resource_importer_scene.cpp index ae840e9e16..406058c59e 100644 --- a/tools/editor/import/resource_importer_scene.cpp +++ b/tools/editor/import/resource_importer_scene.cpp @@ -1279,7 +1279,7 @@ Error ResourceImporterScene::import(const String& p_source_file, const String& p Ref post_import_script; if (post_import_script_path!="") { - post_import_script_path = post_import_script_path; + post_import_script_path = post_import_script_path; // FIXME: is there a good reason for this? Ref