diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-07-27 12:07:42 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-07-27 12:29:03 +0200 |
commit | 95088f6bfaad8af476198f5e7d52baf06b86edf1 (patch) | |
tree | f0834d492f1d281701b9ac74fb38988ee62412e1 /core | |
parent | 77ca5e7b217c9ff1160f24a720d9e7a488e426f4 (diff) |
[Core] Make enum variant cast and encoding 64 bits
This should fix various issues where retrieving enum values from
scripting languages would result in corrupted values (where 32 bits
were valid, and the other 32 random data).
Diffstat (limited to 'core')
-rw-r--r-- | core/variant/binder_common.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/variant/binder_common.h b/core/variant/binder_common.h index ef5867c685..3cb2a6bfb5 100644 --- a/core/variant/binder_common.h +++ b/core/variant/binder_common.h @@ -69,17 +69,17 @@ struct VariantCaster<const T &> { template <> \ struct VariantCaster<m_enum> { \ static _FORCE_INLINE_ m_enum cast(const Variant &p_variant) { \ - return (m_enum)p_variant.operator int(); \ + return (m_enum)p_variant.operator int64_t(); \ } \ }; \ template <> \ struct PtrToArg<m_enum> { \ _FORCE_INLINE_ static m_enum convert(const void *p_ptr) { \ - return m_enum(*reinterpret_cast<const int *>(p_ptr)); \ + return m_enum(*reinterpret_cast<const int64_t *>(p_ptr)); \ } \ typedef int64_t EncodeT; \ _FORCE_INLINE_ static void encode(m_enum p_val, const void *p_ptr) { \ - *(int *)p_ptr = p_val; \ + *(int64_t *)p_ptr = p_val; \ } \ }; |