From e64f5f882c84650c47d502c1b748ae5631e72e42 Mon Sep 17 00:00:00 2001 From: menip Date: Tue, 28 Jul 2020 20:02:31 -0700 Subject: [PATCH] Fix warnings Wparentheses Wsign-compare Wreorder --- editor/graph/voxel_graph_editor.cpp | 4 ++-- generators/graph/voxel_generator_graph.cpp | 10 +++++----- generators/graph/voxel_graph_node_db.h | 4 ++-- meshers/blocky/voxel.cpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/editor/graph/voxel_graph_editor.cpp b/editor/graph/voxel_graph_editor.cpp index ae92001a..6a65053c 100644 --- a/editor/graph/voxel_graph_editor.cpp +++ b/editor/graph/voxel_graph_editor.cpp @@ -227,10 +227,10 @@ void VoxelGraphEditor::create_node_gui(uint32_t node_id) { //node_view.resizable = true //node_view.rect_size = Vector2(200, 100) - const int row_count = max(node_type.inputs.size(), node_type.outputs.size()); + const unsigned int row_count = max(node_type.inputs.size(), node_type.outputs.size()); const Color port_color(0.4, 0.4, 1.0); - for (int i = 0; i < row_count; ++i) { + for (unsigned int i = 0; i < row_count; ++i) { const bool has_left = i < node_type.inputs.size(); const bool has_right = i < node_type.outputs.size(); diff --git a/generators/graph/voxel_generator_graph.cpp b/generators/graph/voxel_generator_graph.cpp index 8ba429ba..7272b470 100644 --- a/generators/graph/voxel_generator_graph.cpp +++ b/generators/graph/voxel_generator_graph.cpp @@ -400,7 +400,7 @@ Dictionary VoxelGeneratorGraph::get_graph_as_variant_data() { static bool var_to_id(Variant v, uint32_t &out_id, uint32_t min = 0) { ERR_FAIL_COND_V(v.get_type() != Variant::INT, false); int i = v; - ERR_FAIL_COND_V(i < min, false); + ERR_FAIL_COND_V(i < 0 || (unsigned int)i < min, false); out_id = i; return true; } @@ -411,7 +411,7 @@ void VoxelGeneratorGraph::load_graph_from_variant_data(Dictionary data) { const VoxelGraphNodeDB &type_db = *VoxelGraphNodeDB::get_singleton(); const Variant *id_key = nullptr; - while (id_key = nodes_data.next(id_key)) { + while ((id_key = nodes_data.next(id_key))) { const String id_str = *id_key; ERR_FAIL_COND(!id_str.is_valid_integer()); const int sid = id_str.to_int(); @@ -428,7 +428,7 @@ void VoxelGeneratorGraph::load_graph_from_variant_data(Dictionary data) { ERR_FAIL_COND(node == nullptr); const Variant *param_key = nullptr; - while (param_key = node_data.next(param_key)) { + while ((param_key = node_data.next(param_key))) { const String param_name = *param_key; if (param_name == "type") { continue; @@ -541,7 +541,7 @@ bool VoxelGeneratorGraph::_set(const StringName &p_name, const Variant &p_value) struct L { inline static bool set_xyz(char c, Vector3i &p, int v) { int i = c - 'x'; - ERR_FAIL_COND_V(i < 0 || i >= Vector3i::AXIS_COUNT, false); + ERR_FAIL_COND_V(i < 0 || (unsigned int)i >= Vector3i::AXIS_COUNT, false); p[i] = v; return true; } @@ -596,7 +596,7 @@ bool VoxelGeneratorGraph::_get(const StringName &p_name, Variant &r_ret) const { struct L { inline static bool get_xyz(char c, const Vector3i &p, Variant &r) { int i = c - 'x'; - ERR_FAIL_COND_V(i < 0 || i >= Vector3i::AXIS_COUNT, false); + ERR_FAIL_COND_V(i < 0 || (unsigned int)i >= Vector3i::AXIS_COUNT, false); r = p[i]; return true; } diff --git a/generators/graph/voxel_graph_node_db.h b/generators/graph/voxel_graph_node_db.h index f9a378f4..d58cef4d 100644 --- a/generators/graph/voxel_graph_node_db.h +++ b/generators/graph/voxel_graph_node_db.h @@ -29,8 +29,8 @@ public: Param(String p_name, Variant::Type p_type, Variant p_default_value = Variant()) : name(p_name), - type(p_type), - default_value(p_default_value) {} + default_value(p_default_value), + type(p_type) {} Param(String p_name, String p_class_name) : name(p_name), diff --git a/meshers/blocky/voxel.cpp b/meshers/blocky/voxel.cpp index b5e7c22b..0972750d 100644 --- a/meshers/blocky/voxel.cpp +++ b/meshers/blocky/voxel.cpp @@ -98,7 +98,7 @@ Ref Voxel::set_voxel_name(String name) { } Ref Voxel::set_id(int id) { - ERR_FAIL_COND_V(id < 0 || id >= VoxelLibrary::MAX_VOXEL_TYPES, Ref(this)); + ERR_FAIL_COND_V(id < 0 || (unsigned int)id >= VoxelLibrary::MAX_VOXEL_TYPES, Ref(this)); // Cannot modify ID after creation ERR_FAIL_COND_V_MSG(_id != -1, Ref(this), "ID cannot be modified after being added to a library"); _id = id;