summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
authorThaer Razeq <RebelliousX@gmail.com>2017-02-23 02:28:09 -0600
committerREBELLIOUSX\Rebel_X <RebelliousX@gmail.com>2017-02-28 07:52:02 -0600
commitf50488a36188d5975bfa8554687a1acdd394d6a9 (patch)
tree3b8712b9162aeb30e8eaaeeca63e6d04c7b9e3b5 /tools/editor
parent0f8c6dd3822c38b8145f08265abb9eba479f4d15 (diff)
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
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/collada/collada.cpp8
-rw-r--r--tools/editor/import/resource_importer_obj.cpp2
-rw-r--r--tools/editor/import/resource_importer_scene.cpp2
-rw-r--r--tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/light_occluder_2d_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/navigation_polygon_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/polygon_2d_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.cpp1
-rw-r--r--tools/editor/property_editor.cpp4
9 files changed, 14 insertions, 11 deletions
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<EditorScenePostImport> 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<Script> scr = ResourceLoader::load(post_import_script_path);
if (!scr.is_valid()) {
EditorNode::add_io_error(TTR("Couldn't load post-import script:")+" "+post_import_script_path);
diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
index 43d3ad5774..1149cdcfe1 100644
--- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
@@ -268,7 +268,7 @@ bool CollisionPolygon2DEditor::forward_gui_input(const InputEvent& p_event) {
return true;
}
}
- } if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
+ } else if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
index e3b02e851f..cc8bb63d78 100644
--- a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -283,7 +283,7 @@ bool LightOccluder2DEditor::forward_gui_input(const InputEvent& p_event) {
return true;
}
}
- } if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
+ } else if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
index 93a35cf8b0..dfc9b2d6e2 100644
--- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -312,7 +312,7 @@ bool NavigationPolygonEditor::forward_gui_input(const InputEvent& p_event) {
return true;
}
}
- } if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
+ } else if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
int closest_outline=-1;
int closest_idx=-1;
diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp
index 3fdf9a4da6..efb3e6c4bc 100644
--- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -385,7 +385,7 @@ bool Polygon2DEditor::forward_gui_input(const InputEvent& p_event) {
return true;
}
}
- } if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
+ } else if (mb.button_index==BUTTON_RIGHT && mb.pressed && edited_point==-1) {
diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp
index bffca6b81e..aabf938577 100644
--- a/tools/editor/plugins/texture_region_editor_plugin.cpp
+++ b/tools/editor/plugins/texture_region_editor_plugin.cpp
@@ -353,6 +353,7 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
undo_redo->add_undo_method(atlas_tex.ptr(),"set_region",rect_prev);
}
else if(node_patch9){
+ // FIXME: Is this intentional?
} else if(node_patch9){
undo_redo->add_do_method(node_patch9 ,"set_region_rect",node_patch9->get_region_rect());
undo_redo->add_undo_method(node_patch9,"set_region_rect",rect_prev);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index a9a5956f2f..ec1de03bd6 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -534,7 +534,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
} else if (hint==PROPERTY_HINT_TYPE_STRING) {
-
+ /* FIXME: This is repeated twice, with slightly different behavior! Which one? Check line 644 */
if (!create_dialog) {
create_dialog = memnew( CreateDialog );
create_dialog->connect("create",this,"_create_dialog_callback");
@@ -651,6 +651,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
} else if (hint==PROPERTY_HINT_TYPE_STRING) {
if (!create_dialog) {
+ /* FIXME: ... and here. See line 529 */
create_dialog = memnew( CreateDialog );
create_dialog->connect("create",this,"_create_dialog_callback");
add_child(create_dialog);
@@ -2384,6 +2385,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
p_item->set_range(1, obj->get( p_name ) );
} else {
+ /* FIXME: Why are both statements equal? */
p_item->set_range(1, obj->get( p_name ) );
}