summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2020-02-26 15:02:23 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2020-02-27 15:58:29 +0100
commit07d826ccbfa6d47aad790397bf23376bb4349e75 (patch)
tree1c77fd73cb8eb0a06b468e3bb2a6aac93a27587f /src/bin
parent62039e61992eadccf4d396e2bc5cba6624309fae (diff)
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
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/exactness/exactness.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bin/exactness/exactness.c b/src/bin/exactness/exactness.c
index 637d60cf8b..04301f5fd2 100644
--- a/src/bin/exactness/exactness.c
+++ b/src/bin/exactness/exactness.c
@@ -94,18 +94,21 @@ _image_load(const char *filename)
94 return ex_img; 94 return ex_img;
95} 95}
96 96
97static void 97static Eina_Bool
98_image_save(Exactness_Image *ex_img, const char *output) 98_image_save(Exactness_Image *ex_img, const char *output)
99{ 99{
100 Ecore_Evas *ee; 100 Ecore_Evas *ee;
101 Eo *e, *img; 101 Eo *e, *img;
102 Eina_Bool ret = EINA_TRUE;
102 ee = ecore_evas_new(NULL, 0, 0, 100, 100, NULL); 103 ee = ecore_evas_new(NULL, 0, 0, 100, 100, NULL);
103 e = ecore_evas_get(ee); 104 e = ecore_evas_get(ee);
104 img = evas_object_image_add(e); 105 img = evas_object_image_add(e);
105 evas_object_image_size_set(img, ex_img->w, ex_img->h); 106 evas_object_image_size_set(img, ex_img->w, ex_img->h);
106 evas_object_image_data_set(img, ex_img->pixels); 107 evas_object_image_data_set(img, ex_img->pixels);
107 evas_object_image_save(img, output, NULL, NULL); 108 if (!evas_object_image_save(img, output, NULL, NULL))
109 ret = EINA_FALSE;
108 ecore_evas_free(ee); 110 ecore_evas_free(ee);
111 return ret;
109} 112}
110 113
111static Eina_Bool 114static Eina_Bool
@@ -125,10 +128,12 @@ _file_compare(const char *orig_dir, const char *ent_name)
125 { 128 {
126 char *buf = alloca(strlen(_dest_dir) + strlen(ent_name)); 129 char *buf = alloca(strlen(_dest_dir) + strlen(ent_name));
127 sprintf(buf, "%s/%s/comp_%s", _dest_dir, CURRENT_SUBDIR, ent_name); 130 sprintf(buf, "%s/%s/comp_%s", _dest_dir, CURRENT_SUBDIR, ent_name);
128 _image_save(imgO, buf); 131 if (!_image_save(imgO, buf))
132 goto cleanup;
129 _compare_errors = eina_list_append(_compare_errors, strdup(ent_name)); 133 _compare_errors = eina_list_append(_compare_errors, strdup(ent_name));
130 result = EINA_TRUE; 134 result = EINA_TRUE;
131 } 135 }
136cleanup:
132 exactness_image_free(img1); 137 exactness_image_free(img1);
133 exactness_image_free(img2); 138 exactness_image_free(img2);
134 exactness_image_free(imgO); 139 exactness_image_free(imgO);