Revert "eet: do not load data when the file is open in read/write mode."

This reverts commit f8b0322704.

this breaks efreets icon cache. i have been noticing this since
yesterday across all my machines once i update just efl. i tracked it
down to this commit.
This commit is contained in:
Carsten Haitzler 2014-01-21 09:18:52 +09:00
parent 1a9ebc02c0
commit 414b447f54
1 changed files with 10 additions and 8 deletions

View File

@ -482,12 +482,7 @@ eet_flush2(Eet_File *ef)
{
for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next)
{
if (efn->data)
{
if (fwrite(efn->data, efn->size, 1, fp) != 1)
goto write_error;
}
else if (fwrite(ef->data + efn->offset, efn->size, 1, fp) != 1)
if (fwrite(efn->data, efn->size, 1, fp) != 1)
goto write_error;
}
}
@ -909,8 +904,15 @@ eet_internal_read2(Eet_File *ef)
efn->next = ef->header->directory->nodes[hash];
ef->header->directory->nodes[hash] = efn;
/* There is no need to load data at this stage */
efn->data = NULL;
/* read-only mode, so currently we have no data loaded */
if (ef->mode == EET_FILE_MODE_READ)
efn->data = NULL; /* read-write mode - read everything into ram */
else
{
efn->data = malloc(efn->size);
if (efn->data)
memcpy(efn->data, ef->data + efn->offset, efn->size);
}
/* compute the possible position of a signature */
if (signature_base_offset < efn->offset + efn->size)