Enlightenment CVS committal

Author  : tsauerbeck
Project : e17
Module  : libs/eet

Dir     : e17/libs/eet/src/lib


Modified Files:
        Eet.h eet_lib.c 


Log Message:
added eet_num_entries()
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/eet/src/lib/Eet.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- Eet.h       23 May 2005 04:32:03 -0000      1.23
+++ Eet.h       15 Jul 2005 20:37:29 -0000      1.24
@@ -243,6 +243,14 @@
     */
    EAPI char    **eet_list  (Eet_File *ef, char *glob, int *count_ret);
 
+   /**
+    * Return the number of entries in the specified eet file.
+    * @param ef A valid eet file handle.
+    * @return Number of entries in ef or -1 if the number of entries
+    *         cannot be read due to open mode restrictions.
+    */
+   EAPI int       eet_num_entries(Eet_File *ef);
+
 /***************************************************************************/
 
    /**
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/eet/src/lib/eet_lib.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -3 -r1.45 -r1.46
--- eet_lib.c   14 Jul 2005 16:51:28 -0000      1.45
+++ eet_lib.c   15 Jul 2005 20:37:29 -0000      1.46
@@ -1040,6 +1040,34 @@
    return list_ret;
 }
 
+int
+eet_num_entries(Eet_File *ef)
+{
+   int i, num, ret = 0;
+   Eet_File_Node *efn;
+
+   /* check to see its' an eet file pointer */
+   if ((!ef) || (ef->magic != EET_MAGIC_FILE) ||
+       (!ef->header) || (!ef->header->directory) ||
+       ((ef->mode != EET_FILE_MODE_READ) &&
+        (ef->mode != EET_FILE_MODE_READ_WRITE)))
+     {
+       return -1;
+     }
+
+   /* loop through all entries */
+   num = (1 << ef->header->directory->size);
+   for (i = 0; i < num; i++)
+     {
+       for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next)
+         {
+            ret++;
+         }
+     }
+
+   return ret;
+}
+
 int eet_init(void)
 {
    return ++eet_initcount;




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to