diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-04-07 12:21:01 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-04-07 12:21:01 +0200 |
commit | 13f16feb81a8fd2510a406138971bd9a5db192b0 (patch) | |
tree | 61c31f006bcf35de843f2673c2b82c9d97581fc8 | |
parent | b59da43c99019232ae9f7b7e67d722b38f43b24c (diff) |
fix gib_imlib_save_image_with_error_return in imported giblib code
-rw-r--r-- | src/feh.h | 2 | ||||
-rw-r--r-- | src/gib_imlib.c | 23 | ||||
-rw-r--r-- | src/imlib.c | 28 | ||||
-rw-r--r-- | src/index.c | 2 | ||||
-rw-r--r-- | src/slideshow.c | 2 | ||||
-rw-r--r-- | src/thumbnail.c | 2 |
6 files changed, 20 insertions, 39 deletions
@@ -162,8 +162,6 @@ void feh_reload_image(winwidget w, int resize, int force_new); void feh_filelist_image_remove(winwidget winwid, char do_delete); void feh_imlib_print_load_error(char *file, winwidget w, Imlib_Load_Error err); void slideshow_save_image(winwidget win); -void ungib_imlib_save_image_with_error_return(Imlib_Image im, char *file, - Imlib_Load_Error * error_return); void feh_edit_inplace(winwidget w, int orientation); void feh_edit_inplace_lossless(winwidget w, int orientation); gib_list *feh_wrap_string(char *text, int wrap_width, Imlib_Font fn, gib_style * style); diff --git a/src/gib_imlib.c b/src/gib_imlib.c index b53b1cc..8f401aa 100644 --- a/src/gib_imlib.c +++ b/src/gib_imlib.c @@ -527,13 +527,22 @@ void gib_imlib_save_image_with_error_return(Imlib_Image im, char *file, Imlib_Load_Error * error_return) { - char *tmp; - - imlib_context_set_image(im); - tmp = strrchr(file, '.'); - if (tmp) - imlib_image_set_format(tmp + 1); - imlib_save_image_with_error_return(file, error_return); + char *tmp; + + imlib_context_set_image(im); + tmp = strrchr(file, '.'); + if (tmp) { + char *p, *pp; + p = estrdup(tmp + 1); + pp = p; + while(*pp) { + *pp = tolower(*pp); + pp++; + } + imlib_image_set_format(p); + free(p); + } + imlib_save_image_with_error_return(file, error_return); } void diff --git a/src/imlib.c b/src/imlib.c index b3bf04b..10ab718 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -148,32 +148,6 @@ int feh_load_image_char(Imlib_Image * im, char *filename) return(i); } -/* - * XXX gib_imlib_save_image_with_error_return breaks with *.END and - * similar because it tries to set the image format, which only works - * with .end . - * So we leave that part out. - */ -void ungib_imlib_save_image_with_error_return(Imlib_Image im, char *file, - Imlib_Load_Error * error_return) -{ - char *tmp; - imlib_context_set_image(im); - tmp = strrchr(file, '.'); - if (tmp) { - char *p, *pp; - p = estrdup(tmp + 1); - pp = p; - while(*pp) { - *pp = tolower(*pp); - pp++; - } - imlib_image_set_format(p); - free(p); - } - imlib_save_image_with_error_return(file, error_return); -} - void feh_imlib_print_load_error(char *file, winwidget w, Imlib_Load_Error err) { if (err == IMLIB_LOAD_ERROR_OUT_OF_FILE_DESCRIPTORS) @@ -1055,7 +1029,7 @@ void feh_edit_inplace(winwidget w, int op) imlib_image_flip_horizontal(); } else gib_imlib_image_orientate(old, op); - ungib_imlib_save_image_with_error_return(old, + gib_imlib_save_image_with_error_return(old, FEH_FILE(w->file->data)->filename, &err); gib_imlib_free_image(old); if (err) diff --git a/src/index.c b/src/index.c index db2c9d2..a71744d 100644 --- a/src/index.c +++ b/src/index.c @@ -327,7 +327,7 @@ void init_index_mode(void) else strncpy(output_buf, opt.output_file, 1024); - ungib_imlib_save_image_with_error_return(im_main, output_buf, &err); + gib_imlib_save_image_with_error_return(im_main, output_buf, &err); if (err) { feh_imlib_print_load_error(output_buf, im_main, err); } diff --git a/src/slideshow.c b/src/slideshow.c index 08db2cb..e42bd23 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -664,7 +664,7 @@ void slideshow_save_image(winwidget win) if (opt.verbose) fprintf(stderr, "saving image to filename '%s'\n", tmpname); - ungib_imlib_save_image_with_error_return(win->im, tmpname, &err); + gib_imlib_save_image_with_error_return(win->im, tmpname, &err); if (err) feh_imlib_print_load_error(tmpname, win, err); diff --git a/src/thumbnail.c b/src/thumbnail.c index 1719fdc..c806ce4 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -382,7 +382,7 @@ void init_thumbnail_mode(void) snprintf(output_buf, 1024, "%s/%s", opt.output_dir, opt.output_file); else strncpy(output_buf, opt.output_file, 1024); - ungib_imlib_save_image_with_error_return(td.im_main, output_buf, &err); + gib_imlib_save_image_with_error_return(td.im_main, output_buf, &err); if (err) { feh_imlib_print_load_error(output_buf, td.im_main, err); } |