summaryrefslogtreecommitdiff
blob: 30ad62c38f47694cb94afc06bbbc1eecbedacf1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--- a/gif.c
+++ b/gif.c
@@ -20,7 +20,12 @@
  */
 int gif_load_hdr(img I) {
     GifFileType *g;
+#if GIFLIB_MAJOR > 4
+	int *GifError = NULL;
+    g = I->us = DGifOpenFileHandle(fileno(I->fp), GifError);
+#else
     g = I->us = DGifOpenFileHandle(fileno(I->fp));
+#endif /* GIFLIB_MAJOR */
     if (!I->us) {
         I->err = IE_HDRFORMAT;
         return 0;
@@ -36,7 +41,12 @@
  * Abort loading a GIF file after the header is done.
  */
 int gif_abort_load(img I) {
+#if GIFLIB_MAJOR > 4
+	int *GifError = NULL;
+    DGifCloseFile((GifFileType*)I->us, GifError);
+#else
     DGifCloseFile((GifFileType*)I->us);
+#endif /* GIFLIB_MAJOR */
     return 1;
 }
 
@@ -44,6 +54,9 @@
  * Load GIF image.
  */
 int gif_load_img(img I) {
+#if GIFLIB_MAJOR > 4
+	int *GifError = NULL;
+#endif /* GIFLIB_MAJOR */
     GifFileType *g = I->us;
     struct SavedImage *si;
     int ret = 0;
@@ -114,7 +127,11 @@
     ret = 1;
 fail:
 
+#if GIFLIB_MAJOR > 4
+    DGifCloseFile(g, GifError);
+#else
     DGifCloseFile(g);
+#endif /* GIFLIB_MAJOR */
     
     return ret;
 }