summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authortsauerbeck <tsauerbeck>2005-07-15 20:37:29 +0000
committertsauerbeck <tsauerbeck@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2005-07-15 20:37:29 +0000
commit216c51ea319cf137a0446e0c89efe593132dfe4c (patch)
tree4d4142f65a16cce098951d4829d8f280384dd4dc /legacy
parent63c5d7586c3b99b83c37fc7a8ef9a3790e847a4a (diff)
added eet_num_entries()
SVN revision: 15785
Diffstat (limited to 'legacy')
-rw-r--r--legacy/eet/src/lib/Eet.h8
-rw-r--r--legacy/eet/src/lib/eet_lib.c28
2 files changed, 36 insertions, 0 deletions
diff --git a/legacy/eet/src/lib/Eet.h b/legacy/eet/src/lib/Eet.h
index 9f4923f0d5..c79a436516 100644
--- a/legacy/eet/src/lib/Eet.h
+++ b/legacy/eet/src/lib/Eet.h
@@ -243,6 +243,14 @@ extern "C" {
243 */ 243 */
244 EAPI char **eet_list (Eet_File *ef, char *glob, int *count_ret); 244 EAPI char **eet_list (Eet_File *ef, char *glob, int *count_ret);
245 245
246 /**
247 * Return the number of entries in the specified eet file.
248 * @param ef A valid eet file handle.
249 * @return Number of entries in ef or -1 if the number of entries
250 * cannot be read due to open mode restrictions.
251 */
252 EAPI int eet_num_entries(Eet_File *ef);
253
246/***************************************************************************/ 254/***************************************************************************/
247 255
248 /** 256 /**
diff --git a/legacy/eet/src/lib/eet_lib.c b/legacy/eet/src/lib/eet_lib.c
index a60442d9f4..95c11db6a1 100644
--- a/legacy/eet/src/lib/eet_lib.c
+++ b/legacy/eet/src/lib/eet_lib.c
@@ -1040,6 +1040,34 @@ eet_list(Eet_File *ef, char *glob, int *count_ret)
1040 return list_ret; 1040 return list_ret;
1041} 1041}
1042 1042
1043int
1044eet_num_entries(Eet_File *ef)
1045{
1046 int i, num, ret = 0;
1047 Eet_File_Node *efn;
1048
1049 /* check to see its' an eet file pointer */
1050 if ((!ef) || (ef->magic != EET_MAGIC_FILE) ||
1051 (!ef->header) || (!ef->header->directory) ||
1052 ((ef->mode != EET_FILE_MODE_READ) &&
1053 (ef->mode != EET_FILE_MODE_READ_WRITE)))
1054 {
1055 return -1;
1056 }
1057
1058 /* loop through all entries */
1059 num = (1 << ef->header->directory->size);
1060 for (i = 0; i < num; i++)
1061 {
1062 for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next)
1063 {
1064 ret++;
1065 }
1066 }
1067
1068 return ret;
1069}
1070
1043int eet_init(void) 1071int eet_init(void)
1044{ 1072{
1045 return ++eet_initcount; 1073 return ++eet_initcount;