eio: make eio_file_map_* api more usefull.
authorCedric BAIL <cedric.bail@free.fr>
Tue, 27 Dec 2011 16:45:07 +0000 (16:45 +0000)
committerCedric BAIL <cedric.bail@free.fr>
Tue, 27 Dec 2011 16:45:07 +0000 (16:45 +0000)
SVN revision: 66573

legacy/eio/src/lib/Eio.h
legacy/eio/src/lib/eio_map.c

index 51d83d9..a513eca 100644 (file)
@@ -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);
index 7245c45..d2c3600 100644 (file)
@@ -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,