File img2eps-giflib.patch of Package img2eps
--- src/im_gif.c.orig
+++ src/im_gif.c
@@ -80,7 +80,11 @@ gif_close(image_gif *im)
free(im->pal);
if (DGifCloseFile(im->gif) != GIF_OK)
- throwf(EIO, "error closing: %s", _errstr(GifLastError()));
+#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR >= 5)
+ throwf(EIO, "error closing: %s", GifErrorString(im->gif->Error));
+#else
+ throwf(EIO, "error closing: %s", _errstr(GifLastError()));
+#endif
image_free((image *)im);
}
@@ -115,8 +119,11 @@ gif_open(char *fname)
image_gif *im;
GifFileType *gif;
exception ex;
-
+#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR >=5)
+ if ((gif=DGifOpenFileName(fname, NULL)) == NULL)
+#else
if ((gif=DGifOpenFileName(fname)) == NULL)
+#endif
return NULL;
if (catch(&ex) == 0) {
@@ -195,9 +202,12 @@ gif_read_start(image_gif *im)
*/
if (DGifSlurp(im->gif) != GIF_OK)
+#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR >= 5)
+ throwf(EIO, "error reading image: %s", GifErrorString(im->gif->Error));
+#else
throwf(EIO, "error reading image: %s",
_errstr(GifLastError()));
-
+#endif
if (im->gif->ImageCount != 1)
throws(EOPNOTSUPP, "multi-image GIFs not supported");
--- src/exceptions.c.orig
+++ src/exceptions.c
@@ -35,6 +35,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <errno.h>
#include <setjmp.h>
#include <stdarg.h>
--- src/getopt_long.c.orig
+++ src/getopt_long.c
@@ -37,6 +37,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
--- src/st_ascii85.c.orig
+++ src/st_ascii85.c
@@ -35,6 +35,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "exceptions.h"
#include "stream.h"
#include "stream_types.h"
--- src/st_asciihex.c.orig
+++ src/st_asciihex.c
@@ -35,6 +35,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "exceptions.h"
#include "stream.h"
#include "stream_types.h"
--- src/st_file.c.orig
+++ src/st_file.c
@@ -35,6 +35,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <errno.h>
#include <stdio.h>
#include <string.h>
--- src/st_line.c.orig
+++ src/st_line.c
@@ -35,6 +35,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "stream.h"
#include "stream_types.h"
--- src/st_runlength.c.orig
+++ src/st_runlength.c
@@ -35,6 +35,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "stream.h"
#include "stream_types.h"
--- src/stream.c.orig
+++ src/stream.c
@@ -35,6 +35,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
--- src/util.c.orig
+++ src/util.c
@@ -35,6 +35,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <string.h>
#include "util.h"
--- src/xmalloc.c.orig
+++ src/xmalloc.c
@@ -35,6 +35,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>