forked from pool/fontforge
0058156a0c
- Update fontforge-fixgiflib.patch to support giflib7-5.1 OBS-URL: https://build.opensuse.org/request/show/235928 OBS-URL: https://build.opensuse.org/package/show/M17N/fontforge?expand=0&rev=37
95 lines
3.0 KiB
Diff
95 lines
3.0 KiB
Diff
---
|
|
gutils/gimagereadgif.c | 32 ++++++++++++++++++++++++++------
|
|
1 file changed, 26 insertions(+), 6 deletions(-)
|
|
|
|
Index: fontforge-20120731-b/gutils/gimagereadgif.c
|
|
===================================================================
|
|
--- fontforge-20120731-b.orig/gutils/gimagereadgif.c
|
|
+++ fontforge-20120731-b/gutils/gimagereadgif.c
|
|
@@ -44,7 +44,11 @@ static int a_file_must_define_something=
|
|
static DL_CONST void *libgif=NULL;
|
|
static GifFileType *(*_DGifOpenFileName)(char *);
|
|
static int (*_DGifSlurp)(GifFileType *);
|
|
+#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1))
|
|
+static int (*_DGifCloseFile)(GifFileType *, int *);
|
|
+#else
|
|
static int (*_DGifCloseFile)(GifFileType *);
|
|
+#endif
|
|
|
|
static int loadgif() {
|
|
char *err;
|
|
@@ -58,7 +62,7 @@ return( 0 );
|
|
}
|
|
_DGifOpenFileName = (GifFileType *(*)(char *)) dlsym(libgif,"DGifOpenFileName");
|
|
_DGifSlurp = (int (*)(GifFileType *)) dlsym(libgif,"DGifSlurp");
|
|
- _DGifCloseFile = (int (*)(GifFileType *)) dlsym(libgif,"DGifCloseFile");
|
|
+ _DGifCloseFile = (void *)dlsym(libgif,"DGifCloseFile");
|
|
if ( _DGifOpenFileName && _DGifSlurp && _DGifCloseFile )
|
|
return( 1 );
|
|
dlclose(libgif);
|
|
@@ -132,13 +136,17 @@ GImage *GImageReadGif(char *filename) {
|
|
if ( !loadgif())
|
|
return( NULL );
|
|
|
|
- if ((gif = _DGifOpenFileName(filename)) == NULL) {
|
|
+ if ((gif = _DGifOpenFileName(filename, NULL)) == NULL) {
|
|
fprintf( stderr, "can't open %s\n", filename);
|
|
return( NULL );
|
|
}
|
|
|
|
if ( _DGifSlurp(gif)==GIF_ERROR ) {
|
|
+#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1))
|
|
+ _DGifCloseFile(gif, NULL);
|
|
+#else
|
|
_DGifCloseFile(gif);
|
|
+#endif
|
|
fprintf( stderr, "Bad gif file %s\n", filename );
|
|
return( NULL );
|
|
}
|
|
@@ -150,7 +158,11 @@ return( NULL );
|
|
ret = images[0];
|
|
else
|
|
ret = GImageCreateAnimation(images,gif->ImageCount);
|
|
- _DGifCloseFile(gif);
|
|
+#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1))
|
|
+ _DGifCloseFile(gif, NULL);
|
|
+#else
|
|
+ _DGifCloseFile(gif);
|
|
+#endif
|
|
free(images);
|
|
return( ret );
|
|
}
|
|
@@ -220,13 +232,17 @@ GImage *GImageReadGif(char *filename) {
|
|
GifFileType *gif;
|
|
int i;
|
|
|
|
- if ((gif = DGifOpenFileName(filename)) == NULL) {
|
|
+ if ((gif = DGifOpenFileName(filename, NULL)) == NULL) {
|
|
fprintf( stderr, "can't open %s\n", filename);
|
|
return( NULL );
|
|
}
|
|
|
|
if ( DGifSlurp(gif)==GIF_ERROR ) {
|
|
- DGifCloseFile(gif);
|
|
+#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1))
|
|
+ DGifCloseFile(gif, NULL);
|
|
+#else
|
|
+ DGifCloseFile(gif);
|
|
+#endif
|
|
fprintf(stderr,"Bad gif file %s\n", filename );
|
|
return( NULL );
|
|
}
|
|
@@ -238,7 +254,11 @@ return( NULL );
|
|
ret = images[0];
|
|
else
|
|
ret = GImageCreateAnimation(images,gif->ImageCount);
|
|
- DGifCloseFile(gif);
|
|
+#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1))
|
|
+ DGifCloseFile(gif, NULL);
|
|
+#else
|
|
+ DGifCloseFile(gif);
|
|
+#endif
|
|
free(images);
|
|
return( ret );
|
|
}
|