fixup Eina: Add Eina_Promise/Eina_Future (convert_to)

convert_to() should just setup for empty, getting the default value.

on errors it should convert to EINA_VALUE_TYPE_ERROR, otherwise pass
thru.
This commit is contained in:
Gustavo Sverzut Barbieri 2017-08-27 03:49:46 -03:00
parent 07f272b52e
commit b2cd2cbf16
1 changed files with 11 additions and 1 deletions

View File

@ -947,7 +947,17 @@ _eina_future_cb_convert_to(void *data, const Eina_Value src,
{
const Eina_Value_Type *type = data;
Eina_Value dst = EINA_VALUE_EMPTY;
if (type && eina_value_setup(&dst, type)) eina_value_convert(&src, &dst);
if (!type) return src; // pass thru
if (!eina_value_setup(&dst, type))
{
eina_value_setup(&dst, EINA_VALUE_TYPE_ERROR);
eina_value_set(&dst, ENOMEM);
}
else if (src.type) eina_value_convert(&src, &dst);
// otherwise leave initial value for empty
return dst;
}