| @@ -60,7 +60,7 @@ void img_init(img_t *img, win_t *win) { |
| 60 | 60 | | } |
| 61 | 61 | | |
| 62 | 62 | | #ifdef HAVE_GIFLIB |
| 63 | | − | /* originally based on, but in it's current form merely inspired by Imlib2's |
| 63 | + | /* Originally based on, but in its current form merely inspired by Imlib2's |
| 64 | 64 | | * src/modules/loaders/loader_gif.c:load(), written by Carsten Haitzler. |
| 65 | 65 | | */ |
| 66 | 66 | | int img_load_gif(img_t *img, const fileinfo_t *file) { |
| @@ -97,7 +97,6 @@ int img_load_gif(img_t *img, const fileinfo_t *file) { |
| 97 | 97 | | |
| 98 | 98 | | do { |
| 99 | 99 | | if (DGifGetRecordType(gif, &rec) == GIF_ERROR) { |
| 100 | | − | warn("could not open gif file: %s", file->name); |
| 101 | 100 | | err = 1; |
| 102 | 101 | | break; |
| 103 | 102 | | } |
| @@ -122,7 +121,6 @@ int img_load_gif(img_t *img, const fileinfo_t *file) { |
| 122 | 121 | | } |
| 123 | 122 | | } else if (rec == IMAGE_DESC_RECORD_TYPE) { |
| 124 | 123 | | if (DGifGetImageDesc(gif) == GIF_ERROR) { |
| 125 | | − | warn("could not open gif frame # %d: %s", img->multi.cnt, file->name); |
| 126 | 124 | | err = 1; |
| 127 | 125 | | break; |
| 128 | 126 | | } |
| @@ -181,7 +179,6 @@ int img_load_gif(img_t *img, const fileinfo_t *file) { |
| 181 | 179 | | free(data); |
| 182 | 180 | | |
| 183 | 181 | | if (!im) { |
| 184 | | − | warn("could not open gif frame # %d: %s", img->multi.cnt, file->name); |
| 185 | 182 | | err = 1; |
| 186 | 183 | | break; |
| 187 | 184 | | } |
| @@ -207,16 +204,17 @@ int img_load_gif(img_t *img, const fileinfo_t *file) { |
| 207 | 204 | | |
| 208 | 205 | | DGifCloseFile(gif); |
| 209 | 206 | | |
| 210 | | − | if (!err && img->multi.cnt > 1) { |
| 207 | + | if (err && !file->loaded) |
| 208 | + | warn("corrupted gif file: %s", file->name); |
| 209 | + | |
| 210 | + | if (img->multi.cnt > 1) { |
| 211 | 211 | | imlib_context_set_image(img->im); |
| 212 | 212 | | imlib_free_image(); |
| 213 | 213 | | img->im = img->multi.frames[0].im; |
| 214 | 214 | | img->multi.animate = GIF_AUTOPLAY; |
| 215 | | − | } else { |
| 216 | | − | for (i = 0; i < img->multi.cnt; i++) { |
| 217 | | − | imlib_context_set_image(img->multi.frames[i].im); |
| 218 | | − | imlib_free_image(); |
| 219 | | − | } |
| 215 | + | } else if (img->multi.cnt == 1) { |
| 216 | + | imlib_context_set_image(img->multi.frames[0].im); |
| 217 | + | imlib_free_image(); |
| 220 | 218 | | img->multi.cnt = 0; |
| 221 | 219 | | img->multi.animate = 0; |
| 222 | 220 | | } |