diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-04-05 13:40:26 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-04-06 14:34:37 +0300 |
commit | f851c4aa330e1064a66db50be62db2466f4fb768 (patch) | |
tree | 70f3bd487e91feb4ca777dba214a09b17041da97 /core/object | |
parent | 72407a9cfbd4f58102972c0910429f3ab7006f07 (diff) |
Fix some issues found by cppcheck.
Diffstat (limited to 'core/object')
-rw-r--r-- | core/object/ref_counted.h | 2 | ||||
-rw-r--r-- | core/object/script_language.cpp | 2 | ||||
-rw-r--r-- | core/object/script_language.h | 32 |
3 files changed, 18 insertions, 18 deletions
diff --git a/core/object/ref_counted.h b/core/object/ref_counted.h index 8eb1c97cce..dcacf19890 100644 --- a/core/object/ref_counted.h +++ b/core/object/ref_counted.h @@ -261,7 +261,7 @@ struct PtrToArg<Ref<T>> { typedef Ref<T> EncodeT; _FORCE_INLINE_ static void encode(Ref<T> p_val, const void *p_ptr) { - *(Ref<RefCounted> *)p_ptr = p_val; + *(const_cast<Ref<RefCounted> *>(reinterpret_cast<const Ref<RefCounted> *>(p_ptr))) = p_val; } }; diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 11440c37fe..a5d25bf533 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -144,7 +144,7 @@ void ScriptServer::register_language(ScriptLanguage *p_language) { _languages[_language_count++] = p_language; } -void ScriptServer::unregister_language(ScriptLanguage *p_language) { +void ScriptServer::unregister_language(const ScriptLanguage *p_language) { for (int i = 0; i < _language_count; i++) { if (_languages[i] == p_language) { _language_count--; diff --git a/core/object/script_language.h b/core/object/script_language.h index 08b82d798e..69002c81f4 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -68,7 +68,7 @@ public: _FORCE_INLINE_ static int get_language_count() { return _language_count; } static ScriptLanguage *get_language(int p_idx); static void register_language(ScriptLanguage *p_language); - static void unregister_language(ScriptLanguage *p_language); + static void unregister_language(const ScriptLanguage *p_language); static void set_reload_scripts_on_save(bool p_enable); static bool is_reload_scripts_on_save_enabled(); @@ -438,34 +438,34 @@ class PlaceHolderScriptInstance : public ScriptInstance { Ref<Script> script; public: - virtual bool set(const StringName &p_name, const Variant &p_value); - virtual bool get(const StringName &p_name, Variant &r_ret) const; - virtual void get_property_list(List<PropertyInfo> *p_properties) const; - virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const; + virtual bool set(const StringName &p_name, const Variant &p_value) override; + virtual bool get(const StringName &p_name, Variant &r_ret) const override; + virtual void get_property_list(List<PropertyInfo> *p_properties) const override; + virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const override; - virtual void get_method_list(List<MethodInfo> *p_list) const; - virtual bool has_method(const StringName &p_method) const; + virtual void get_method_list(List<MethodInfo> *p_list) const override; + virtual bool has_method(const StringName &p_method) const override; - virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { + virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override { r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } - virtual void notification(int p_notification) {} + virtual void notification(int p_notification) override {} - virtual Ref<Script> get_script() const { return script; } + virtual Ref<Script> get_script() const override { return script; } - virtual ScriptLanguage *get_language() { return language; } + virtual ScriptLanguage *get_language() override { return language; } - Object *get_owner() { return owner; } + Object *get_owner() override { return owner; } void update(const List<PropertyInfo> &p_properties, const Map<StringName, Variant> &p_values); //likely changed in editor - virtual bool is_placeholder() const { return true; } + virtual bool is_placeholder() const override { return true; } - virtual void property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr); - virtual Variant property_get_fallback(const StringName &p_name, bool *r_valid = nullptr); + virtual void property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr) override; + virtual Variant property_get_fallback(const StringName &p_name, bool *r_valid = nullptr) override; - virtual const Vector<Multiplayer::RPCConfig> get_rpc_methods() const { return Vector<Multiplayer::RPCConfig>(); } + virtual const Vector<Multiplayer::RPCConfig> get_rpc_methods() const override { return Vector<Multiplayer::RPCConfig>(); } PlaceHolderScriptInstance(ScriptLanguage *p_language, Ref<Script> p_script, Object *p_owner); ~PlaceHolderScriptInstance(); |