diff options
author | Thomas Herzog <karroffel@users.noreply.github.com> | 2017-05-23 22:02:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-23 22:02:53 +0000 |
commit | 2e3145de65257ed39a5d01c5592ea0fb90cd00ba (patch) | |
tree | 116e4e886547b4503f28740cf98d5c674b5840da | |
parent | f4f7d6d58d9d4b5dc6920d71247895925ea247ab (diff) | |
parent | f23b56e3ecc5de8fc823dfa1c63f71d51ea12993 (diff) |
Merge pull request #8884 from karroffel/gdnative-fixes
[GDNative] fixed some functions that returned references
-rw-r--r-- | modules/gdnative/godot/godot_array.cpp | 10 | ||||
-rw-r--r-- | modules/gdnative/godot/godot_array.h | 2 | ||||
-rw-r--r-- | modules/gdnative/godot/godot_dictionary.cpp | 9 | ||||
-rw-r--r-- | modules/gdnative/godot/godot_dictionary.h | 2 |
4 files changed, 8 insertions, 15 deletions
diff --git a/modules/gdnative/godot/godot_array.cpp b/modules/gdnative/godot/godot_array.cpp index 65353c5b0f..bf2ef35972 100644 --- a/modules/gdnative/godot/godot_array.cpp +++ b/modules/gdnative/godot/godot_array.cpp @@ -139,13 +139,9 @@ void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godo a->operator[](p_idx) = *val; } -godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx) { - godot_variant raw_dest; - Variant *dest = (Variant *)&raw_dest; - memnew_placement(dest, Variant); - const Array *a = (const Array *)p_arr; - *dest = a->operator[](p_idx); - return raw_dest; +godot_variant GDAPI *godot_array_get(const godot_array *p_arr, const godot_int p_idx) { + Array *a = (Array *)p_arr; + return (godot_variant *)&a->operator[](p_idx); } void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value) { diff --git a/modules/gdnative/godot/godot_array.h b/modules/gdnative/godot/godot_array.h index 29a76304d0..f7150950fc 100644 --- a/modules/gdnative/godot/godot_array.h +++ b/modules/gdnative/godot/godot_array.h @@ -59,7 +59,7 @@ void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_ void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value); -godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx); +godot_variant GDAPI *godot_array_get(const godot_array *p_arr, const godot_int p_idx); void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value); diff --git a/modules/gdnative/godot/godot_dictionary.cpp b/modules/gdnative/godot/godot_dictionary.cpp index dda245e59e..b98ee5b5c9 100644 --- a/modules/gdnative/godot/godot_dictionary.cpp +++ b/modules/gdnative/godot/godot_dictionary.cpp @@ -101,13 +101,10 @@ godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self) { return dest; } -godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) { - godot_variant raw_dest; - Variant *dest = (Variant *)&raw_dest; - const Dictionary *dict = (const Dictionary *)p_dict; +godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) { + Dictionary *dict = (Dictionary *)p_dict; const Variant *key = (const Variant *)p_key; - *dest = dict->operator[](*key); - return raw_dest; + return (godot_variant *)&dict->operator[](*key); } godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b) { diff --git a/modules/gdnative/godot/godot_dictionary.h b/modules/gdnative/godot/godot_dictionary.h index 9f6de77aac..42f7f872a1 100644 --- a/modules/gdnative/godot/godot_dictionary.h +++ b/modules/gdnative/godot/godot_dictionary.h @@ -68,7 +68,7 @@ godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self); godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self); -godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key); +godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key); godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b); |