aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2013-05-15 05:21:07 -0700
committerJohn Hawthorn <john.hawthorn@gmail.com>2013-05-15 05:24:08 -0700
commit6bb02ebe1b79ac6cdb92766526051902c8114e89 (patch)
treee36e62a0aad3966330587513a9f863f9c583e8e3
parentf3f8d7f3003d522007bcbeba55d200cccc691b58 (diff)
downloadmirror-meh-6bb02ebe1b79ac6cdb92766526051902c8114e89.tar.gz
mirror-meh-6bb02ebe1b79ac6cdb92766526051902c8114e89.tar.bz2
mirror-meh-6bb02ebe1b79ac6cdb92766526051902c8114e89.zip
fix compilation with giflib >= 4.2.0
-rw-r--r--src/gif.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gif.c b/src/gif.c
index 7c55209..61b30a9 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -56,10 +56,8 @@ static int gif_read(struct image *img){
GifColorType *colormap;
SavedImage *s;
- if(DGifSlurp(g->gif) == GIF_ERROR){
- PrintGifError();
- return 1;
- }
+ if(DGifSlurp(g->gif) == GIF_ERROR)
+ goto error;
s = &g->gif->SavedImages[0];
@@ -67,10 +65,8 @@ static int gif_read(struct image *img){
colormap = s->ImageDesc.ColorMap->Colors;
else if(g->gif->SColorMap)
colormap = g->gif->SColorMap->Colors;
- else{
- PrintGifError();
- return 1;
- }
+ else
+ goto error;
for(i = 0; i < img->bufwidth * img->bufheight; i++){
unsigned char idx = s->RasterBits[i];
@@ -82,6 +78,13 @@ static int gif_read(struct image *img){
img->state |= LOADED | SLOWLOADED;
return 0;
+error:
+#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4)
+ fprintf(stderr, "%s\n", GifErrorString());
+#else
+ PrintGifError();
+#endif
+ return 1;
}
void gif_close(struct image *img){