On Tue, Sep 12, 2017 at 9:05 PM, Cedric BAIL <[email protected]> wrote:
> cedric pushed a commit to branch master.
> +static Eina_Bool
> +_eina_value_type_file_flush(const Eina_Value_Type *type EINA_UNUSED, void
> *mem)
> +{
> + Eina_File *f = *(Eina_File **)mem;
> +
> + eina_file_close(f);
if no file was set, this will cause EINA_FILE_MAGIC_CHECK() failure.
> +static Eina_Bool
> +_eina_value_type_file_convert_to(const Eina_Value_Type *type EINA_UNUSED,
> const Eina_Value_Type *convert, const void *type_mem, void *convert_mem)
> +{
> + const Eina_File *f = *(const Eina_File **) type_mem;
> + Eina_Bool ret = EINA_FALSE;
> +
> + if ((convert == EINA_VALUE_TYPE_STRING) ||
> + (convert == EINA_VALUE_TYPE_STRINGSHARE))
> + {
> + const char *filename;
> +
> + filename = eina_file_filename_get(f);
> + ret = eina_value_type_pset(convert, convert_mem, &filename);
> + }
thinking... maybe you could also convert to BLOB. That type is
basically "pointer + size" and how to manage it, then matches well
with eina file mmap, that is, to get its contents.
eventually you can even convert to integer types to query size.
> +EAPI const Eina_Value_Type _EINA_VALUE_TYPE_FILE = {
> + EINA_VALUE_TYPE_VERSION,
> + sizeof (Eina_File *),
> + "Eina_Value_File",
this should be "Eina_File", the target type... like for int it's "int".
> /**
> + * @var EINA_VALUE_TYPE_FILE
> + * manages optional type.
too much copy&paste... it should be "manages Eina_File*".
--
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (16) 99354-9890
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel