forked from enlightenment/efl
eet: reduce memory usage of Eet internal structure by removing useless structure.
This commit is contained in:
parent
c85414b157
commit
00d4f5cf1c
|
@ -117,10 +117,7 @@ struct _Eet_File_Node
|
||||||
void *data;
|
void *data;
|
||||||
Eet_File_Node *next; /* FIXME: make buckets linked lists */
|
Eet_File_Node *next; /* FIXME: make buckets linked lists */
|
||||||
|
|
||||||
unsigned long int offset;
|
unsigned int offset;
|
||||||
unsigned long int dictionary_offset;
|
|
||||||
unsigned long int name_offset;
|
|
||||||
|
|
||||||
unsigned int name_size;
|
unsigned int name_size;
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
unsigned int data_size;
|
unsigned int data_size;
|
||||||
|
|
|
@ -387,27 +387,6 @@ eet_flush2(Eet_File *ef)
|
||||||
bytes_dictionary_entries = EET_FILE2_DICTIONARY_ENTRY_SIZE *
|
bytes_dictionary_entries = EET_FILE2_DICTIONARY_ENTRY_SIZE *
|
||||||
num_dictionary_entries;
|
num_dictionary_entries;
|
||||||
|
|
||||||
/* calculate per entry offset */
|
|
||||||
strings_offset = bytes_directory_entries + bytes_dictionary_entries;
|
|
||||||
data_offset = bytes_directory_entries + bytes_dictionary_entries +
|
|
||||||
bytes_strings;
|
|
||||||
|
|
||||||
for (i = 0; i < num; ++i)
|
|
||||||
{
|
|
||||||
for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next)
|
|
||||||
{
|
|
||||||
efn->offset = data_offset;
|
|
||||||
data_offset += efn->size;
|
|
||||||
|
|
||||||
efn->name_offset = strings_offset;
|
|
||||||
strings_offset += efn->name_size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* calculate dictionary strings offset */
|
|
||||||
if (ef->ed)
|
|
||||||
ef->ed->offset = strings_offset;
|
|
||||||
|
|
||||||
/* go thru and write the header */
|
/* go thru and write the header */
|
||||||
head[0] = (int)htonl((unsigned int)EET_MAGIC_FILE2);
|
head[0] = (int)htonl((unsigned int)EET_MAGIC_FILE2);
|
||||||
head[1] = (int)htonl((unsigned int)num_directory_entries);
|
head[1] = (int)htonl((unsigned int)num_directory_entries);
|
||||||
|
@ -417,6 +396,11 @@ eet_flush2(Eet_File *ef)
|
||||||
if (fwrite(head, sizeof (head), 1, fp) != 1)
|
if (fwrite(head, sizeof (head), 1, fp) != 1)
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
|
/* calculate per entry base offset */
|
||||||
|
strings_offset = bytes_directory_entries + bytes_dictionary_entries;
|
||||||
|
data_offset = bytes_directory_entries + bytes_dictionary_entries +
|
||||||
|
bytes_strings;
|
||||||
|
|
||||||
/* write directories entry */
|
/* write directories entry */
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
|
@ -428,13 +412,18 @@ eet_flush2(Eet_File *ef)
|
||||||
flag = (efn->alias << 2) | (efn->ciphered << 1) | efn->compression;
|
flag = (efn->alias << 2) | (efn->ciphered << 1) | efn->compression;
|
||||||
flag |= efn->compression_type << 3;
|
flag |= efn->compression_type << 3;
|
||||||
|
|
||||||
ibuf[0] = (int)htonl((unsigned int)efn->offset);
|
efn->offset = data_offset;
|
||||||
|
|
||||||
|
ibuf[0] = (int)htonl((unsigned int)data_offset);
|
||||||
ibuf[1] = (int)htonl((unsigned int)efn->size);
|
ibuf[1] = (int)htonl((unsigned int)efn->size);
|
||||||
ibuf[2] = (int)htonl((unsigned int)efn->data_size);
|
ibuf[2] = (int)htonl((unsigned int)efn->data_size);
|
||||||
ibuf[3] = (int)htonl((unsigned int)efn->name_offset);
|
ibuf[3] = (int)htonl((unsigned int)strings_offset);
|
||||||
ibuf[4] = (int)htonl((unsigned int)efn->name_size);
|
ibuf[4] = (int)htonl((unsigned int)efn->name_size);
|
||||||
ibuf[5] = (int)htonl((unsigned int)flag);
|
ibuf[5] = (int)htonl((unsigned int)flag);
|
||||||
|
|
||||||
|
strings_offset += efn->name_size;
|
||||||
|
data_offset += efn->size;
|
||||||
|
|
||||||
if (fwrite(ibuf, sizeof(ibuf), 1, fp) != 1)
|
if (fwrite(ibuf, sizeof(ibuf), 1, fp) != 1)
|
||||||
goto write_error;
|
goto write_error;
|
||||||
}
|
}
|
||||||
|
@ -445,6 +434,9 @@ eet_flush2(Eet_File *ef)
|
||||||
{
|
{
|
||||||
int offset = strings_offset;
|
int offset = strings_offset;
|
||||||
|
|
||||||
|
/* calculate dictionary strings offset */
|
||||||
|
ef->ed->offset = strings_offset;
|
||||||
|
|
||||||
for (j = 0; j < ef->ed->count; ++j)
|
for (j = 0; j < ef->ed->count; ++j)
|
||||||
{
|
{
|
||||||
int sbuf[EET_FILE2_DICTIONARY_ENTRY_COUNT];
|
int sbuf[EET_FILE2_DICTIONARY_ENTRY_COUNT];
|
||||||
|
|
Loading…
Reference in New Issue