evas: actually check if loading header was fine.

SVN revision: 59232
This commit is contained in:
Cedric BAIL 2011-05-06 09:01:18 +00:00
parent 139e49792d
commit ba96d1220f
1 changed files with 5 additions and 4 deletions

View File

@ -141,6 +141,7 @@ evas_image_load_file_head_psd(Image_Entry *ie, const char *FileName,
{ {
FILE *f; FILE *f;
PSD_Header header; PSD_Header header;
Eina_Bool correct;
*error = EVAS_LOAD_ERROR_NONE; *error = EVAS_LOAD_ERROR_NONE;
@ -150,10 +151,10 @@ evas_image_load_file_head_psd(Image_Entry *ie, const char *FileName,
*error = EVAS_LOAD_ERROR_DOES_NOT_EXIST; *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
return EINA_FALSE; return EINA_FALSE;
} }
psd_get_header(&header, f); correct = psd_get_header(&header, f);
fclose(f); fclose(f);
if (!is_psd(&header)) if (!correct || !is_psd(&header))
{ {
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
return EINA_FALSE; return EINA_FALSE;
@ -846,9 +847,9 @@ evas_image_load_file_data_psd(Image_Entry *ie,
return bpsd; return bpsd;
} }
psd_get_header(&header, f); if (!psd_get_header(&header, f) || !is_psd(&header))
if (!is_psd(&header))
{ {
fclose(f);
*error = EVAS_LOAD_ERROR_GENERIC; *error = EVAS_LOAD_ERROR_GENERIC;
return EINA_FALSE; return EINA_FALSE;
} }