summaryrefslogtreecommitdiff
path: root/src/lib/eet
diff options
context:
space:
mode:
authorJee-Yong Um <jc9.um@samsung.com>2016-05-10 15:18:33 -0700
committerCedric Bail <cedric@osg.samsung.com>2016-05-10 16:36:22 -0700
commit557381a070d818aa2353a0785a0d20bb6406afaf (patch)
tree23235a627f35f8a7f3e0c14bd11da565bea1c1de /src/lib/eet
parentfa5abb2967ca1a14770c5270b13200412a0fd345 (diff)
eet: add a helper to setup hash with generic value storage
Summary: add a macro to setup eet_data_descriptor for hash with generic value storage. Test Plan: make check (test case is included in eet test suite) Reviewers: cedric, raster Subscribers: jpeg Differential Revision: https://phab.enlightenment.org/D3925 Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/eet')
-rw-r--r--src/lib/eet/Eet.h23
-rw-r--r--src/lib/eet/eet_data.c10
2 files changed, 30 insertions, 3 deletions
diff --git a/src/lib/eet/Eet.h b/src/lib/eet/Eet.h
index c861165c09..c69c1153b4 100644
--- a/src/lib/eet/Eet.h
+++ b/src/lib/eet/Eet.h
@@ -3579,6 +3579,29 @@ eet_data_descriptor_encode(Eet_Data_Descriptor *edd,
3579 } while (0) 3579 } while (0)
3580 3580
3581/** 3581/**
3582 * Add a hash of generic value storage to a data descriptor
3583 * @param edd The data descriptor to add the type to.
3584 * @param struct_type The type of the struct.
3585 * @param name The string name to use to encode/decode this member
3586 * (must be a constant global and never change).
3587 * @param member The struct member itself to be encoded.
3588 *
3589 * This macro lets you easily add a hash of value elements. All the
3590 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_HASH().
3591 *
3592 * @since 1.18
3593 * @ingroup Eet_Data_Group
3594 */
3595#define EET_DATA_DESCRIPTOR_ADD_HASH_VALUE(edd, struct_type, name, member) \
3596 do { \
3597 struct_type ___ett; \
3598 eet_data_descriptor_element_add(edd, name, EET_T_VALUE, EET_G_HASH, \
3599 (char *)(& (___ett.member)) - \
3600 (char *)(& (___ett)), \
3601 0, /* 0, */ NULL, NULL); \
3602 } while (0)
3603
3604/**
3582 * Add an array of basic data elements to a data descriptor. 3605 * Add an array of basic data elements to a data descriptor.
3583 * @param edd The data descriptor to add the type to. 3606 * @param edd The data descriptor to add the type to.
3584 * @param struct_type The type of the struct. 3607 * @param struct_type The type of the struct.
diff --git a/src/lib/eet/eet_data.c b/src/lib/eet/eet_data.c
index eb5a44aba2..0df96afac8 100644
--- a/src/lib/eet/eet_data.c
+++ b/src/lib/eet/eet_data.c
@@ -632,6 +632,7 @@ static int _eet_data_words_bigendian = -1;
632#define EET_I_STRING 1 << 4 632#define EET_I_STRING 1 << 4
633#define EET_I_INLINED_STRING 2 << 4 633#define EET_I_INLINED_STRING 2 << 4
634#define EET_I_NULL 3 << 4 634#define EET_I_NULL 3 << 4
635#define EET_I_VALUE 4 << 4
635 636
636#define EET_MAGIC_VARIANT 0xF1234BC 637#define EET_MAGIC_VARIANT 0xF1234BC
637/*---*/ 638/*---*/
@@ -1281,7 +1282,7 @@ _eet_type_to_eina_value_get(int eet_type)
1281 1282
1282 return NULL; 1283 return NULL;
1283} 1284}
1284 1285
1285static int 1286static int
1286_eina_value_to_eet_type_get(const Eina_Value_Type *eina_type) 1287_eina_value_to_eet_type_get(const Eina_Value_Type *eina_type)
1287{ 1288{
@@ -1361,7 +1362,7 @@ eet_data_put_value(Eet_Dictionary *ed,
1361 const void *src, 1362 const void *src,
1362 int *size_ret) 1363 int *size_ret)
1363{ 1364{
1364 const Eina_Value *value = *(void**)src; 1365 const Eina_Value *value = *(Eina_Value **)src;
1365 const Eina_Value_Type *value_type; 1366 const Eina_Value_Type *value_type;
1366 void *int_data; 1367 void *int_data;
1367 void *type_data; 1368 void *type_data;
@@ -1522,6 +1523,7 @@ case EET_I_ ## Type: chnk->type = EET_T_ ## Type; break;
1522 1523
1523 EET_UNMATCH_TYPE(STRING); 1524 EET_UNMATCH_TYPE(STRING);
1524 EET_UNMATCH_TYPE(INLINED_STRING); 1525 EET_UNMATCH_TYPE(INLINED_STRING);
1526 EET_UNMATCH_TYPE(VALUE);
1525 EET_UNMATCH_TYPE(NULL); 1527 EET_UNMATCH_TYPE(NULL);
1526 1528
1527 default: 1529 default:
@@ -1701,6 +1703,7 @@ case EET_T_ ## Type: type += EET_I_ ## Type; break;
1701 1703
1702 EET_MATCH_TYPE(STRING); 1704 EET_MATCH_TYPE(STRING);
1703 EET_MATCH_TYPE(INLINED_STRING); 1705 EET_MATCH_TYPE(INLINED_STRING);
1706 EET_MATCH_TYPE(VALUE);
1704 EET_MATCH_TYPE(NULL); 1707 EET_MATCH_TYPE(NULL);
1705 1708
1706 default: 1709 default:
@@ -2221,7 +2224,8 @@ eet_data_descriptor_element_add(Eet_Data_Descriptor *edd,
2221 if ((group_type > EET_G_UNKNOWN) 2224 if ((group_type > EET_G_UNKNOWN)
2222 && (group_type < EET_G_LAST) 2225 && (group_type < EET_G_LAST)
2223 && (((type > EET_T_UNKNOW) && (type < EET_T_STRING)) 2226 && (((type > EET_T_UNKNOW) && (type < EET_T_STRING))
2224 || ((type > EET_T_NULL) && (type < EET_T_LAST))) 2227 || ((type > EET_T_NULL) && (type < EET_T_VALUE))
2228 || ((type > EET_T_VALUE) && (type < EET_T_LAST)))
2225 && (!subtype)) 2229 && (!subtype))
2226 { 2230 {
2227 subtype = calloc(1, sizeof (Eet_Data_Descriptor)); 2231 subtype = calloc(1, sizeof (Eet_Data_Descriptor));