[BACK]Return to patch-ak CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / graphics / imlib / patches

File: [cvs.NetBSD.org] / pkgsrc / graphics / imlib / patches / patch-ak (download)

Revision 1.4, Fri May 30 11:34:01 2014 UTC (5 years, 4 months ago) by joerg
Branch: MAIN
CVS Tags: pkgsrc-2019Q3-base, pkgsrc-2019Q3, pkgsrc-2019Q2-base, pkgsrc-2019Q2, pkgsrc-2019Q1-base, pkgsrc-2019Q1, pkgsrc-2018Q4-base, pkgsrc-2018Q4, pkgsrc-2018Q3-base, pkgsrc-2018Q3, pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, pkgsrc-2017Q3-base, pkgsrc-2017Q3, pkgsrc-2017Q2-base, pkgsrc-2017Q2, pkgsrc-2017Q1-base, pkgsrc-2017Q1, pkgsrc-2016Q4-base, pkgsrc-2016Q4, pkgsrc-2016Q3-base, pkgsrc-2016Q3, pkgsrc-2016Q2-base, pkgsrc-2016Q2, pkgsrc-2016Q1-base, pkgsrc-2016Q1, pkgsrc-2015Q4-base, pkgsrc-2015Q4, pkgsrc-2015Q3-base, pkgsrc-2015Q3, pkgsrc-2015Q2-base, pkgsrc-2015Q2, pkgsrc-2015Q1-base, pkgsrc-2015Q1, pkgsrc-2014Q4-base, pkgsrc-2014Q4, pkgsrc-2014Q3-base, pkgsrc-2014Q3, pkgsrc-2014Q2-base, pkgsrc-2014Q2, pkgsrc-, HEAD
Changes since 1.3: +35 -1 lines

Fix build of imlib-gtk by adding the needed argument for DGifCloseFile.

$NetBSD: patch-ak,v 1.4 2014/05/30 11:34:01 joerg Exp $

* Fixes build with giflib>=5

--- gdk_imlib/io-gif.c.orig	2002-03-04 17:06:29.000000000 +0000
+++ gdk_imlib/io-gif.c
@@ -10,6 +10,16 @@ unsigned char loader_gif (FILE *f, int *
 #else
 #include <gif_lib.h>
 
+static void
+PrintGifError(int ErrorCode) {
+    char *Err = GifErrorString(ErrorCode);
+
+    if (Err != NULL)
+        fprintf(stderr, "GIF-LIB error: %s.\n", Err);
+    else
+        fprintf(stderr, "GIF-LIB undefined error %d.\n", ErrorCode);
+}
+
 unsigned char      *
 loader_gif(FILE *f, int *w, int *h, int *t)
 {
@@ -30,7 +40,7 @@ loader_gif(FILE *f, int *w, int *h, int 
   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 +53,14 @@ loader_gif(FILE *f, int *w, int *h, int 
     {
       if (DGifGetRecordType(gif, &rec) == GIF_ERROR)
 	{
-	  PrintGifError();
+	  PrintGifError(gif->Error);
 	  rec = TERMINATE_RECORD_TYPE;
 	}
       if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done))
 	{
 	  if (DGifGetImageDesc(gif) == GIF_ERROR)
 	    {
-	      PrintGifError();
+	      PrintGifError(gif->Error);
 	      rec = TERMINATE_RECORD_TYPE;
 	    }
 	  *w = gif->Image.Width;
@@ -62,13 +72,13 @@ loader_gif(FILE *f, int *w, int *h, int 
 	  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 +89,7 @@ loader_gif(FILE *f, int *w, int *h, int 
 	      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 +178,7 @@ loader_gif(FILE *f, int *w, int *h, int 
 	    }
 	}
     }
-  DGifCloseFile(gif);
+  DGifCloseFile(gif, NULL);
   for (i = 0; i < *h; i++)
     free(rows[i]);
   free(rows);