---- fontforge-20120731-b/gutils/gimagereadgif.c~ 2012-08-02 17:09:09.000000000 +0200
-+++ fontforge-20120731-b/gutils/gimagereadgif.c 2015-05-10 14:11:16.818633712 +0200
-@@ -42,9 +42,14 @@
- #include <gif_lib.h>
-
- static DL_CONST void *libgif=NULL;
-+#if GIFLIB_MAJOR >= 5
-+static GifFileType *(*_DGifOpenFileName)(char *, int *);
-+static int (*_DGifCloseFile)(GifFileType *, int *);
-+#else
- static GifFileType *(*_DGifOpenFileName)(char *);
--static int (*_DGifSlurp)(GifFileType *);
- static int (*_DGifCloseFile)(GifFileType *);
-+#endif
-+static int (*_DGifSlurp)(GifFileType *);
-
- static int loadgif() {
- char *err;
-@@ -56,9 +61,14 @@
- fprintf(stderr,"%s\n", dlerror());
- return( 0 );
- }
-+#if GIFLIB_MAJOR >= 5
-+ _DGifOpenFileName = (GifFileType *(*)(char *, int *)) dlsym(libgif,"DGifOpenFileName");
-+ _DGifCloseFile = (int (*)(GifFileType *, int *)) dlsym(libgif,"DGifCloseFile");
-+#else
- _DGifOpenFileName = (GifFileType *(*)(char *)) dlsym(libgif,"DGifOpenFileName");
-- _DGifSlurp = (int (*)(GifFileType *)) dlsym(libgif,"DGifSlurp");
- _DGifCloseFile = (int (*)(GifFileType *)) dlsym(libgif,"DGifCloseFile");
-+#endif
-+ _DGifSlurp = (int (*)(GifFileType *)) dlsym(libgif,"DGifSlurp");
- if ( _DGifOpenFileName && _DGifSlurp && _DGifCloseFile )
- return( 1 );
- dlclose(libgif);
-@@ -132,13 +142,21 @@
- if ( !loadgif())
- return( NULL );
-
-+#if GIFLIB_MAJOR >= 5
-+ if ((gif = _DGifOpenFileName(filename, NULL)) == NULL) {
-+#else
- if ((gif = _DGifOpenFileName(filename)) == NULL) {
-+#endif
- fprintf( stderr, "can't open %s\n", filename);
- return( NULL );
- }
-
- if ( _DGifSlurp(gif)==GIF_ERROR ) {
-+#if GIFLIB_MAJOR >= 5
-+ _DGifCloseFile(gif, NULL);
-+#else
- _DGifCloseFile(gif);
-+#endif
- fprintf( stderr, "Bad gif file %s\n", filename );
- return( NULL );
- }
-@@ -150,7 +168,11 @@
- ret = images[0];
- else
- ret = GImageCreateAnimation(images,gif->ImageCount);
-+#if GIFLIB_MAJOR >= 5
-+ _DGifCloseFile(gif, NULL);
-+#else
- _DGifCloseFile(gif);
-+#endif
- free(images);
- return( ret );
- }
-@@ -220,13 +242,21 @@
- GifFileType *gif;
- int i;
-
-+#if GIFLIB_MAJOR >= 5
-+ if ((gif = DGifOpenFileName(filename, NULL)) == NULL) {
-+#else
- if ((gif = DGifOpenFileName(filename)) == NULL) {
-+#endif
- fprintf( stderr, "can't open %s\n", filename);
- return( NULL );
- }
-
- if ( DGifSlurp(gif)==GIF_ERROR ) {
-+#if GIFLIB_MAJOR >= 5
-+ DGifCloseFile(gif, NULL);
-+#else
- DGifCloseFile(gif);
-+#endif
- fprintf(stderr,"Bad gif file %s\n", filename );
- return( NULL );
- }
-@@ -238,7 +268,11 @@
- ret = images[0];
- else
- ret = GImageCreateAnimation(images,gif->ImageCount);
-+#if GIFLIB_MAJOR >= 5
-+ DGifCloseFile(gif, NULL);
-+#else
- DGifCloseFile(gif);
-+#endif
- free(images);
- return( ret );
- }