forked from enlightenment/efl
parent
f6db68d6f5
commit
ef1e91430f
|
@ -569,3 +569,7 @@
|
|||
|
||||
* add support for GNUTLS 3.x.
|
||||
|
||||
2012-02-10 Cedric Bail
|
||||
|
||||
* add eet_dictionary_count.
|
||||
* add "eet -t FILE.EET".
|
||||
|
|
|
@ -10,6 +10,7 @@ Improvements:
|
|||
|
||||
* most allocations moved to mempools
|
||||
* support GNUTLS 3.x
|
||||
* add "eet -t FILE.EET" to get some stat out of an eet file
|
||||
|
||||
Eet 1.5.0
|
||||
|
||||
|
|
|
@ -68,6 +68,63 @@ do_eet_list(const char *file)
|
|||
eet_close(ef);
|
||||
} /* do_eet_list */
|
||||
|
||||
static void
|
||||
do_eet_stats(const char *file)
|
||||
{
|
||||
int i, num;
|
||||
int count[2] = { 0, 0 };
|
||||
int size[2] = { 0, 0 };
|
||||
char **list;
|
||||
Eet_File *ef;
|
||||
Eet_Dictionary *ed;
|
||||
|
||||
ef = eet_open(file, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
{
|
||||
ERR("cannot open for reading: %s", file);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
printf("*** sections stats ***\n");
|
||||
list = eet_list(ef, "*", &num);
|
||||
if (list)
|
||||
{
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
const void *ro = NULL;
|
||||
void *rw = NULL;
|
||||
int tsize;
|
||||
|
||||
ro = eet_read_direct(ef, list[i], &tsize);
|
||||
if (!ro) rw = eet_read(ef, list[i], &tsize);
|
||||
printf(rw ? "%s of size %i is compressed.\n" : "%s of size %i is not compressed.\n", list[i], tsize);
|
||||
count[rw ? 0 : 1]++;
|
||||
size[rw ? 0 : 1] += tsize;
|
||||
free(rw);
|
||||
}
|
||||
free(list);
|
||||
}
|
||||
|
||||
printf("*** dictionary ***\n");
|
||||
ed = eet_dictionary_get(ef);
|
||||
if (ed)
|
||||
{
|
||||
printf("%i strings inside the dictionary.\n", eet_dictionary_count(ed));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("no dictionary in this file.\n");
|
||||
}
|
||||
printf("*** global ***\n");
|
||||
printf("%i sections\n", num);
|
||||
printf("- %i of them are compressed (%02.2f%%) expanding in %i bytes.\n",
|
||||
count[0], (float) count[0] * 100 / (float) num, size[0]);
|
||||
printf("- %i of them are directly mappable in memory (%02.2f%%) representing %i bytes.\n",
|
||||
count[1], (float) count[1] * 100 / (float) num, size[1]);
|
||||
|
||||
eet_close(ef);
|
||||
}
|
||||
|
||||
static void
|
||||
do_eet_extract(const char *file,
|
||||
const char *key,
|
||||
|
@ -366,6 +423,7 @@ help:
|
|||
" eet -r FILE.EET KEY remove KEY in FILE.EET\n"
|
||||
" eet -c FILE.EET report and check the signature information of an eet file\n"
|
||||
" eet -s FILE.EET PRIVATE_KEY PUBLIC_KEY sign FILE.EET with PRIVATE_KEY and attach PUBLIC_KEY as it's certificate\n"
|
||||
" eet -t FILE.EET give some statistic about a file\n"
|
||||
);
|
||||
eet_shutdown();
|
||||
return -1;
|
||||
|
@ -437,6 +495,8 @@ help:
|
|||
do_eet_check(argv[2]);
|
||||
else if ((!strcmp(argv[1], "-s")) && (argc > 4))
|
||||
do_eet_sign(argv[2], argv[3], argv[4]);
|
||||
else if ((!strcmp(argv[1], "-t")) && (argc > 2))
|
||||
do_eet_stats(argv[2]);
|
||||
else
|
||||
goto help;
|
||||
|
||||
|
|
|
@ -644,6 +644,17 @@ EAPI int
|
|||
eet_dictionary_string_check(Eet_Dictionary *ed,
|
||||
const char *string);
|
||||
|
||||
/**
|
||||
* Return the number of strings inside a dictionary
|
||||
* @param ed A valid dictionary handle
|
||||
* @return the number of strings inside a dictionary
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @ingroup Eet_File_Group
|
||||
*/
|
||||
EAPI int
|
||||
eet_dictionary_count(const Eet_Dictionary *ed);
|
||||
|
||||
/**
|
||||
* Read a specified entry from an eet file and return data
|
||||
* @param ef A valid eet file handle opened for reading.
|
||||
|
|
|
@ -169,6 +169,12 @@ eet_dictionary_string_get_size(const Eet_Dictionary *ed,
|
|||
return 0;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
eet_dictionary_count(const Eet_Dictionary *ed)
|
||||
{
|
||||
return ed->count;
|
||||
}
|
||||
|
||||
int
|
||||
eet_dictionary_string_get_hash(const Eet_Dictionary *ed,
|
||||
int idx)
|
||||
|
|
Loading…
Reference in New Issue