summaryrefslogtreecommitdiffstats
path: root/include/godot_cpp
diff options
context:
space:
mode:
authorEmmanuel Leblond <emmanuel.leblond@gmail.com>2022-12-03 11:13:23 +0100
committerGitHub <noreply@github.com>2022-12-03 11:13:23 +0100
commit32859ea25c31ae596535d6bf0178a6e01f45a001 (patch)
treede338d0fd68e5fbe4067b8faeeb338f40e66ff4e /include/godot_cpp
parentf1d501f97749fd70f590a3e82b81e55d6cf1d2d7 (diff)
parentfe86a94dcf996e6262d788028e7efd1f50267e20 (diff)
downloadredot-cpp-32859ea25c31ae596535d6bf0178a6e01f45a001.tar.gz
Merge pull request #897 from touilleMan/gdextension-fix-gdnative-types-const-qualifier
Fix const qualifier for parameters in GDExtension api functions
Diffstat (limited to 'include/godot_cpp')
-rw-r--r--include/godot_cpp/classes/ref.hpp8
-rw-r--r--include/godot_cpp/classes/wrapped.hpp16
-rw-r--r--include/godot_cpp/core/binder_common.hpp112
-rw-r--r--include/godot_cpp/core/builtin_ptrcall.hpp10
-rw-r--r--include/godot_cpp/core/class_db.hpp14
-rw-r--r--include/godot_cpp/core/engine_ptrcall.hpp12
-rw-r--r--include/godot_cpp/core/method_bind.hpp38
-rw-r--r--include/godot_cpp/core/method_ptrcall.hpp62
-rw-r--r--include/godot_cpp/core/type_info.hpp2
-rw-r--r--include/godot_cpp/godot.hpp6
-rw-r--r--include/godot_cpp/variant/variant.hpp6
11 files changed, 143 insertions, 143 deletions
diff --git a/include/godot_cpp/classes/ref.hpp b/include/godot_cpp/classes/ref.hpp
index 21171d7..cc7f2d6 100644
--- a/include/godot_cpp/classes/ref.hpp
+++ b/include/godot_cpp/classes/ref.hpp
@@ -240,13 +240,13 @@ public:
template <class T>
struct PtrToArg<Ref<T>> {
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
- return Ref<T>(reinterpret_cast<T *>(godot::internal::gdn_interface->object_get_instance_binding(*(const GDNativeObjectPtr *)p_ptr, godot::internal::token, &T::___binding_callbacks)));
+ return Ref<T>(reinterpret_cast<T *>(godot::internal::gdn_interface->object_get_instance_binding(*reinterpret_cast<GDNativeObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks)));
}
typedef Ref<T> EncodeT;
- _FORCE_INLINE_ static void encode(Ref<T> p_val, const void *p_ptr) {
- *(void **)p_ptr = p_val->_owner;
+ _FORCE_INLINE_ static void encode(Ref<T> p_val, void *p_ptr) {
+ *reinterpret_cast<const GodotObject **>(p_ptr) = p_val->_owner;
}
};
@@ -255,7 +255,7 @@ struct PtrToArg<const Ref<T> &> {
typedef Ref<T> EncodeT;
_FORCE_INLINE_ static Ref<T> convert(const void *p_ptr) {
- return Ref<T>(reinterpret_cast<T *>(godot::internal::gdn_interface->object_get_instance_binding(*(const GDNativeObjectPtr *)p_ptr, godot::internal::token, &T::___binding_callbacks)));
+ return Ref<T>(reinterpret_cast<T *>(godot::internal::gdn_interface->object_get_instance_binding(*reinterpret_cast<GDNativeObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks)));
}
};
diff --git a/include/godot_cpp/classes/wrapped.hpp b/include/godot_cpp/classes/wrapped.hpp
index dfc2748..1d15f6d 100644
--- a/include/godot_cpp/classes/wrapped.hpp
+++ b/include/godot_cpp/classes/wrapped.hpp
@@ -61,12 +61,12 @@ protected:
String _to_string() const { return "[" + String(get_class_static()) + ":" + itos(get_instance_id()) + "]"; }
static void notification_bind(GDExtensionClassInstancePtr p_instance, int32_t p_what) {}
- static GDNativeBool set_bind(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, const GDNativeVariantPtr p_value) { return false; }
- static GDNativeBool get_bind(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, GDNativeVariantPtr r_ret) { return false; }
+ static GDNativeBool set_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value) { return false; }
+ static GDNativeBool get_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret) { return false; }
static const GDNativePropertyInfo *get_property_list_bind(GDExtensionClassInstancePtr p_instance, uint32_t *r_count) { return nullptr; }
static void free_property_list_bind(GDExtensionClassInstancePtr p_instance, const GDNativePropertyInfo *p_list) {}
- static GDNativeBool property_can_revert_bind(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name) { return false; }
- static GDNativeBool property_get_revert_bind(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, GDNativeVariantPtr r_ret) { return false; }
+ static GDNativeBool property_can_revert_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name) { return false; }
+ static GDNativeBool property_get_revert_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret) { return false; }
static void to_string_bind(GDExtensionClassInstancePtr p_instance, GDNativeBool *r_is_valid, GDNativeStringPtr r_out) {}
::godot::List<::godot::PropertyInfo> plist_owned;
@@ -184,7 +184,7 @@ public:
} \
} \
\
- static GDNativeBool set_bind(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, const GDNativeVariantPtr p_value) { \
+ static GDNativeBool set_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeConstVariantPtr p_value) { \
if (p_instance && m_class::_get_set()) { \
if (m_class::_get_set() != m_inherits::_get_set()) { \
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
@@ -195,7 +195,7 @@ public:
return false; \
} \
\
- static GDNativeBool get_bind(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, GDNativeVariantPtr r_ret) { \
+ static GDNativeBool get_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret) { \
if (p_instance && m_class::_get_get()) { \
if (m_class::_get_get() != m_inherits::_get_get()) { \
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
@@ -243,7 +243,7 @@ public:
} \
} \
\
- static GDNativeBool property_can_revert_bind(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name) { \
+ static GDNativeBool property_can_revert_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name) { \
if (p_instance && m_class::_get_property_can_revert()) { \
if (m_class::_get_property_can_revert() != m_inherits::_get_property_can_revert()) { \
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
@@ -254,7 +254,7 @@ public:
return false; \
} \
\
- static GDNativeBool property_get_revert_bind(GDExtensionClassInstancePtr p_instance, const GDNativeStringNamePtr p_name, GDNativeVariantPtr r_ret) { \
+ static GDNativeBool property_get_revert_bind(GDExtensionClassInstancePtr p_instance, GDNativeConstStringNamePtr p_name, GDNativeVariantPtr r_ret) { \
if (p_instance && m_class::_get_property_get_revert()) { \
if (m_class::_get_property_get_revert() != m_inherits::_get_property_get_revert()) { \
m_class *cls = reinterpret_cast<m_class *>(p_instance); \
diff --git a/include/godot_cpp/core/binder_common.hpp b/include/godot_cpp/core/binder_common.hpp
index 8bee243..93b21ca 100644
--- a/include/godot_cpp/core/binder_common.hpp
+++ b/include/godot_cpp/core/binder_common.hpp
@@ -41,46 +41,46 @@
namespace godot {
-#define VARIANT_ENUM_CAST(m_class, m_enum) \
- namespace godot { \
- MAKE_ENUM_TYPE_INFO(m_class, m_enum) \
- template <> \
- struct VariantCaster<m_class::m_enum> { \
- static _FORCE_INLINE_ m_class::m_enum cast(const Variant &p_variant) { \
- return (m_class::m_enum)p_variant.operator int64_t(); \
- } \
- }; \
- template <> \
- struct PtrToArg<m_class::m_enum> { \
- _FORCE_INLINE_ static m_class::m_enum convert(const void *p_ptr) { \
- return m_class::m_enum(*reinterpret_cast<const int64_t *>(p_ptr)); \
- } \
- typedef int64_t EncodeT; \
- _FORCE_INLINE_ static void encode(m_class::m_enum p_val, const void *p_ptr) { \
- *(int64_t *)p_ptr = p_val; \
- } \
- }; \
+#define VARIANT_ENUM_CAST(m_class, m_enum) \
+ namespace godot { \
+ MAKE_ENUM_TYPE_INFO(m_class, m_enum) \
+ template <> \
+ struct VariantCaster<m_class::m_enum> { \
+ static _FORCE_INLINE_ m_class::m_enum cast(const Variant &p_variant) { \
+ return (m_class::m_enum)p_variant.operator int64_t(); \
+ } \
+ }; \
+ template <> \
+ struct PtrToArg<m_class::m_enum> { \
+ _FORCE_INLINE_ static m_class::m_enum convert(const void *p_ptr) { \
+ return m_class::m_enum(*reinterpret_cast<const int64_t *>(p_ptr)); \
+ } \
+ typedef int64_t EncodeT; \
+ _FORCE_INLINE_ static void encode(m_class::m_enum p_val, void *p_ptr) { \
+ *reinterpret_cast<int64_t *>(p_ptr) = p_val; \
+ } \
+ }; \
}
-#define VARIANT_BITFIELD_CAST(m_class, m_enum) \
- namespace godot { \
- MAKE_BITFIELD_TYPE_INFO(m_class, m_enum) \
- template <> \
- struct VariantCaster<BitField<m_class::m_enum>> { \
- static _FORCE_INLINE_ BitField<m_class::m_enum> cast(const Variant &p_variant) { \
- return BitField<m_class::m_enum>(p_variant.operator int64_t()); \
- } \
- }; \
- template <> \
- struct PtrToArg<BitField<m_class::m_enum>> { \
- _FORCE_INLINE_ static BitField<m_class::m_enum> convert(const void *p_ptr) { \
- return BitField<m_class::m_enum>(*reinterpret_cast<const int64_t *>(p_ptr)); \
- } \
- typedef int64_t EncodeT; \
- _FORCE_INLINE_ static void encode(BitField<m_class::m_enum> p_val, const void *p_ptr) { \
- *(int64_t *)p_ptr = p_val; \
- } \
- }; \
+#define VARIANT_BITFIELD_CAST(m_class, m_enum) \
+ namespace godot { \
+ MAKE_BITFIELD_TYPE_INFO(m_class, m_enum) \
+ template <> \
+ struct VariantCaster<BitField<m_class::m_enum>> { \
+ static _FORCE_INLINE_ BitField<m_class::m_enum> cast(const Variant &p_variant) { \
+ return BitField<m_class::m_enum>(p_variant.operator int64_t()); \
+ } \
+ }; \
+ template <> \
+ struct PtrToArg<BitField<m_class::m_enum>> { \
+ _FORCE_INLINE_ static BitField<m_class::m_enum> convert(const void *p_ptr) { \
+ return BitField<m_class::m_enum>(*reinterpret_cast<const int64_t *>(p_ptr)); \
+ } \
+ typedef int64_t EncodeT; \
+ _FORCE_INLINE_ static void encode(BitField<m_class::m_enum> p_val, void *p_ptr) { \
+ *reinterpret_cast<int64_t *>(p_ptr) = p_val; \
+ } \
+ }; \
}
template <class T>
@@ -169,42 +169,42 @@ struct VariantCasterAndValidate<const T &> {
};
template <class T, class... P, size_t... Is>
-void call_with_ptr_args_helper(T *p_instance, void (T::*p_method)(P...), const GDNativeTypePtr *p_args, IndexSequence<Is...>) {
+void call_with_ptr_args_helper(T *p_instance, void (T::*p_method)(P...), GDNativeConstTypePtr *p_args, IndexSequence<Is...>) {
(p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...);
}
template <class T, class... P, size_t... Is>
-void call_with_ptr_argsc_helper(T *p_instance, void (T::*p_method)(P...) const, const GDNativeTypePtr *p_args, IndexSequence<Is...>) {
+void call_with_ptr_argsc_helper(T *p_instance, void (T::*p_method)(P...) const, GDNativeConstTypePtr *p_args, IndexSequence<Is...>) {
(p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...);
}
template <class T, class R, class... P, size_t... Is>
-void call_with_ptr_args_ret_helper(T *p_instance, R (T::*p_method)(P...), const GDNativeTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
+void call_with_ptr_args_ret_helper(T *p_instance, R (T::*p_method)(P...), GDNativeConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
PtrToArg<R>::encode((p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...), r_ret);
}
template <class T, class R, class... P, size_t... Is>
-void call_with_ptr_args_retc_helper(T *p_instance, R (T::*p_method)(P...) const, const GDNativeTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
+void call_with_ptr_args_retc_helper(T *p_instance, R (T::*p_method)(P...) const, GDNativeConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
PtrToArg<R>::encode((p_instance->*p_method)(PtrToArg<P>::convert(p_args[Is])...), r_ret);
}
template <class T, class... P>
-void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...), const GDNativeTypePtr *p_args, void * /*ret*/) {
+void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...), GDNativeConstTypePtr *p_args, void * /*ret*/) {
call_with_ptr_args_helper<T, P...>(p_instance, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
}
template <class T, class... P>
-void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...) const, const GDNativeTypePtr *p_args, void * /*ret*/) {
+void call_with_ptr_args(T *p_instance, void (T::*p_method)(P...) const, GDNativeConstTypePtr *p_args, void * /*ret*/) {
call_with_ptr_argsc_helper<T, P...>(p_instance, p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
}
template <class T, class R, class... P>
-void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...), const GDNativeTypePtr *p_args, void *r_ret) {
+void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...), GDNativeConstTypePtr *p_args, void *r_ret) {
call_with_ptr_args_ret_helper<T, R, P...>(p_instance, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
template <class T, class R, class... P>
-void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...) const, const GDNativeTypePtr *p_args, void *r_ret) {
+void call_with_ptr_args(T *p_instance, R (T::*p_method)(P...) const, GDNativeConstTypePtr *p_args, void *r_ret) {
call_with_ptr_args_retc_helper<T, R, P...>(p_instance, p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
@@ -256,7 +256,7 @@ void call_with_variant_args_retc_helper(T *p_instance, R (T::*p_method)(P...) co
}
template <class T, class... P>
-void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const GDNativeVariantPtr *p_args, int p_argcount, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
+void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), GDNativeConstVariantPtr *p_args, int p_argcount, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -291,7 +291,7 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const G
}
template <class T, class... P>
-void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const, const GDNativeVariantPtr *p_args, int p_argcount, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
+void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const, GDNativeConstVariantPtr *p_args, int p_argcount, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -326,7 +326,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
}
template <class T, class R, class... P>
-void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const GDNativeVariantPtr *p_args, int p_argcount, Variant &r_ret, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
+void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), GDNativeConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -361,7 +361,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const
}
template <class T, class R, class... P>
-void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const, const GDNativeVariantPtr *p_args, int p_argcount, Variant &r_ret, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
+void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const, GDNativeConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -473,7 +473,7 @@ void call_with_variant_args_static(void (*p_method)(P...), const Variant **p_arg
}
template <class... P>
-void call_with_variant_args_static_dv(void (*p_method)(P...), const GDNativeVariantPtr *p_args, int p_argcount, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
+void call_with_variant_args_static_dv(void (*p_method)(P...), GDNativeConstVariantPtr *p_args, int p_argcount, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -508,12 +508,12 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), const GDNativeVari
}
template <class... P, size_t... Is>
-void call_with_ptr_args_static_method_helper(void (*p_method)(P...), const GDNativeTypePtr *p_args, IndexSequence<Is...>) {
+void call_with_ptr_args_static_method_helper(void (*p_method)(P...), GDNativeConstTypePtr *p_args, IndexSequence<Is...>) {
p_method(PtrToArg<P>::convert(p_args[Is])...);
}
template <class... P>
-void call_with_ptr_args_static_method(void (*p_method)(P...), const GDNativeTypePtr *p_args) {
+void call_with_ptr_args_static_method(void (*p_method)(P...), GDNativeConstTypePtr *p_args) {
call_with_ptr_args_static_method_helper<P...>(p_method, p_args, BuildIndexSequence<sizeof...(P)>{});
}
@@ -529,7 +529,7 @@ void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_ar
}
template <class R, class... P>
-void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const GDNativeVariantPtr *p_args, int p_argcount, Variant &r_ret, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
+void call_with_variant_args_static_ret_dv(R (*p_method)(P...), GDNativeConstVariantPtr *p_args, int p_argcount, Variant &r_ret, GDNativeCallError &r_error, const std::vector<Variant> &default_values) {
#ifdef DEBUG_ENABLED
if ((size_t)p_argcount > sizeof...(P)) {
r_error.error = GDNATIVE_CALL_ERROR_TOO_MANY_ARGUMENTS;
@@ -564,12 +564,12 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const GDNativeVar
}
template <class R, class... P, size_t... Is>
-void call_with_ptr_args_static_method_ret_helper(R (*p_method)(P...), const GDNativeTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
+void call_with_ptr_args_static_method_ret_helper(R (*p_method)(P...), GDNativeConstTypePtr *p_args, void *r_ret, IndexSequence<Is...>) {
PtrToArg<R>::encode(p_method(PtrToArg<P>::convert(p_args[Is])...), r_ret);
}
template <class R, class... P>
-void call_with_ptr_args_static_method_ret(R (*p_method)(P...), const GDNativeTypePtr *p_args, void *r_ret) {
+void call_with_ptr_args_static_method_ret(R (*p_method)(P...), GDNativeConstTypePtr *p_args, void *r_ret) {
call_with_ptr_args_static_method_ret_helper<R, P...>(p_method, p_args, r_ret, BuildIndexSequence<sizeof...(P)>{});
}
diff --git a/include/godot_cpp/core/builtin_ptrcall.hpp b/include/godot_cpp/core/builtin_ptrcall.hpp
index d30a12f..848e86a 100644
--- a/include/godot_cpp/core/builtin_ptrcall.hpp
+++ b/include/godot_cpp/core/builtin_ptrcall.hpp
@@ -41,33 +41,33 @@ namespace internal {
template <class... Args>
void _call_builtin_constructor(const GDNativePtrConstructor constructor, GDNativeTypePtr base, Args... args) {
- std::array<const GDNativeTypePtr, sizeof...(Args)> call_args = { { (const GDNativeTypePtr)args... } };
+ std::array<GDNativeConstTypePtr, sizeof...(Args)> call_args = { { (GDNativeConstTypePtr)args... } };
constructor(base, call_args.data());
}
template <class T, class... Args>
T _call_builtin_method_ptr_ret(const GDNativePtrBuiltInMethod method, GDNativeTypePtr base, Args... args) {
T ret;
- std::array<const GDNativeTypePtr, sizeof...(Args)> call_args = { { (const GDNativeTypePtr)args... } };
+ std::array<GDNativeConstTypePtr, sizeof...(Args)> call_args = { { (GDNativeConstTypePtr)args... } };
method(base, call_args.data(), &ret, sizeof...(Args));
return ret;
}
template <class... Args>
void _call_builtin_method_ptr_no_ret(const GDNativePtrBuiltInMethod method, GDNativeTypePtr base, Args... args) {
- std::array<const GDNativeTypePtr, sizeof...(Args)> call_args = { { (const GDNativeTypePtr)args... } };
+ std::array<GDNativeConstTypePtr, sizeof...(Args)> call_args = { { (GDNativeConstTypePtr)args... } };
method(base, call_args.data(), nullptr, sizeof...(Args));
}
template <class T>
-T _call_builtin_operator_ptr(const GDNativePtrOperatorEvaluator op, const GDNativeTypePtr left, const GDNativeTypePtr right) {
+T _call_builtin_operator_ptr(const GDNativePtrOperatorEvaluator op, GDNativeConstTypePtr left, GDNativeConstTypePtr right) {
T ret;
op(left, right, &ret);
return ret;
}
template <class T>
-T _call_builtin_ptr_getter(const GDNativePtrGetter getter, const GDNativeTypePtr base) {
+T _call_builtin_ptr_getter(const GDNativePtrGetter getter, GDNativeConstTypePtr base) {
T ret;
getter(base, &ret);
return ret;
diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp
index 634e55c..8fcedfa 100644
--- a/include/godot_cpp/core/class_db.hpp
+++ b/include/godot_cpp/core/class_db.hpp
@@ -136,7 +136,7 @@ public:
static MethodBind *get_method(const StringName &p_class, const StringName &p_method);
- static GDNativeExtensionClassCallVirtual get_virtual_func(void *p_userdata, const GDNativeStringNamePtr p_name);
+ static GDNativeExtensionClassCallVirtual get_virtual_func(void *p_userdata, GDNativeConstStringNamePtr p_name);
static void initialize(GDNativeInitializationLevel p_level);
static void deinitialize(GDNativeInitializationLevel p_level);
@@ -151,12 +151,12 @@ public:
#define BIND_BITFIELD_FLAG(m_constant) \
godot::ClassDB::bind_integer_constant(get_class_static(), godot::__constant_get_bitfield_name(m_constant, #m_constant), #m_constant, m_constant, true);
-#define BIND_VIRTUAL_METHOD(m_class, m_method) \
- { \
- auto ___call##m_method = [](GDNativeObjectPtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr p_ret) -> void { \
- call_with_ptr_args(reinterpret_cast<m_class *>(p_instance), &m_class::m_method, p_args, p_ret); \
- }; \
- godot::ClassDB::bind_virtual_method(m_class::get_class_static(), #m_method, ___call##m_method); \
+#define BIND_VIRTUAL_METHOD(m_class, m_method) \
+ { \
+ auto ___call##m_method = [](GDNativeObjectPtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr p_ret) -> void { \
+ call_with_ptr_args(reinterpret_cast<m_class *>(p_instance), &m_class::m_method, p_args, p_ret); \
+ }; \
+ godot::ClassDB::bind_virtual_method(m_class::get_class_static(), #m_method, ___call##m_method); \
}
template <class T, bool is_abstract>
diff --git a/include/godot_cpp/core/engine_ptrcall.hpp b/include/godot_cpp/core/engine_ptrcall.hpp
index d6de1eb..09e2fe1 100644
--- a/include/godot_cpp/core/engine_ptrcall.hpp
+++ b/include/godot_cpp/core/engine_ptrcall.hpp
@@ -46,7 +46,7 @@ namespace internal {
template <class O, class... Args>
O *_call_native_mb_ret_obj(const GDNativeMethodBindPtr mb, void *instance, const Args &...args) {
GodotObject *ret = nullptr;
- std::array<const GDNativeTypePtr, sizeof...(Args)> mb_args = { { (const GDNativeTypePtr)args... } };
+ std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
internal::gdn_interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret);
if (ret == nullptr) {
return nullptr;
@@ -57,21 +57,21 @@ O *_call_native_mb_ret_obj(const GDNativeMethodBindPtr mb, void *instance, const
template <class R, class... Args>
R _call_native_mb_ret(const GDNativeMethodBindPtr mb, void *instance, const Args &...args) {
R ret;
- std::array<const GDNativeTypePtr, sizeof...(Args)> mb_args = { { (const GDNativeTypePtr)args... } };
+ std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
internal::gdn_interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), &ret);
return ret;
}
template <class... Args>
void _call_native_mb_no_ret(const GDNativeMethodBindPtr mb, void *instance, const Args &...args) {
- std::array<const GDNativeTypePtr, sizeof...(Args)> mb_args = { { (const GDNativeTypePtr)args... } };
+ std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
internal::gdn_interface->object_method_bind_ptrcall(mb, instance, mb_args.data(), nullptr);
}
template <class R, class... Args>
R _call_utility_ret(GDNativePtrUtilityFunction func, const Args &...args) {
R ret;
- std::array<const GDNativeTypePtr, sizeof...(Args)> mb_args = { { (const GDNativeTypePtr)args... } };
+ std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
func(&ret, mb_args.data(), mb_args.size());
return ret;
}
@@ -79,14 +79,14 @@ R _call_utility_ret(GDNativePtrUtilityFunction func, const Args &...args) {
template <class... Args>
Object *_call_utility_ret_obj(const GDNativePtrUtilityFunction func, void *instance, const Args &...args) {
GodotObject *ret = nullptr;
- std::array<const GDNativeTypePtr, sizeof...(Args)> mb_args = { { (const GDNativeTypePtr)args... } };
+ std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
func(&ret, mb_args.data(), mb_args.size());
return (Object *)internal::gdn_interface->object_get_instance_binding(ret, internal::token, &Object::___binding_callbacks);
}
template <class... Args>
void _call_utility_no_ret(const GDNativePtrUtilityFunction func, const Args &...args) {
- std::array<const GDNativeTypePtr, sizeof...(Args)> mb_args = { { (const GDNativeTypePtr)args... } };
+ std::array<GDNativeConstTypePtr, sizeof...(Args)> mb_args = { { (GDNativeConstTypePtr)args... } };
func(nullptr, mb_args.data(), mb_args.size());
}
diff --git a/include/godot_cpp/core/method_bind.hpp b/include/godot_cpp/core/method_bind.hpp
index c211676..16f0358 100644
--- a/include/godot_cpp/core/method_bind.hpp
+++ b/include/godot_cpp/core/method_bind.hpp
@@ -136,11 +136,11 @@ public:
return vec;
}
- virtual Variant call(GDExtensionClassInstancePtr p_instance, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeCallError &r_error) const = 0;
- virtual void ptrcall(GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_return) const = 0;
+ virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const = 0;
+ virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return) const = 0;
- static void bind_call(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error);
- static void bind_ptrcall(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_return);
+ static void bind_call(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error);
+ static void bind_ptrcall(void *p_method_userdata, GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return);
virtual ~MethodBind();
};
@@ -171,7 +171,7 @@ public:
return GDNATIVE_EXTENSION_METHOD_ARGUMENT_METADATA_NONE;
}
- virtual void ptrcall(GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_return) const {
+ virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_return) const {
ERR_FAIL(); // Can't call.
}
@@ -211,7 +211,7 @@ class MethodBindVarArgT : public MethodBindVarArgBase<MethodBindVarArgT<T>, T, v
friend class MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>;
public:
- virtual Variant call(GDExtensionClassInstancePtr p_instance, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
+ virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
(static_cast<T *>(p_instance)->*MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>::method)((const Variant **)p_args, p_argument_count, r_error);
return {};
}
@@ -241,7 +241,7 @@ class MethodBindVarArgTR : public MethodBindVarArgBase<MethodBindVarArgTR<T, R>,
friend class MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>;
public:
- virtual Variant call(GDExtensionClassInstancePtr p_instance, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
+ virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
return (static_cast<T *>(p_instance)->*MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>::method)((const Variant **)p_args, p_argument_count, r_error);
}
@@ -314,7 +314,7 @@ public:
return call_get_argument_metadata<P...>(p_argument);
}
- virtual Variant call(GDExtensionClassInstancePtr p_instance, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
+ virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
#ifdef TYPED_METHOD_BIND
call_with_variant_args_dv(static_cast<T *>(p_instance), method, p_args, (int)p_argument_count, r_error, get_default_arguments());
#else
@@ -322,7 +322,7 @@ public:
#endif
return Variant();
}
- virtual void ptrcall(GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret) const {
+ virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
#ifdef TYPED_METHOD_BIND
call_with_ptr_args<T, P...>(static_cast<T *>(p_instance), method, p_args, nullptr);
#else
@@ -390,7 +390,7 @@ public:
return call_get_argument_metadata<P...>(p_argument);
}
- virtual Variant call(GDExtensionClassInstancePtr p_instance, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
+ virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
#ifdef TYPED_METHOD_BIND
call_with_variant_argsc_dv(static_cast<T *>(p_instance), method, p_args, (int)p_argument_count, r_error, get_default_arguments());
#else
@@ -398,7 +398,7 @@ public:
#endif
return Variant();
}
- virtual void ptrcall(GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret) const {
+ virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
#ifdef TYPED_METHOD_BIND
call_with_ptr_args<T, P...>(static_cast<T *>(p_instance), method, p_args, nullptr);
#else
@@ -471,7 +471,7 @@ public:
}
}
- virtual Variant call(GDExtensionClassInstancePtr p_instance, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
+ virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
Variant ret;
#ifdef TYPED_METHOD_BIND
call_with_variant_args_ret_dv(static_cast<T *>(p_instance), method, p_args, (int)p_argument_count, ret, r_error, get_default_arguments());
@@ -480,7 +480,7 @@ public:
#endif
return ret;
}
- virtual void ptrcall(GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret) const {
+ virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
#ifdef TYPED_METHOD_BIND
call_with_ptr_args<T, R, P...>(static_cast<T *>(p_instance), method, p_args, r_ret);
#else
@@ -554,7 +554,7 @@ public:
}
}
- virtual Variant call(GDExtensionClassInstancePtr p_instance, const GDNativeVariantPtr *p_args, const GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
+ virtual Variant call(GDExtensionClassInstancePtr p_instance, GDNativeConstVariantPtr *p_args, GDNativeInt p_argument_count, GDNativeCallError &r_error) const {
Variant ret;
#ifdef TYPED_METHOD_BIND
call_with_variant_args_retc_dv(static_cast<T *>(p_instance), method, p_args, (int)p_argument_count, ret, r_error, get_default_arguments());
@@ -563,7 +563,7 @@ public:
#endif
return ret;
}
- virtual void ptrcall(GDExtensionClassInstancePtr p_instance, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret) const {
+ virtual void ptrcall(GDExtensionClassInstancePtr p_instance, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
#ifdef TYPED_METHOD_BIND
call_with_ptr_args<T, R, P...>(static_cast<T *>(p_instance), method, p_args, r_ret);
#else
@@ -630,13 +630,13 @@ public:
return call_get_argument_metadata<P...>(p_arg);
}
- virtual Variant call(GDExtensionClassInstancePtr p_object, const GDNativeVariantPtr *p_args, const GDNativeInt p_arg_count, GDNativeCallError &r_error) const {
+ virtual Variant call(GDExtensionClassInstancePtr p_object, GDNativeConstVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeCallError &r_error) const {
(void)p_object; // unused
call_with_variant_args_static_dv(function, p_args, p_arg_count, r_error, get_default_arguments());
return Variant();
}
- virtual void ptrcall(GDExtensionClassInstancePtr p_object, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret) const {
+ virtual void ptrcall(GDExtensionClassInstancePtr p_object, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
(void)p_object;
(void)r_ret;
call_with_ptr_args_static_method(function, p_args);
@@ -700,13 +700,13 @@ public:
}
}
- virtual Variant call(GDExtensionClassInstancePtr p_object, const GDNativeVariantPtr *p_args, const GDNativeInt p_arg_count, GDNativeCallError &r_error) const {
+ virtual Variant call(GDExtensionClassInstancePtr p_object, GDNativeConstVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeCallError &r_error) const {
Variant ret;
call_with_variant_args_static_ret_dv(function, p_args, p_arg_count, ret, r_error, get_default_arguments());
return ret;
}
- virtual void ptrcall(GDExtensionClassInstancePtr p_object, const GDNativeTypePtr *p_args, GDNativeTypePtr r_ret) const {
+ virtual void ptrcall(GDExtensionClassInstancePtr p_object, GDNativeConstTypePtr *p_args, GDNativeTypePtr r_ret) const {
(void)p_object;
call_with_ptr_args_static_method_ret(function, p_args, r_ret);
}
diff --git a/include/godot_cpp/core/method_ptrcall.hpp b/include/godot_cpp/core/method_ptrcall.hpp
index e5f64f9..d22b712 100644
--- a/include/godot_cpp/core/method_ptrcall.hpp
+++ b/include/godot_cpp/core/method_ptrcall.hpp
@@ -49,7 +49,7 @@ struct PtrToArg {};
} \
typedef m_type EncodeT; \
_FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \
- *((m_type *)p_ptr) = p_val; \
+ *reinterpret_cast<m_type *>(p_ptr) = p_val; \
} \
}; \
template <> \
@@ -59,7 +59,7 @@ struct PtrToArg {};
} \
typedef m_type EncodeT; \
_FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \
- *((m_type *)p_ptr) = p_val; \
+ *reinterpret_cast<m_type *>(p_ptr) = p_val; \
} \
}
@@ -71,7 +71,7 @@ struct PtrToArg {};
} \
typedef m_conv EncodeT; \
_FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \
- *((m_conv *)p_ptr) = static_cast<m_conv>(p_val); \
+ *reinterpret_cast<m_conv *>(p_ptr) = static_cast<m_conv>(p_val); \
} \
_FORCE_INLINE_ static m_conv encode_arg(m_type p_val) { \
return static_cast<m_conv>(p_val); \
@@ -84,7 +84,7 @@ struct PtrToArg {};
} \
typedef m_conv EncodeT; \
_FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \
- *((m_conv *)p_ptr) = static_cast<m_conv>(p_val); \
+ *reinterpret_cast<m_conv *>(p_ptr) = static_cast<m_conv>(p_val); \
} \
_FORCE_INLINE_ static m_conv encode_arg(m_type p_val) { \
return static_cast<m_conv>(p_val); \
@@ -99,7 +99,7 @@ struct PtrToArg {};
} \
typedef m_type EncodeT; \
_FORCE_INLINE_ static void encode(const m_type &p_val, void *p_ptr) { \
- *((m_type *)p_ptr) = p_val; \
+ *reinterpret_cast<m_type *>(p_ptr) = p_val; \
} \
}; \
template <> \
@@ -109,7 +109,7 @@ struct PtrToArg {};
} \
typedef m_type EncodeT; \
_FORCE_INLINE_ static void encode(const m_type &p_val, void *p_ptr) { \
- *((m_type *)p_ptr) = p_val; \
+ *reinterpret_cast<m_type *>(p_ptr) = p_val; \
} \
}
@@ -168,47 +168,47 @@ MAKE_PTRARG_BY_REFERENCE(Variant);
template <class T>
struct PtrToArg<T *> {
_FORCE_INLINE_ static T *convert(const void *p_ptr) {
- return reinterpret_cast<T *>(godot::internal::gdn_interface->object_get_instance_binding(*(const GDNativeObjectPtr *)p_ptr, godot::internal::token, &T::___binding_callbacks));
+ return reinterpret_cast<T *>(godot::internal::gdn_interface->object_get_instance_binding(*reinterpret_cast<GDNativeConstObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks));
}
typedef Object *EncodeT;
_FORCE_INLINE_ static void encode(T *p_var, void *p_ptr) {
- *((void **)p_ptr) = p_var ? p_var->_owner : nullptr;
+ *reinterpret_cast<const void **>(p_ptr) = p_var ? p_var->_owner : nullptr;
}
};
template <class T>
struct PtrToArg<const T *> {
_FORCE_INLINE_ static const T *convert(const void *p_ptr) {
- return reinterpret_cast<const T *>(godot::internal::gdn_interface->object_get_instance_binding(*(const GDNativeObjectPtr *)p_ptr, godot::internal::token, &T::___binding_callbacks));
+ return reinterpret_cast<const T *>(godot::internal::gdn_interface->object_get_instance_binding(*reinterpret_cast<GDNativeConstObjectPtr *>(const_cast<void *>(p_ptr)), godot::internal::token, &T::___binding_callbacks));
}
typedef const Object *EncodeT;
_FORCE_INLINE_ static void encode(T *p_var, void *p_ptr) {
- *((void **)p_ptr) = p_var ? p_var->_owner : nullptr;
+ *reinterpret_cast<const void **>(p_ptr) = p_var ? p_var->_owner : nullptr;
}
};
// Pointers.
-#define GDVIRTUAL_NATIVE_PTR(m_type) \
- template <> \
- struct PtrToArg<m_type *> { \
- _FORCE_INLINE_ static m_type *convert(const void *p_ptr) { \
- return (m_type *)(*(void **)p_ptr); \
- } \
- typedef m_type *EncodeT; \
- _FORCE_INLINE_ static void encode(m_type *p_var, void *p_ptr) { \
- *((void **)p_ptr) = p_var; \
- } \
- }; \
- \
- template <> \
- struct PtrToArg<const m_type *> { \
- _FORCE_INLINE_ static const m_type *convert(const void *p_ptr) { \
- return (const m_type *)(*(const void **)p_ptr); \
- } \
- typedef const m_type *EncodeT; \
- _FORCE_INLINE_ static void encode(const m_type *p_var, const void *p_ptr) { \
- *((const void **)p_ptr) = p_var; \
- } \
+#define GDVIRTUAL_NATIVE_PTR(m_type) \
+ template <> \
+ struct PtrToArg<m_type *> { \
+ _FORCE_INLINE_ static m_type *convert(const void *p_ptr) { \
+ return (m_type *)(*(void **)p_ptr); \
+ } \
+ typedef m_type *EncodeT; \
+ _FORCE_INLINE_ static void encode(m_type *p_var, void *p_ptr) { \
+ *reinterpret_cast<m_type **>(p_ptr) = p_var; \
+ } \
+ }; \
+ \
+ template <> \
+ struct PtrToArg<const m_type *> { \
+ _FORCE_INLINE_ static const m_type *convert(const void *p_ptr) { \
+ return (const m_type *)(*(const void **)p_ptr); \
+ } \
+ typedef const m_type *EncodeT; \
+ _FORCE_INLINE_ static void encode(const m_type *p_var, void *p_ptr) { \
+ *reinterpret_cast<const m_type **>(p_ptr) = p_var; \
+ } \
}
GDVIRTUAL_NATIVE_PTR(void);
diff --git a/include/godot_cpp/core/type_info.hpp b/include/godot_cpp/core/type_info.hpp
index 4c3f1bf..329231a 100644
--- a/include/godot_cpp/core/type_info.hpp
+++ b/include/godot_cpp/core/type_info.hpp
@@ -292,7 +292,7 @@ struct PtrToArg<TypedArray<T>> {
}
typedef Array EncodeT;
_FORCE_INLINE_ static void encode(TypedArray<T> p_val, void *p_ptr) {
- *(Array *)p_ptr = p_val;
+ *reinterpret_cast<Array *>(p_ptr) = p_val;
}
};
diff --git a/include/godot_cpp/godot.hpp b/include/godot_cpp/godot.hpp
index d6743fb..c93759e 100644
--- a/include/godot_cpp/godot.hpp
+++ b/include/godot_cpp/godot.hpp
@@ -57,7 +57,7 @@ public:
static Callback init_callback;
static Callback terminate_callback;
static GDNativeInitializationLevel minimum_initialization_level;
- static GDNativeBool init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization);
+ static GDNativeBool init(const GDNativeInterface *p_interface, GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization);
public:
static void initialize_level(void *userdata, GDNativeInitializationLevel p_level);
@@ -65,11 +65,11 @@ public:
class InitObject {
const GDNativeInterface *gdn_interface;
- const GDNativeExtensionClassLibraryPtr library;
+ GDNativeExtensionClassLibraryPtr library;
GDNativeInitialization *initialization;
public:
- InitObject(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) :
+ InitObject(const GDNativeInterface *p_interface, GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) :
gdn_interface(p_interface),
library(p_library),
initialization(r_initialization) {}
diff --git a/include/godot_cpp/variant/variant.hpp b/include/godot_cpp/variant/variant.hpp
index 1a5c22d..4a430ed 100644
--- a/include/godot_cpp/variant/variant.hpp
+++ b/include/godot_cpp/variant/variant.hpp
@@ -145,7 +145,7 @@ public:
Variant();
Variant(std::nullptr_t n) :
Variant() {}
- explicit Variant(const GDNativeVariantPtr native_ptr);
+ explicit Variant(GDNativeConstVariantPtr native_ptr);
Variant(const Variant &other);
Variant(Variant &&other);
Variant(bool v);
@@ -257,7 +257,7 @@ public:
Variant call(const StringName &method, Args... args) {
Variant result;
GDNativeCallError error;
- std::array<const GDNativeVariantPtr, sizeof...(Args)> call_args = { Variant(args)... };
+ std::array<GDNativeConstVariantPtr, sizeof...(Args)> call_args = { Variant(args)... };
call(method, call_args.data(), call_args.size(), result, error);
return result;
}
@@ -268,7 +268,7 @@ public:
static Variant call_static(Variant::Type type, const StringName &method, Args... args) {
Variant result;
GDNativeCallError error;
- std::array<const GDNativeVariantPtr, sizeof...(Args)> call_args = { Variant(args)... };
+ std::array<GDNativeConstVariantPtr, sizeof...(Args)> call_args = { Variant(args)... };
call_static(type, method, call_args.data(), call_args.size(), result, error);
return result;
}