wok-6.x diff imlib/stuff/giflib5.u @ rev 22950

updated inotify-tools again (3.14 -> 3.20.2.2)
author Hans-G?nter Theisgen
date Fri Feb 28 14:33:03 2020 +0100 (2020-02-28)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/imlib/stuff/giflib5.u	Fri Feb 28 14:33:03 2020 +0100
     1.3 @@ -0,0 +1,122 @@
     1.4 +--- gdk_imlib/io-gif.c
     1.5 ++++ gdk_imlib/io-gif.c
     1.6 +@@ -10,6 +10,15 @@
     1.7 + #else
     1.8 + #include <gif_lib.h>
     1.9 + 
    1.10 ++static int ErrorCode;
    1.11 ++static void PrintGifError(void)
    1.12 ++{
    1.13 ++	char *Err = GifErrorString(ErrorCode);
    1.14 ++	if (Err != NULL)
    1.15 ++		fprintf(stderr, "GIF-LIB error: %s.\n", Err);
    1.16 ++	else	fprintf(stderr, "GIF-LIB undefined error %d.\n", ErrorCode);
    1.17 ++}
    1.18 ++
    1.19 + unsigned char      *
    1.20 + loader_gif(FILE *f, int *w, int *h, int *t)
    1.21 + {
    1.22 +@@ -30,7 +39,7 @@
    1.23 +   fd = fileno(f);
    1.24 +   /* Apparently rewind(f) isn't sufficient */
    1.25 +   lseek(fd, (long) 0, 0);
    1.26 +-  gif = DGifOpenFileHandle(fd);
    1.27 ++  gif = DGifOpenFileHandle(fd, &ErrorCode);
    1.28 + 
    1.29 +   transp = -1;
    1.30 +   data = NULL;
    1.31 +@@ -62,13 +71,13 @@
    1.32 + 	  rows = malloc(*h * sizeof(GifRowType *));
    1.33 + 	  if (!rows)
    1.34 + 	    {
    1.35 +-	      DGifCloseFile(gif);
    1.36 ++	      DGifCloseFile(gif, NULL);
    1.37 + 	      return NULL;
    1.38 + 	    }
    1.39 + 	  data = _gdk_malloc_image(*w, *h);
    1.40 + 	  if (!data)
    1.41 + 	    {
    1.42 +-	      DGifCloseFile(gif);
    1.43 ++	      DGifCloseFile(gif, NULL);
    1.44 + 	      free(rows);
    1.45 + 	      return NULL;
    1.46 + 	    }
    1.47 +@@ -79,7 +88,7 @@
    1.48 + 	      rows[i] = malloc(*w * sizeof(GifPixelType));
    1.49 + 	      if (!rows[i])
    1.50 + 		{
    1.51 +-		  DGifCloseFile(gif);
    1.52 ++		  DGifCloseFile(gif, NULL);
    1.53 + 		  for (i = 0; i < *h; i++)
    1.54 + 		    if (rows[i])
    1.55 + 		      free(rows[i]);
    1.56 +@@ -168,7 +177,7 @@
    1.57 + 	    }
    1.58 + 	}
    1.59 +     }
    1.60 +-  DGifCloseFile(gif);
    1.61 ++  DGifCloseFile(gif, NULL);
    1.62 +   for (i = 0; i < *h; i++)
    1.63 +     free(rows[i]);
    1.64 +   free(rows);
    1.65 +--- Imlib/load.c
    1.66 ++++ Imlib/load.c
    1.67 +@@ -420,6 +420,15 @@
    1.68 + #endif /* HAVE_LIBTIFF */
    1.69 + 
    1.70 + #ifdef HAVE_LIBGIF
    1.71 ++static int ErrorCode;
    1.72 ++static void PrintGifError(void)
    1.73 ++{
    1.74 ++	char *Err = GifErrorString(ErrorCode);
    1.75 ++	if (Err != NULL)
    1.76 ++		fprintf(stderr, "GIF-LIB error: %s.\n", Err);
    1.77 ++	else	fprintf(stderr, "GIF-LIB undefined error %d.\n", ErrorCode);
    1.78 ++}
    1.79 ++
    1.80 + unsigned char      *
    1.81 + _LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t)
    1.82 + {
    1.83 +@@ -443,7 +452,7 @@
    1.84 +   fd = fileno(f);
    1.85 +   /* Apparently rewind(f) isn't sufficient */
    1.86 +   lseek(fd, (long) 0, 0);
    1.87 +-  gif = DGifOpenFileHandle(fd);
    1.88 ++  gif = DGifOpenFileHandle(fd, &ErrorCode);
    1.89 + 
    1.90 +   if (!gif)
    1.91 +     return NULL;
    1.92 +@@ -470,13 +479,13 @@
    1.93 + 	  rows = malloc(*h * sizeof(GifRowType *));
    1.94 + 	  if (!rows)
    1.95 + 	    {
    1.96 +-	      DGifCloseFile(gif);
    1.97 ++	      DGifCloseFile(gif, NULL);
    1.98 + 	      return NULL;
    1.99 + 	    }
   1.100 + 	  data = _imlib_malloc_image(*w, *h);
   1.101 + 	  if (!data)
   1.102 + 	    {
   1.103 +-	      DGifCloseFile(gif);
   1.104 ++	      DGifCloseFile(gif, NULL);
   1.105 + 	      free(rows);
   1.106 + 	      return NULL;
   1.107 + 	    }
   1.108 +@@ -487,7 +496,7 @@
   1.109 + 	      rows[i] = malloc(*w * sizeof(GifPixelType));
   1.110 + 	      if (!rows[i])
   1.111 + 		{
   1.112 +-		  DGifCloseFile(gif);
   1.113 ++		  DGifCloseFile(gif, NULL);
   1.114 + 		  for (i = 0; i < *h; i++)
   1.115 + 		    if (rows[i])
   1.116 + 		      free(rows[i]);
   1.117 +@@ -576,7 +585,7 @@
   1.118 + 	    }
   1.119 + 	}
   1.120 +     }
   1.121 +-  DGifCloseFile(gif);
   1.122 ++  DGifCloseFile(gif, NULL);
   1.123 +   for (i = 0; i < *h; i++)
   1.124 +     free(rows[i]);
   1.125 +   free(rows);