summaryrefslogtreecommitdiff
path: root/src/lib/efl_mono
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-03-01 19:17:16 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-03-01 19:24:12 -0300
commit850b7309b061551eeee34891f40d4820da495b0f (patch)
treecb5fcba66a7ae1ebff6cdcde1ea8cc759e6fb4d5 /src/lib/efl_mono
parent8fc4e948778f795229cedb64c181e6e388131bc1 (diff)
efl-csharp: Fix Eina.Value containing arrays and lists
Summary: It was marshalling erroneously data into and out of arrays and lists. Instead of passing data by value (or by address of correct size), it was stuffing data into IntPtr and trying to parse out afterwards. This commit changes the binding to use the same approach of plain Get/Set, with proper overloads. Reviewers: vitor.sousa, segfaultxavi, felipealmeida Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8057
Diffstat (limited to 'src/lib/efl_mono')
-rw-r--r--src/lib/efl_mono/efl_custom_exports_mono.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/lib/efl_mono/efl_custom_exports_mono.c b/src/lib/efl_mono/efl_custom_exports_mono.c
index 246a7bcf71..fce3a43a1e 100644
--- a/src/lib/efl_mono/efl_custom_exports_mono.c
+++ b/src/lib/efl_mono/efl_custom_exports_mono.c
@@ -349,6 +349,63 @@ EINA_SET_WRAPPER(double, double)
349EINA_SET_WRAPPER(string, const char *) 349EINA_SET_WRAPPER(string, const char *)
350EINA_SET_WRAPPER(ptr, void *) 350EINA_SET_WRAPPER(ptr, void *)
351 351
352#define EINA_CONTAINER_SET_WRAPPER(N, T) EAPI Eina_Bool eina_value_container_set_wrapper_##N(Eina_Value *value, int i, T new_value) \
353{ \
354 const Eina_Value_Type *tp = eina_value_type_get(value); \
355 if (tp == EINA_VALUE_TYPE_ARRAY) \
356 return eina_value_array_set(value, i, new_value); \
357 else if (tp == EINA_VALUE_TYPE_LIST) \
358 return eina_value_list_set(value, i, new_value); \
359 else \
360 return EINA_FALSE; \
361}
362
363EINA_CONTAINER_SET_WRAPPER(char, char)
364EINA_CONTAINER_SET_WRAPPER(uchar, unsigned char)
365EINA_CONTAINER_SET_WRAPPER(short, short)
366EINA_CONTAINER_SET_WRAPPER(ushort, unsigned short)
367EINA_CONTAINER_SET_WRAPPER(int, int)
368EINA_CONTAINER_SET_WRAPPER(uint, unsigned int)
369EINA_CONTAINER_SET_WRAPPER(long, long)
370EINA_CONTAINER_SET_WRAPPER(ulong, unsigned long)
371EINA_CONTAINER_SET_WRAPPER(float, float)
372EINA_CONTAINER_SET_WRAPPER(double, double)
373EINA_CONTAINER_SET_WRAPPER(string, const char *)
374EINA_CONTAINER_SET_WRAPPER(ptr, void *)
375
376#define EINA_CONTAINER_APPEND_WRAPPER(N, T) EAPI Eina_Bool eina_value_container_append_wrapper_##N(Eina_Value *value, T new_value) \
377{ \
378 const Eina_Value_Type *tp = eina_value_type_get(value); \
379 if (tp == EINA_VALUE_TYPE_ARRAY) \
380 return eina_value_array_append(value, new_value); \
381 else if (tp == EINA_VALUE_TYPE_LIST) \
382 return eina_value_list_append(value, new_value); \
383 else \
384 return EINA_FALSE; \
385}
386
387EINA_CONTAINER_APPEND_WRAPPER(char, char)
388EINA_CONTAINER_APPEND_WRAPPER(uchar, unsigned char)
389EINA_CONTAINER_APPEND_WRAPPER(short, short)
390EINA_CONTAINER_APPEND_WRAPPER(ushort, unsigned short)
391EINA_CONTAINER_APPEND_WRAPPER(int, int)
392EINA_CONTAINER_APPEND_WRAPPER(uint, unsigned int)
393EINA_CONTAINER_APPEND_WRAPPER(long, long)
394EINA_CONTAINER_APPEND_WRAPPER(ulong, unsigned long)
395EINA_CONTAINER_APPEND_WRAPPER(float, float)
396EINA_CONTAINER_APPEND_WRAPPER(double, double)
397EINA_CONTAINER_APPEND_WRAPPER(string, const char *)
398EINA_CONTAINER_APPEND_WRAPPER(ptr, void *)
399
400EAPI void eina_value_container_get_wrapper(const Eina_Value *value, int i, void *output)
401{
402 const Eina_Value_Type *tp = eina_value_type_get(value);
403 if (tp == EINA_VALUE_TYPE_ARRAY)
404 eina_value_array_get(value, i, output);
405 else if (tp == EINA_VALUE_TYPE_LIST)
406 eina_value_list_get(value, i, output);
407}
408
352EAPI Eina_Bool eina_value_setup_wrapper(Eina_Value *value, 409EAPI Eina_Bool eina_value_setup_wrapper(Eina_Value *value,
353 const Eina_Value_Type *type) 410 const Eina_Value_Type *type)
354{ 411{