thumb: fix optimization conversion, move and free.

Summary:
fix image save (needs extension). use same extension (saves conversion).
fix free before use.

Reviewers: raster

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D5071
This commit is contained in:
Al Poole 2017-08-06 19:04:24 +09:00 committed by Carsten Haitzler (Rasterman)
parent b3cb2d20a7
commit 6e2b560ed4
1 changed files with 12 additions and 9 deletions

View File

@ -191,15 +191,18 @@ _local_artwork_poster(Evas_Object *win, const char *path_to_file)
Evas_Object *artwork = _media_artwork(em, path_to_file); Evas_Object *artwork = _media_artwork(em, path_to_file);
if (artwork) if (artwork)
{ {
char *path2 = alloca(strlen(path) + 4 + 1); const char *ext = strrchr(path, '.');
if (ext && (ext[0] && ext[1]))
sprintf(path2, "%s.tmp", path); {
evas_object_image_save(artwork, path2, NULL, NULL); char *path2 = alloca(strlen(path) + 4 + strlen(ext) + 1);
evas_object_del(artwork); sprintf(path2, "%s.tmp%s", path, ext);
free(path); evas_object_image_save(artwork, path2, NULL, NULL);
/* This speeds things up */ evas_object_del(artwork);
ecore_file_mv(path2, path); /* This speeds things up */
exit(0); ecore_file_mv(path2, path);
free(path);
exit(0);
}
} }
free(path); free(path);