exactness: handle error cases for saving an image
Handle the error case and propagate the error upwards. CID: 1419855 Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11428
This commit is contained in:
parent
62039e6199
commit
07d826ccbf
|
@ -94,18 +94,21 @@ _image_load(const char *filename)
|
||||||
return ex_img;
|
return ex_img;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_image_save(Exactness_Image *ex_img, const char *output)
|
_image_save(Exactness_Image *ex_img, const char *output)
|
||||||
{
|
{
|
||||||
Ecore_Evas *ee;
|
Ecore_Evas *ee;
|
||||||
Eo *e, *img;
|
Eo *e, *img;
|
||||||
|
Eina_Bool ret = EINA_TRUE;
|
||||||
ee = ecore_evas_new(NULL, 0, 0, 100, 100, NULL);
|
ee = ecore_evas_new(NULL, 0, 0, 100, 100, NULL);
|
||||||
e = ecore_evas_get(ee);
|
e = ecore_evas_get(ee);
|
||||||
img = evas_object_image_add(e);
|
img = evas_object_image_add(e);
|
||||||
evas_object_image_size_set(img, ex_img->w, ex_img->h);
|
evas_object_image_size_set(img, ex_img->w, ex_img->h);
|
||||||
evas_object_image_data_set(img, ex_img->pixels);
|
evas_object_image_data_set(img, ex_img->pixels);
|
||||||
evas_object_image_save(img, output, NULL, NULL);
|
if (!evas_object_image_save(img, output, NULL, NULL))
|
||||||
|
ret = EINA_FALSE;
|
||||||
ecore_evas_free(ee);
|
ecore_evas_free(ee);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -125,10 +128,12 @@ _file_compare(const char *orig_dir, const char *ent_name)
|
||||||
{
|
{
|
||||||
char *buf = alloca(strlen(_dest_dir) + strlen(ent_name));
|
char *buf = alloca(strlen(_dest_dir) + strlen(ent_name));
|
||||||
sprintf(buf, "%s/%s/comp_%s", _dest_dir, CURRENT_SUBDIR, ent_name);
|
sprintf(buf, "%s/%s/comp_%s", _dest_dir, CURRENT_SUBDIR, ent_name);
|
||||||
_image_save(imgO, buf);
|
if (!_image_save(imgO, buf))
|
||||||
|
goto cleanup;
|
||||||
_compare_errors = eina_list_append(_compare_errors, strdup(ent_name));
|
_compare_errors = eina_list_append(_compare_errors, strdup(ent_name));
|
||||||
result = EINA_TRUE;
|
result = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
cleanup:
|
||||||
exactness_image_free(img1);
|
exactness_image_free(img1);
|
||||||
exactness_image_free(img2);
|
exactness_image_free(img2);
|
||||||
exactness_image_free(imgO);
|
exactness_image_free(imgO);
|
||||||
|
|
Loading…
Reference in New Issue