wok-6.x view imlib/stuff/giflib5.u @ rev 23691
updated tcllib (1.19 -> 1.20)
author | Hans-G?nter Theisgen |
---|---|
date | Mon Apr 27 06:38:55 2020 +0100 (2020-04-27) |
parents | |
children |
line source
1 --- gdk_imlib/io-gif.c
2 +++ gdk_imlib/io-gif.c
3 @@ -10,6 +10,15 @@
4 #else
5 #include <gif_lib.h>
7 +static int ErrorCode;
8 +static void PrintGifError(void)
9 +{
10 + char *Err = GifErrorString(ErrorCode);
11 + if (Err != NULL)
12 + fprintf(stderr, "GIF-LIB error: %s.\n", Err);
13 + else fprintf(stderr, "GIF-LIB undefined error %d.\n", ErrorCode);
14 +}
15 +
16 unsigned char *
17 loader_gif(FILE *f, int *w, int *h, int *t)
18 {
19 @@ -30,7 +39,7 @@
20 fd = fileno(f);
21 /* Apparently rewind(f) isn't sufficient */
22 lseek(fd, (long) 0, 0);
23 - gif = DGifOpenFileHandle(fd);
24 + gif = DGifOpenFileHandle(fd, &ErrorCode);
26 transp = -1;
27 data = NULL;
28 @@ -62,13 +71,13 @@
29 rows = malloc(*h * sizeof(GifRowType *));
30 if (!rows)
31 {
32 - DGifCloseFile(gif);
33 + DGifCloseFile(gif, NULL);
34 return NULL;
35 }
36 data = _gdk_malloc_image(*w, *h);
37 if (!data)
38 {
39 - DGifCloseFile(gif);
40 + DGifCloseFile(gif, NULL);
41 free(rows);
42 return NULL;
43 }
44 @@ -79,7 +88,7 @@
45 rows[i] = malloc(*w * sizeof(GifPixelType));
46 if (!rows[i])
47 {
48 - DGifCloseFile(gif);
49 + DGifCloseFile(gif, NULL);
50 for (i = 0; i < *h; i++)
51 if (rows[i])
52 free(rows[i]);
53 @@ -168,7 +177,7 @@
54 }
55 }
56 }
57 - DGifCloseFile(gif);
58 + DGifCloseFile(gif, NULL);
59 for (i = 0; i < *h; i++)
60 free(rows[i]);
61 free(rows);
62 --- Imlib/load.c
63 +++ Imlib/load.c
64 @@ -420,6 +420,15 @@
65 #endif /* HAVE_LIBTIFF */
67 #ifdef HAVE_LIBGIF
68 +static int ErrorCode;
69 +static void PrintGifError(void)
70 +{
71 + char *Err = GifErrorString(ErrorCode);
72 + if (Err != NULL)
73 + fprintf(stderr, "GIF-LIB error: %s.\n", Err);
74 + else fprintf(stderr, "GIF-LIB undefined error %d.\n", ErrorCode);
75 +}
76 +
77 unsigned char *
78 _LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t)
79 {
80 @@ -443,7 +452,7 @@
81 fd = fileno(f);
82 /* Apparently rewind(f) isn't sufficient */
83 lseek(fd, (long) 0, 0);
84 - gif = DGifOpenFileHandle(fd);
85 + gif = DGifOpenFileHandle(fd, &ErrorCode);
87 if (!gif)
88 return NULL;
89 @@ -470,13 +479,13 @@
90 rows = malloc(*h * sizeof(GifRowType *));
91 if (!rows)
92 {
93 - DGifCloseFile(gif);
94 + DGifCloseFile(gif, NULL);
95 return NULL;
96 }
97 data = _imlib_malloc_image(*w, *h);
98 if (!data)
99 {
100 - DGifCloseFile(gif);
101 + DGifCloseFile(gif, NULL);
102 free(rows);
103 return NULL;
104 }
105 @@ -487,7 +496,7 @@
106 rows[i] = malloc(*w * sizeof(GifPixelType));
107 if (!rows[i])
108 {
109 - DGifCloseFile(gif);
110 + DGifCloseFile(gif, NULL);
111 for (i = 0; i < *h; i++)
112 if (rows[i])
113 free(rows[i]);
114 @@ -576,7 +585,7 @@
115 }
116 }
117 }
118 - DGifCloseFile(gif);
119 + DGifCloseFile(gif, NULL);
120 for (i = 0; i < *h; i++)
121 free(rows[i]);
122 free(rows);