$OpenBSD: patch-gdk_imlib_io-gif_c,v 1.2 2015/03/28 16:01:55 sthen Exp $

handle giflib 5.1+
https://projects.archlinux.org/svntogit/packages.git/plain/trunk/imlib-giflib5.patch?h=packages/imlib

--- gdk_imlib/io-gif.c.orig	Mon Mar  4 17:06:29 2002
+++ gdk_imlib/io-gif.c	Sat Mar 28 15:59:37 2015
@@ -10,6 +10,14 @@ unsigned char loader_gif (FILE *f, int *w, int *h, int
 #else
 #include <gif_lib.h>
 
+static void
+localPrintGifError(void)
+{
+    int ErrorCode=0;
+    GifErrorString(ErrorCode);
+    fprintf(stderr, "\nGIF-LIB error: %i.\n", ErrorCode);
+}
+
 unsigned char      *
 loader_gif(FILE *f, int *w, int *h, int *t)
 {
@@ -23,6 +31,7 @@ loader_gif(FILE *f, int *w, int *h, int *t)
   int                 intjump[] = {8, 8, 4, 2};
   int                 istransp, transp;
   int                 fd;
+  int                 Error;
 
   done = 0;
   istransp = 0;
@@ -30,7 +39,7 @@ loader_gif(FILE *f, int *w, int *h, int *t)
   fd = fileno(f);
   /* Apparently rewind(f) isn't sufficient */
   lseek(fd, (long) 0, 0);
-  gif = DGifOpenFileHandle(fd);
+  gif = DGifOpenFileHandle(fd, NULL);
 
   transp = -1;
   data = NULL;
@@ -43,14 +52,14 @@ loader_gif(FILE *f, int *w, int *h, int *t)
     {
       if (DGifGetRecordType(gif, &rec) == GIF_ERROR)
 	{
-	  PrintGifError();
+	  localPrintGifError();
 	  rec = TERMINATE_RECORD_TYPE;
 	}
       if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done))
 	{
 	  if (DGifGetImageDesc(gif) == GIF_ERROR)
 	    {
-	      PrintGifError();
+	      localPrintGifError();
 	      rec = TERMINATE_RECORD_TYPE;
 	    }
 	  *w = gif->Image.Width;
@@ -62,13 +71,13 @@ loader_gif(FILE *f, int *w, int *h, int *t)
 	  rows = malloc(*h * sizeof(GifRowType *));
 	  if (!rows)
 	    {
-	      DGifCloseFile(gif);
+	      DGifCloseFile(gif, NULL);
 	      return NULL;
 	    }
 	  data = _gdk_malloc_image(*w, *h);
 	  if (!data)
 	    {
-	      DGifCloseFile(gif);
+	      DGifCloseFile(gif, NULL);
 	      free(rows);
 	      return NULL;
 	    }
@@ -79,7 +88,7 @@ loader_gif(FILE *f, int *w, int *h, int *t)
 	      rows[i] = malloc(*w * sizeof(GifPixelType));
 	      if (!rows[i])
 		{
-		  DGifCloseFile(gif);
+		  DGifCloseFile(gif, NULL);
 		  for (i = 0; i < *h; i++)
 		    if (rows[i])
 		      free(rows[i]);
@@ -168,7 +177,7 @@ loader_gif(FILE *f, int *w, int *h, int *t)
 	    }
 	}
     }
-  DGifCloseFile(gif);
+  DGifCloseFile(gif, NULL);
   for (i = 0; i < *h; i++)
     free(rows[i]);
   free(rows);
