Allow building with giflib 5.1

PR:		204492
This commit is contained in:
Antoine Brodin 2015-11-12 15:41:21 +00:00
parent c5c1406991
commit b8a95c0b0b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=401360

View file

@ -12,7 +12,19 @@
/* Init state structure */
memset(&stat, 0, sizeof(stat));
@@ -1621,7 +1625,11 @@ static int load_gif(char *file_name, ls_
@@ -1608,7 +1612,11 @@ static int load_gif_frames(char *file_na
}
res = 1;
fail: mem_free_chanlist(w_set.img);
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(giffy, NULL);
+#else
DGifCloseFile(giffy);
+#endif
return (res);
}
@@ -1621,7 +1629,11 @@ static int load_gif(char *file_name, ls_
int delay = settings->gif_delay, trans = -1;//, disposal = 0;
@ -24,7 +36,19 @@
/* Get global palette */
settings->colors = convert_gif_palette(settings->pal, giffy->SColorMap);
@@ -1682,10 +1690,18 @@ static int save_gif(char *file_name, ls_
@@ -1659,7 +1671,11 @@ static int load_gif(char *file_name, ls_
}
}
res = 1;
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+fail: DGifCloseFile(giffy, NULL);
+#else
fail: DGifCloseFile(giffy);
+#endif
return (res);
}
@@ -1682,10 +1698,18 @@ static int save_gif(char *file_name, ls_
nc |= nc >> 1; nc |= nc >> 2; nc |= nc >> 4;
nc += !nc + 1; // No less than 2 colors
@ -43,7 +67,18 @@
if (!giffy) goto fail0;
for (i = 0; i < settings->colors; i++)
@@ -1732,7 +1748,11 @@ fail: EGifCloseFile(giffy);
@@ -1725,14 +1749,22 @@ static int save_gif(char *file_name, ls_
if (!settings->silent) progress_end();
msg = 0;
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+fail: EGifCloseFile(giffy, NULL);
+#else
fail: EGifCloseFile(giffy);
+#endif
#ifndef WIN32
/* giflib creates files with 0600 permissions, which is nasty - WJ */
mode = umask(0022);
umask(mode);
chmod(file_name, 0666 & ~mode);
#endif