diff options
author | qarmin <mikrutrafal54@gmail.com> | 2019-06-26 15:08:25 +0200 |
---|---|---|
committer | qarmin <mikrutrafal54@gmail.com> | 2019-06-26 15:08:25 +0200 |
commit | 4e5310cc60dc17e5ef09e57115ca8236544679e4 (patch) | |
tree | 894c5070a709198ed994db7c7d0c0e124abbc9e5 /modules | |
parent | 5c66771e3ebccdfec55bb94ea521d2f24cb6200a (diff) |
Some code changed with Clang-Tidy
Diffstat (limited to 'modules')
-rw-r--r-- | modules/bmp/image_loader_bmp.cpp | 2 | ||||
-rw-r--r-- | modules/csg/csg_shape.h | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_compiler.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 9 | ||||
-rw-r--r-- | modules/gdscript/gdscript_tokenizer.cpp | 4 | ||||
-rw-r--r-- | modules/mono/csharp_script.cpp | 5 | ||||
-rw-r--r-- | modules/mono/csharp_script.h | 2 | ||||
-rw-r--r-- | modules/mono/editor/csharp_project.h | 2 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_editor.h | 2 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_internals.cpp | 2 | ||||
-rw-r--r-- | modules/mono/utils/thread_local.h | 2 | ||||
-rw-r--r-- | modules/opensimplex/noise_texture.h | 4 | ||||
-rw-r--r-- | modules/visual_script/visual_script_expression.cpp | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script_func_nodes.cpp | 7 | ||||
-rw-r--r-- | modules/websocket/websocket_multiplayer_peer.h | 2 |
16 files changed, 20 insertions, 31 deletions
diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index b4530c2df1..a7e8dec11e 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -262,7 +262,7 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f, PoolVector<uint8_t> bmp_color_table; // Color table is usually 4 bytes per color -> [B][G][R][0] - err = bmp_color_table.resize(color_table_size * 4); + bmp_color_table.resize(color_table_size * 4); PoolVector<uint8_t>::Write bmp_color_table_w = bmp_color_table.write(); f->get_buffer(bmp_color_table_w.ptr(), color_table_size * 4); diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index 553a7553c6..6c9419b3c2 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -404,7 +404,7 @@ public: void set_spin_degrees(float p_spin_degrees); float get_spin_degrees() const; - void set_spin_sides(int p_sides); + void set_spin_sides(int p_spin_sides); int get_spin_sides() const; void set_path_node(const NodePath &p_path); diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 3fb9268702..95f3c12806 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -69,7 +69,7 @@ Variant GDScriptNativeClass::_new() { Object *o = instance(); if (!o) { ERR_EXPLAIN("Class type: '" + String(name) + "' is not instantiable."); - ERR_FAIL_COND_V(!o, Variant()); + ERR_FAIL_V(Variant()); } Reference *ref = Object::cast_to<Reference>(o); diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 189317b163..caffe04700 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -1073,7 +1073,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser:: int set_index; bool named = false; - if (static_cast<const GDScriptParser::OperatorNode *>(op)->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) { + if (op->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) { set_index = codegen.get_name_map_pos(static_cast<const GDScriptParser::IdentifierNode *>(op->arguments[1])->name); named = true; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index ec3e72eef7..f2afad74da 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1150,7 +1150,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s if (!expr) { ERR_EXPLAIN("GDScriptParser bug, couldn't figure out what expression is..."); - ERR_FAIL_COND_V(!expr, NULL); + ERR_FAIL_V(NULL); } /******************/ @@ -1493,7 +1493,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s if (next_op == -1) { _set_error("Yet another parser bug...."); - ERR_FAIL_COND_V(next_op == -1, NULL); + ERR_FAIL_V(NULL); } // OK! create operator.. @@ -5944,11 +5944,8 @@ bool GDScriptParser::_is_type_compatible(const DataType &p_container, const Data if (p_container.kind == DataType::BUILTIN && p_container.builtin_type == Variant::OBJECT) { // Object built-in is a special case, it's compatible with any object and with null - if (p_expression.kind == DataType::BUILTIN && p_expression.builtin_type == Variant::NIL) { - return true; - } if (p_expression.kind == DataType::BUILTIN) { - return false; + return p_expression.builtin_type == Variant::NIL; } // If it's not a built-in, must be an object return true; diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index a93d1ceebb..95715ab648 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -1189,7 +1189,7 @@ Error GDScriptTokenizerBuffer::set_code_buffer(const Vector<uint8_t> &p_buffer) int version = decode_uint32(&buf[4]); if (version > BYTECODE_VERSION) { ERR_EXPLAIN("Bytecode is too New! Please use a newer engine version."); - ERR_FAIL_COND_V(version > BYTECODE_VERSION, ERR_INVALID_DATA); + ERR_FAIL_V(ERR_INVALID_DATA); } int identifier_count = decode_uint32(&buf[8]); int constant_count = decode_uint32(&buf[12]); @@ -1303,7 +1303,7 @@ Vector<uint8_t> GDScriptTokenizerBuffer::parse_code_string(const String &p_code) } break; case TK_CONSTANT: { - Variant c = tt.get_token_constant(); + const Variant &c = tt.get_token_constant(); if (!constant_map.has(c)) { int idx = constant_map.size(); constant_map[c] = idx; diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 72199281ff..20b227bda1 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2898,10 +2898,7 @@ void CSharpScript::update_exports() { } bool CSharpScript::has_script_signal(const StringName &p_signal) const { - if (_signals.has(p_signal)) - return true; - - return false; + return _signals.has(p_signal); } void CSharpScript::get_script_signal_list(List<MethodInfo> *r_signals) const { diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 64e3b40063..a2f1ec8f27 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -337,7 +337,7 @@ public: _FORCE_INLINE_ static CSharpLanguage *get_singleton() { return singleton; } static void release_script_gchandle(Ref<MonoGCHandle> &p_gchandle); - static void release_script_gchandle(MonoObject *p_pinned_expected_obj, Ref<MonoGCHandle> &p_gchandle); + static void release_script_gchandle(MonoObject *p_expected_obj, Ref<MonoGCHandle> &p_gchandle); bool debug_break(const String &p_error, bool p_allow_continue = true); bool debug_break_parse(const String &p_file, int p_line, const String &p_error); diff --git a/modules/mono/editor/csharp_project.h b/modules/mono/editor/csharp_project.h index 3d5a65f8da..b08c9090c7 100644 --- a/modules/mono/editor/csharp_project.h +++ b/modules/mono/editor/csharp_project.h @@ -36,7 +36,7 @@ namespace CSharpProject { String generate_core_api_project(const String &p_dir, const Vector<String> &p_files = Vector<String>()); -String generate_editor_api_project(const String &p_dir, const String &p_core_dll_path, const Vector<String> &p_files = Vector<String>()); +String generate_editor_api_project(const String &p_dir, const String &p_core_proj_path, const Vector<String> &p_files = Vector<String>()); String generate_game_project(const String &p_dir, const String &p_name, const Vector<String> &p_files = Vector<String>()); void add_item(const String &p_project_path, const String &p_item_type, const String &p_include); diff --git a/modules/mono/editor/godotsharp_editor.h b/modules/mono/editor/godotsharp_editor.h index 4a28492bad..d5bd8ba126 100644 --- a/modules/mono/editor/godotsharp_editor.h +++ b/modules/mono/editor/godotsharp_editor.h @@ -35,7 +35,7 @@ #include "monodevelop_instance.h" class GodotSharpEditor : public Node { - GDCLASS(GodotSharpEditor, Object); + GDCLASS(GodotSharpEditor, Node); EditorNode *editor; diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp index 63bcfe053c..cb28efb4e5 100644 --- a/modules/mono/mono_gd/gd_mono_internals.cpp +++ b/modules/mono/mono_gd/gd_mono_internals.cpp @@ -105,8 +105,6 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) { ScriptInstance *si = CSharpInstance::create_for_managed_type(unmanaged, script.ptr(), gchandle); unmanaged->set_script_and_instance(script.get_ref_ptr(), si); - - return; } void unhandled_exception(MonoException *p_exc) { diff --git a/modules/mono/utils/thread_local.h b/modules/mono/utils/thread_local.h index 488cc2619a..e52b6e73ef 100644 --- a/modules/mono/utils/thread_local.h +++ b/modules/mono/utils/thread_local.h @@ -76,7 +76,7 @@ struct ThreadLocalStorage { void *get_value() const; void set_value(void *p_value) const; - void alloc(void(_CALLBACK_FUNC_ *p_dest_callback)(void *)); + void alloc(void(_CALLBACK_FUNC_ *p_destr_callback)(void *)); void free(); private: diff --git a/modules/opensimplex/noise_texture.h b/modules/opensimplex/noise_texture.h index 445bf974b8..5e4a02fcee 100644 --- a/modules/opensimplex/noise_texture.h +++ b/modules/opensimplex/noise_texture.h @@ -77,12 +77,12 @@ public: Ref<OpenSimplexNoise> get_noise(); void set_width(int p_width); - void set_height(int p_hieght); + void set_height(int p_height); void set_seamless(bool p_seamless); bool get_seamless(); - void set_as_normalmap(bool p_seamless); + void set_as_normalmap(bool p_as_normalmap); bool is_normalmap(); void set_bump_strength(float p_bump_strength); diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp index 772092fabe..4b74c088e0 100644 --- a/modules/visual_script/visual_script_expression.cpp +++ b/modules/visual_script/visual_script_expression.cpp @@ -1130,7 +1130,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() { if (next_op == -1) { _set_error("Yet another parser bug...."); - ERR_FAIL_COND_V(next_op == -1, NULL); + ERR_FAIL_V(NULL); } // OK! create operator.. diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 8fa7d2c0d4..f8cb6cfa3c 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -51,10 +51,7 @@ int VisualScriptFunctionCall::get_output_sequence_port_count() const { bool VisualScriptFunctionCall::has_input_sequence_port() const { - if ((method_cache.flags & METHOD_FLAG_CONST && call_mode != CALL_MODE_INSTANCE) || (call_mode == CALL_MODE_BASIC_TYPE && Variant::is_method_const(basic_type, function))) - return false; - else - return true; + return !((method_cache.flags & METHOD_FLAG_CONST && call_mode != CALL_MODE_INSTANCE) || (call_mode == CALL_MODE_BASIC_TYPE && Variant::is_method_const(basic_type, function))); } #ifdef TOOLS_ENABLED @@ -949,7 +946,7 @@ int VisualScriptPropertySet::get_output_sequence_port_count() const { bool VisualScriptPropertySet::has_input_sequence_port() const { - return call_mode != CALL_MODE_BASIC_TYPE ? true : false; + return call_mode != CALL_MODE_BASIC_TYPE; } Node *VisualScriptPropertySet::_get_base_node() const { diff --git a/modules/websocket/websocket_multiplayer_peer.h b/modules/websocket/websocket_multiplayer_peer.h index 089bc25fe9..7fd97a6595 100644 --- a/modules/websocket/websocket_multiplayer_peer.h +++ b/modules/websocket/websocket_multiplayer_peer.h @@ -82,7 +82,7 @@ public: /* NetworkedMultiplayerPeer */ void set_transfer_mode(TransferMode p_mode); TransferMode get_transfer_mode() const; - void set_target_peer(int p_peer_id); + void set_target_peer(int p_target_peer); int get_packet_peer() const; int get_unique_id() const; virtual bool is_server() const = 0; |