diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2013-08-02 17:01:55 +0200 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2013-08-03 14:42:38 -0700 |
commit | 79bb6f0c99ceeeff529f07101edd47747d7b8e45 (patch) | |
tree | 3589c2a2265344d0aeeca07b13b538a6516c3575 /src | |
parent | 390a417ed5e04da48770ee4b7b1b310a758e5b9e (diff) | |
download | mirror-meh-79bb6f0c99ceeeff529f07101edd47747d7b8e45.tar.gz mirror-meh-79bb6f0c99ceeeff529f07101edd47747d7b8e45.tar.bz2 mirror-meh-79bb6f0c99ceeeff529f07101edd47747d7b8e45.zip |
hotfix for meh using giflib 5.x
Fixes #6
Diffstat (limited to 'src')
-rw-r--r-- | src/gif.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -32,7 +32,11 @@ static struct image *gif_open(FILE *f){ /* HACK HACK HACK */ rewind(f); lseek(fileno(f), 0L, SEEK_SET); +#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 + if(!(gif = DGifOpenFileHandle(fileno(f), NULL))){ +#else if(!(gif = DGifOpenFileHandle(fileno(f)))){ +#endif /* HACK AND HOPE */ rewind(f); lseek(fileno(f), 0L, SEEK_SET); @@ -55,8 +59,9 @@ static int gif_read(struct image *img){ struct gif_t *g = (struct gif_t *)img; GifColorType *colormap; SavedImage *s; + int ret; - if(DGifSlurp(g->gif) == GIF_ERROR) + if((ret = DGifSlurp(g->gif)) != GIF_OK) goto error; s = &g->gif->SavedImages[0]; @@ -79,8 +84,10 @@ static int gif_read(struct image *img){ return 0; error: -#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4) - fprintf(stderr, "%s\n", GifErrorString()); +#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 + fprintf(stderr, "GIFLIB: %s\n", GifErrorString(ret)); +#elif defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4) + fprintf(stderr, "GIFLIB: %s\n", GifErrorString()); #else PrintGifError(); #endif |