diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2013-05-15 05:21:07 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2013-05-15 05:24:08 -0700 |
commit | 6bb02ebe1b79ac6cdb92766526051902c8114e89 (patch) | |
tree | e36e62a0aad3966330587513a9f863f9c583e8e3 /src | |
parent | f3f8d7f3003d522007bcbeba55d200cccc691b58 (diff) | |
download | mirror-meh-6bb02ebe1b79ac6cdb92766526051902c8114e89.tar.gz mirror-meh-6bb02ebe1b79ac6cdb92766526051902c8114e89.tar.bz2 mirror-meh-6bb02ebe1b79ac6cdb92766526051902c8114e89.zip |
fix compilation with giflib >= 4.2.0
Diffstat (limited to 'src')
-rw-r--r-- | src/gif.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -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){ |