summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-09-13 10:39:31 -0700
committerCedric Bail <cedric@osg.samsung.com>2017-09-13 10:39:31 -0700
commitf5487c5d3e2de4ed85b16d1d65ed409f0ee06244 (patch)
tree4b6cb4720b135aec85e8f05c205cb4db22e26bcf /src
parent430095d4f1aaad51ffbc30c7e323c200c896e926 (diff)
eina: fix Eina_Rectangle support in Eina_Value.
Thanks for the review Gustavo.
Diffstat (limited to 'src')
-rw-r--r--src/lib/eina/eina_value.c20
-rw-r--r--src/lib/eina/eina_value.h2
2 files changed, 10 insertions, 12 deletions
diff --git a/src/lib/eina/eina_value.c b/src/lib/eina/eina_value.c
index 6088d63695..d3a9d6dec6 100644
--- a/src/lib/eina/eina_value.c
+++ b/src/lib/eina/eina_value.c
@@ -4842,14 +4842,11 @@ _eina_value_type_rectangle_convert_to(const Eina_Value_Type *type EINA_UNUSED, c
4842 if ((convert == EINA_VALUE_TYPE_STRING) || 4842 if ((convert == EINA_VALUE_TYPE_STRING) ||
4843 (convert == EINA_VALUE_TYPE_STRINGSHARE)) 4843 (convert == EINA_VALUE_TYPE_STRINGSHARE))
4844 { 4844 {
4845 Eina_Strbuf *buf; 4845 char str[1024];
4846 const char *str;
4847 4846
4848 buf = eina_strbuf_new(); 4847 snprintf(str, 1024, "[ %i, %i, %i, %i ]",
4849 eina_strbuf_append_printf(buf, "[ %i, %i, %i, %i ]", 4848 tr->x, tr->y, tr->w, tr->h);
4850 tr->x, tr->y, tr->w, tr->h); 4849 ret = eina_value_type_pset(convert, convert_mem, str);
4851 str = eina_strbuf_string_get(buf);
4852 ret = eina_value_type_pset(convert, convert_mem, &str);
4853 } 4850 }
4854 4851
4855 return ret; 4852 return ret;
@@ -4889,23 +4886,24 @@ _eina_value_type_rectangle_pset(const Eina_Value_Type *type EINA_UNUSED, void *m
4889static Eina_Bool 4886static Eina_Bool
4890_eina_value_type_rectangle_vset(const Eina_Value_Type *type, void *mem, va_list args) 4887_eina_value_type_rectangle_vset(const Eina_Value_Type *type, void *mem, va_list args)
4891{ 4888{
4892 const Eina_Rectangle *r = va_arg(args, Eina_Rectangle *); 4889 const Eina_Rectangle r = va_arg(args, Eina_Rectangle);
4893 return _eina_value_type_rectangle_pset(type, mem, r); 4890 return _eina_value_type_rectangle_pset(type, mem, &r);
4894} 4891}
4895 4892
4896static Eina_Bool 4893static Eina_Bool
4897_eina_value_type_rectangle_pget(const Eina_Value_Type *type EINA_UNUSED, const void *mem, void *ptr) 4894_eina_value_type_rectangle_pget(const Eina_Value_Type *type EINA_UNUSED, const void *mem, void *ptr)
4898{ 4895{
4899 const Eina_Rectangle *tr = mem; 4896 const Eina_Rectangle *tr = mem;
4897 Eina_Rectangle *r = ptr;
4900 4898
4901 memcpy(ptr, &tr, sizeof (void*)); 4899 *r = *tr;
4902 return EINA_TRUE; 4900 return EINA_TRUE;
4903} 4901}
4904 4902
4905EAPI const Eina_Value_Type _EINA_VALUE_TYPE_RECTANGLE = { 4903EAPI const Eina_Value_Type _EINA_VALUE_TYPE_RECTANGLE = {
4906 EINA_VALUE_TYPE_VERSION, 4904 EINA_VALUE_TYPE_VERSION,
4907 sizeof (Eina_Rectangle), 4905 sizeof (Eina_Rectangle),
4908 "Eina_Value_Rectangle", 4906 "Eina_Rectangle",
4909 _eina_value_type_rectangle_setup, 4907 _eina_value_type_rectangle_setup,
4910 _eina_value_type_rectangle_flush, 4908 _eina_value_type_rectangle_flush,
4911 _eina_value_type_rectangle_copy, 4909 _eina_value_type_rectangle_copy,
diff --git a/src/lib/eina/eina_value.h b/src/lib/eina/eina_value.h
index 090000706a..305d378548 100644
--- a/src/lib/eina/eina_value.h
+++ b/src/lib/eina/eina_value.h
@@ -3679,7 +3679,7 @@ EAPI extern const Eina_Value_Type *EINA_VALUE_TYPE_FILE;
3679 3679
3680/** 3680/**
3681 * @var EINA_VALUE_TYPE_RECTANGLE 3681 * @var EINA_VALUE_TYPE_RECTANGLE
3682 * manages optional type. 3682 * manages Eina_Rectangle type.
3683 * 3683 *
3684 * @since 1.21 3684 * @since 1.21
3685 */ 3685 */