]> git.pld-linux.org Git - packages/fontforge.git/blob - giflib5.patch
removed libfontforge.la, rebuild without libpangoxft.la
[packages/fontforge.git] / giflib5.patch
1 --- fontforge-20120731-b/gutils/gimagereadgif.c~        2012-08-02 17:09:09.000000000 +0200
2 +++ fontforge-20120731-b/gutils/gimagereadgif.c 2015-05-10 14:11:16.818633712 +0200
3 @@ -42,9 +42,14 @@
4  #include <gif_lib.h>
5  
6  static DL_CONST void *libgif=NULL;
7 +#if GIFLIB_MAJOR >= 5
8 +static GifFileType *(*_DGifOpenFileName)(char *, int *);
9 +static int (*_DGifCloseFile)(GifFileType *, int *);
10 +#else
11  static GifFileType *(*_DGifOpenFileName)(char *);
12 -static int (*_DGifSlurp)(GifFileType *);
13  static int (*_DGifCloseFile)(GifFileType *);
14 +#endif
15 +static int (*_DGifSlurp)(GifFileType *);
16  
17  static int loadgif() {
18      char *err;
19 @@ -56,9 +61,14 @@
20         fprintf(stderr,"%s\n", dlerror());
21  return( 0 );
22      }
23 +#if GIFLIB_MAJOR >= 5
24 +    _DGifOpenFileName = (GifFileType *(*)(char *, int *)) dlsym(libgif,"DGifOpenFileName");
25 +    _DGifCloseFile = (int (*)(GifFileType *, int *)) dlsym(libgif,"DGifCloseFile");
26 +#else
27      _DGifOpenFileName = (GifFileType *(*)(char *)) dlsym(libgif,"DGifOpenFileName");
28 -    _DGifSlurp = (int (*)(GifFileType *)) dlsym(libgif,"DGifSlurp");
29      _DGifCloseFile = (int (*)(GifFileType *)) dlsym(libgif,"DGifCloseFile");
30 +#endif
31 +    _DGifSlurp = (int (*)(GifFileType *)) dlsym(libgif,"DGifSlurp");
32      if ( _DGifOpenFileName && _DGifSlurp && _DGifCloseFile )
33  return( 1 );
34      dlclose(libgif);
35 @@ -132,13 +142,21 @@
36         if ( !loadgif())
37  return( NULL );
38  
39 +#if GIFLIB_MAJOR >= 5
40 +    if ((gif = _DGifOpenFileName(filename, NULL)) == NULL) {
41 +#else
42      if ((gif = _DGifOpenFileName(filename)) == NULL) {
43 +#endif
44         fprintf( stderr, "can't open %s\n", filename);
45  return( NULL );
46      }
47  
48      if ( _DGifSlurp(gif)==GIF_ERROR ) {
49 +#if GIFLIB_MAJOR >= 5
50 +       _DGifCloseFile(gif, NULL);
51 +#else
52         _DGifCloseFile(gif);
53 +#endif
54         fprintf( stderr, "Bad gif file %s\n", filename );
55  return( NULL );
56      }
57 @@ -150,7 +168,11 @@
58         ret = images[0];
59      else
60         ret = GImageCreateAnimation(images,gif->ImageCount);
61 +#if GIFLIB_MAJOR >= 5
62 +    _DGifCloseFile(gif, NULL);
63 +#else
64      _DGifCloseFile(gif);
65 +#endif
66      free(images);
67  return( ret );
68  }
69 @@ -220,13 +242,21 @@
70      GifFileType *gif;
71      int i;
72  
73 +#if GIFLIB_MAJOR >= 5
74 +    if ((gif = DGifOpenFileName(filename, NULL)) == NULL) {
75 +#else
76      if ((gif = DGifOpenFileName(filename)) == NULL) {
77 +#endif
78         fprintf( stderr, "can't open %s\n", filename);
79  return( NULL );
80      }
81  
82      if ( DGifSlurp(gif)==GIF_ERROR ) {
83 +#if GIFLIB_MAJOR >= 5
84 +       DGifCloseFile(gif, NULL);
85 +#else
86         DGifCloseFile(gif);
87 +#endif
88         fprintf(stderr,"Bad gif file %s\n", filename );
89  return( NULL );
90      }
91 @@ -238,7 +268,11 @@
92         ret = images[0];
93      else
94         ret = GImageCreateAnimation(images,gif->ImageCount);
95 +#if GIFLIB_MAJOR >= 5
96 +    DGifCloseFile(gif, NULL);
97 +#else
98      DGifCloseFile(gif);
99 +#endif
100      free(images);
101  return( ret );
102  }
This page took 0.053369 seconds and 3 git commands to generate.