const Eet_Dictionary *ed,
Eet_Data_Descriptor *edd,
const void *data_in,
- int size_in);
+ int size_in,
+ void *data_out,
+ int size_out);
/*---*/
if (!___r) { goto Label; }\
} while (0)
-#define STRUCT_TYPE_DECODE(Data_Ret, Context, Ed, Ede, Data, Size, Label)\
+#define STRUCT_TYPE_DECODE(Data_Ret, Context, Ed, Ede, Data, Size, SubSize, Label) \
do {\
Data_Ret = _eet_data_descriptor_decode(Context,\
Ed,\
Ede,\
Data,\
- Size);\
+ Size,\
+ SubSize > 0 ? Data_Ret : NULL,\
+ SubSize); \
if (!Data_Ret) { goto Label; }\
} while (0)
}
eet_free_context_init(&context);
- data_dec = _eet_data_descriptor_decode(&context, ed, edd, data, size);
+ data_dec = _eet_data_descriptor_decode(&context, ed, edd, data, size, NULL, 0);
eet_free_context_shutdown(&context);
if (required_free)
}
eet_free_context_init(&context);
- result = _eet_data_descriptor_decode(&context, ed, NULL, data, size);
+ result = _eet_data_descriptor_decode(&context, ed, NULL, data, size, NULL, 0);
eet_free_context_shutdown(&context);
if (required_free)
const Eet_Dictionary *ed,
Eet_Data_Descriptor *edd,
const void *data_in,
- int size_in)
+ int size_in,
+ void *data_out,
+ int size_out)
{
Eet_Node *result = NULL;
void *data = NULL;
if (edd)
{
- data = edd->func.mem_alloc(edd->size);
+ if (data_out)
+ {
+ if (size_out <= edd->size)
+ data = data_out;
+ }
+ else
+ {
+ data = edd->func.mem_alloc(edd->size);
+ }
+
if (!data)
return NULL;
}
_eet_freelist_all_ref(context);
- if (data)
+ if (data && !data_out)
_eet_freelist_add(context, data);
memset(&chnk, 0, sizeof(Eet_Data_Chunk));
subtype,
echnk->data,
echnk->size,
+ -1,
on_error);
if (edd)
ede ? ede->subtype : NULL,
echnk->data,
echnk->size,
+ -1,
on_error);
if (edd)
for (i = 0; i < count; i++)
{
void *dst = NULL;
- void *data_ret = NULL;
/* Advance to next chunk */
NEXT_CHUNK((*p), (*size), (*echnk), ed);
if (IS_POINTER_TYPE(echnk->type))
{
+ void *data_ret = NULL;
+
POINTER_TYPE_DECODE(context,
ed,
edd,
}
else
{
- STRUCT_TYPE_DECODE(data_ret,
+ STRUCT_TYPE_DECODE(dst,
context,
ed,
ede ? ede->subtype : NULL,
echnk->data,
echnk->size,
+ subsize,
on_error);
- if (dst)
- {
- memcpy(dst, data_ret, subsize);
- if ((ede) && (ede->subtype))
- ede->subtype->func.mem_free(data_ret);
- else if (edd)
- edd->func.mem_free(data_ret);
- else free(data_ret);
- _eet_freelist_del(context, data_ret);
- }
if (!edd)
- childs = eina_list_append(childs, data_ret);
+ childs = eina_list_append(childs, dst);
}
}
ed,
sede->subtype,
echnk->data,
- echnk->size);
+ echnk->size,
+ data,
+ sede->subtype->size);
if (!data_ret)
goto on_error;
- /* Memcopy the structure content to remove pointer indirection. */
- memcpy(data, data_ret, sede->subtype->size);
-
- /* data_ret is now useless. */
- sede->subtype->func.mem_free(data_ret);
-
/* Set union type. */
if ((!ed) || (!ede->subtype->func.str_direct_alloc))
{
/* FIXME: generate node structure. */
data_ret = _eet_data_descriptor_decode(context,
ed, NULL,
- echnk->data, echnk->size);
+ echnk->data, echnk->size,
+ NULL, 0);
goto on_error;
}
ed,
sede->subtype,
echnk->data,
- echnk->size);
+ echnk->size,
+ NULL, 0);
if (!data_ret)
break;
/* FIXME: dump node structure. */
data_ret = _eet_data_descriptor_decode(context,
ed, NULL,
- echnk->data, echnk->size);
+ echnk->data, echnk->size,
+ NULL, 0);
goto on_error;
}
ed,
subtype,
echnk->data,
- echnk->size);
+ echnk->size,
+ NULL, 0);
if (!data_ret)
return 0;
}
eet_free_context_init(&context);
- result = _eet_data_descriptor_decode(&context, ed, NULL, data, size);
+ result = _eet_data_descriptor_decode(&context, ed, NULL, data, size, NULL, 0);
eet_free_context_shutdown(&context);
eet_node_dump(result, 0, dumpfunc, dumpdata);
}
eet_free_context_init(&context);
- result = _eet_data_descriptor_decode(&context, NULL, NULL, ret, ret_len);
+ result = _eet_data_descriptor_decode(&context, NULL, NULL, ret, ret_len, NULL, 0);
eet_free_context_shutdown(&context);
eet_node_dump(result, 0, dumpfunc, dumpdata);
NULL,
edd,
deciphered,
- deciphered_len);
+ deciphered_len,
+ NULL, 0);
eet_free_context_shutdown(&context);
if (data_in != deciphered)
NULL,
NULL,
deciphered,
- deciphered_len);
+ deciphered_len,
+ NULL, 0);
eet_free_context_shutdown(&context);
if (data_in != deciphered)