Removed
Link Here
|
1 |
--- src/png.c.orig 2011-10-27 20:56:24 UTC |
2 |
+++ src/png.c |
3 |
@@ -1510,7 +1510,11 @@ static int load_gif_frames(char *file_na |
4 |
int res, val, disposal, bpp, cmask, lastzero = FALSE; |
5 |
|
6 |
|
7 |
+#if GIFLIB_MAJOR >= 5 |
8 |
+ if (!(giffy = DGifOpenFileName(file_name, NULL))) return (-1); |
9 |
+#else |
10 |
if (!(giffy = DGifOpenFileName(file_name))) return (-1); |
11 |
+#endif |
12 |
|
13 |
/* Init state structure */ |
14 |
memset(&stat, 0, sizeof(stat)); |
15 |
@@ -1608,7 +1612,11 @@ static int load_gif_frames(char *file_na |
16 |
} |
17 |
res = 1; |
18 |
fail: mem_free_chanlist(w_set.img); |
19 |
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5 |
20 |
+ DGifCloseFile(giffy, NULL); |
21 |
+#else |
22 |
DGifCloseFile(giffy); |
23 |
+#endif |
24 |
return (res); |
25 |
} |
26 |
|
27 |
@@ -1621,7 +1629,11 @@ static int load_gif(char *file_name, ls_ |
28 |
int delay = settings->gif_delay, trans = -1;//, disposal = 0; |
29 |
|
30 |
|
31 |
+#if GIFLIB_MAJOR >= 5 |
32 |
+ if (!(giffy = DGifOpenFileName(file_name, NULL))) return (-1); |
33 |
+#else |
34 |
if (!(giffy = DGifOpenFileName(file_name))) return (-1); |
35 |
+#endif |
36 |
|
37 |
/* Get global palette */ |
38 |
settings->colors = convert_gif_palette(settings->pal, giffy->SColorMap); |
39 |
@@ -1659,7 +1671,11 @@ static int load_gif(char *file_name, ls_ |
40 |
} |
41 |
} |
42 |
res = 1; |
43 |
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5 |
44 |
+fail: DGifCloseFile(giffy, NULL); |
45 |
+#else |
46 |
fail: DGifCloseFile(giffy); |
47 |
+#endif |
48 |
return (res); |
49 |
} |
50 |
|
51 |
@@ -1682,10 +1698,18 @@ static int save_gif(char *file_name, ls_ |
52 |
nc |= nc >> 1; nc |= nc >> 2; nc |= nc >> 4; |
53 |
nc += !nc + 1; // No less than 2 colors |
54 |
|
55 |
+#if GIFLIB_MAJOR >= 5 |
56 |
+ gif_map = GifMakeMapObject(nc, NULL); |
57 |
+#else |
58 |
gif_map = MakeMapObject(nc, NULL); |
59 |
+#endif |
60 |
if (!gif_map) return -1; |
61 |
|
62 |
+#if GIFLIB_MAJOR >= 5 |
63 |
+ giffy = EGifOpenFileName(file_name, FALSE, NULL); |
64 |
+#else |
65 |
giffy = EGifOpenFileName(file_name, FALSE); |
66 |
+#endif |
67 |
if (!giffy) goto fail0; |
68 |
|
69 |
for (i = 0; i < settings->colors; i++) |
70 |
@@ -1725,14 +1749,22 @@ static int save_gif(char *file_name, ls_ |
71 |
if (!settings->silent) progress_end(); |
72 |
msg = 0; |
73 |
|
74 |
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5 |
75 |
+fail: EGifCloseFile(giffy, NULL); |
76 |
+#else |
77 |
fail: EGifCloseFile(giffy); |
78 |
+#endif |
79 |
#ifndef WIN32 |
80 |
/* giflib creates files with 0600 permissions, which is nasty - WJ */ |
81 |
mode = umask(0022); |
82 |
umask(mode); |
83 |
chmod(file_name, 0666 & ~mode); |
84 |
#endif |
85 |
+#if GIFLIB_MAJOR >= 5 |
86 |
+fail0: GifFreeMapObject(gif_map); |
87 |
+#else |
88 |
fail0: FreeMapObject(gif_map); |
89 |
+#endif |
90 |
|
91 |
return (msg); |
92 |
} |