exactness: handle case where eet_data_image_write() fails

We never checked how many bytes had been written. Check on return and
propagate error upwards to caller.

CID: 1419856

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11724
This commit is contained in:
Stefan Schmidt 2020-04-17 14:06:57 +02:00
parent 000464c842
commit c80b0b1360
1 changed files with 11 additions and 4 deletions

View File

@ -339,6 +339,9 @@ exactness_unit_file_write(Exactness_Unit *unit, const char *filename)
Exactness_Image *ex_img;
Eet_File *file;
int i = 1;
int bytes;
Eina_Bool ret = EINA_TRUE;
eet_init();
file = eet_open(filename, EET_FILE_MODE_WRITE);
eet_data_write(file, _unit_desc_make(), "cache", unit, EINA_TRUE);
@ -346,13 +349,17 @@ exactness_unit_file_write(Exactness_Unit *unit, const char *filename)
{
char entry[32];
sprintf(entry, "images/%d", i++);
eet_data_image_write(file, entry,
ex_img->pixels, ex_img->w, ex_img->h, 0xFF,
0, 100, EET_IMAGE_LOSSLESS);
bytes = eet_data_image_write(file, entry, ex_img->pixels, ex_img->w, ex_img->h, 0xFF,
0, 100, EET_IMAGE_LOSSLESS);
if (bytes == 0)
{
ret = EINA_FALSE;
break;
}
}
eet_close(file);
eet_shutdown();
return EINA_TRUE;
return ret;
}
Eina_Bool