From 6326e18b3fb2a4757f8ffa22be5d55a75da23049 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 27 Feb 2019 13:17:09 -0500 Subject: efl.file: improve api a bit Summary: the previous implementation/api had a number of issues: * "file" property contained both "file" and "key" values - also performed file loading operation * "load_error" property which was specific to image objects * no methods for controlling file loading/unloading this patch attempts the following changes: * split "file" property into "file" and "key" properties - also remove "key" from existing "mmap" property * remove "load_error" * directly return error codes from operations * add "load" and "unload" methods for directly controlling load state * add implicit file loading if file/mmap is set during construction * rewrite all efl.file implementations to move file loading into load() method * rewrite all usage of efl.file api based on these changes * add C extension functions to mimic previous behavior ref T7577 Reviewers: segfaultxavi, bu5hm4n, cedric Reviewed By: segfaultxavi Subscribers: vitor.sousa, #reviewers, #committers Tags: #efl_api Maniphest Tasks: T7577 Differential Revision: https://phab.enlightenment.org/D8018 --- src/lib/ecore_file/ecore_file_download.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib/ecore_file') diff --git a/src/lib/ecore_file/ecore_file_download.c b/src/lib/ecore_file/ecore_file_download.c index 54666693d2..4b65c51ee6 100644 --- a/src/lib/ecore_file/ecore_file_download.c +++ b/src/lib/ecore_file/ecore_file_download.c @@ -66,7 +66,7 @@ _ecore_file_download_copier_done(void *data, const Efl_Event *event EINA_UNUSED) Efl_Net_Http_Status status = efl_net_dialer_http_response_status_get(job->input); const char *file; - efl_file_get(job->output, &file, NULL); + file = efl_file_get(job->output); DBG("Finished downloading %s (status=%d) -> %s", efl_net_dialer_address_dial_get(job->input), @@ -92,7 +92,7 @@ _ecore_file_download_copier_error(void *data, const Efl_Event *event) Eina_Error *perr = event->info; const char *file; - efl_file_get(job->output, &file, NULL); + file = efl_file_get(job->output); WRN("Failed downloading %s (status=%d) -> %s: %s", efl_net_dialer_address_dial_get(job->input), @@ -127,7 +127,7 @@ _ecore_file_download_copier_progress(void *data, const Efl_Event *event EINA_UNU if (!job->progress_cb) return; - efl_file_get(job->output, &file, NULL); + file = efl_file_get(job->output); efl_net_dialer_http_progress_download_get(job->input, &dn, &dt); efl_net_dialer_http_progress_upload_get(job->input, &un, &ut); ret = job->progress_cb((void *)job->data, file, dt, dn, ut, un); @@ -227,7 +227,7 @@ ecore_file_download_full(const char *url, EINA_SAFETY_ON_NULL_GOTO(job->input, error_input); job->output = efl_add(EFL_IO_FILE_CLASS, loop, - efl_file_set(efl_added, dst, NULL), + efl_file_set(efl_added, dst), efl_io_file_flags_set(efl_added, O_WRONLY | O_CREAT), efl_io_closer_close_on_exec_set(efl_added, EINA_TRUE), efl_io_closer_close_on_invalidate_set(efl_added, EINA_TRUE), @@ -309,7 +309,7 @@ ecore_file_download_abort(Ecore_File_Download_Job *job) return; } - efl_file_get(job->output, &file, NULL); + file = efl_file_get(job->output); DBG("Aborting download %s -> %s", efl_net_dialer_address_dial_get(job->input), file); -- cgit v1.2.1