From 70b7b55c4293ee1d7a31df14299850949fe3e6ac Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 27 Dec 2011 16:45:07 +0000 Subject: [PATCH] eio: make eio_file_map_* api more usefull. SVN revision: 66573 --- legacy/eio/src/lib/Eio.h | 4 ++-- legacy/eio/src/lib/eio_map.c | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/legacy/eio/src/lib/Eio.h b/legacy/eio/src/lib/Eio.h index 51d83d93ad..a513ecab59 100644 --- a/legacy/eio/src/lib/Eio.h +++ b/legacy/eio/src/lib/Eio.h @@ -124,8 +124,8 @@ typedef void (*Eio_Stat_Cb)(void *data, Eio_File *handler, const struct stat *st typedef void (*Eio_Progress_Cb)(void *data, Eio_File *handler, const Eio_Progress *info); typedef void (*Eio_Open_Cb)(void *data, Eio_File *handler, Eina_File *file); -typedef Eina_Bool (*Eio_Filter_Map_Cb)(void *data, Eio_File *handler, void *map); -typedef void (*Eio_Map_Cb)(void *data, Eio_File *handler, void *map); + typedef Eina_Bool (*Eio_Filter_Map_Cb)(void *data, Eio_File *handler, void *map, size_t length); + typedef void (*Eio_Map_Cb)(void *data, Eio_File *handler, void *map, size_t length); typedef void (*Eio_Done_Data_Cb)(void *data, Eio_File *handler, const char *xattr_data, unsigned int xattr_size); typedef void (*Eio_Done_String_Cb)(void *data, Eio_File *handler, const char *xattr_string); diff --git a/legacy/eio/src/lib/eio_map.c b/legacy/eio/src/lib/eio_map.c index 7245c4595c..d2c36006cd 100644 --- a/legacy/eio/src/lib/eio_map.c +++ b/legacy/eio/src/lib/eio_map.c @@ -101,7 +101,8 @@ _eio_file_map_all_job(void *data, Ecore_Thread *thread) { if (!map->filter_cb((void*) map->common.data, &map->common, - map->result)) + map->result, + map->length)) { eina_file_map_free(map->common.container, map->result); map->result = NULL; @@ -123,7 +124,8 @@ _eio_file_map_new_job(void *data, Ecore_Thread *thread) { if (!map->filter_cb((void*) map->common.data, &map->common, - map->result)) + map->result, + map->length)) { eina_file_map_free(map->common.container, map->result); map->result = NULL; @@ -139,7 +141,7 @@ _eio_file_map_end(void *data, Ecore_Thread *thread __UNUSED__) { Eio_File_Map_Rule *map = data; - map->map_cb((void*) map->common.data, &map->common, map->result); + map->map_cb((void*) map->common.data, &map->common, map->result, map->length); free(map); } @@ -258,6 +260,7 @@ eio_file_map_all(Eina_File *f, map->map_cb = map_cb; map->rule = rule; map->result = NULL; + map->length = eina_file_size_get(f); if (!eio_file_set(&map->common, NULL,