]> git.pld-linux.org Git - packages/endeavour.git/blob - endeavour-giflib.patch
- release 7 (by relup.sh)
[packages/endeavour.git] / endeavour-giflib.patch
1 --- endeavour-3.1.4/endeavour2/imgio_gif.c.orig 2009-09-12 09:00:00.000000000 +0200
2 +++ endeavour-3.1.4/endeavour2/imgio_gif.c      2014-02-03 18:55:20.501284490 +0100
3 @@ -41,9 +41,9 @@
4  
5  /* Error Code To String */
6  static const char *ImgGIFErrorStringDecode(const int gif_error_code);
7 -#define DGIF_STR_ERROR         ImgGIFErrorStringDecode
8 +#define DGIF_STR_ERROR         GifErrorString
9  static const char *ImgGIFErrorStringEncode(const int gif_error_code);
10 -#define EGIF_STR_ERROR         ImgGIFErrorStringEncode
11 +#define EGIF_STR_ERROR         GifErrorString
12  
13  /* Open */
14  static int ImgReadGIFReadCB(
15 @@ -492,7 +492,7 @@
16  #define MIN(a,b)       (((a) < (b)) ? (a) : (b))
17  #define CLIP(a,l,h)    (MIN(MAX((a),(l)),(h)))
18  #define STRLEN(s)      (((s) != NULL) ? strlen(s) : 0)
19 -#define STRISEMPTY(s)  (((s) != NULL) ? (*(s) == '\0') : TRUE)
20 +#define STRISEMPTY(s)  (((s) != NULL) ? (*(s) == '\0') : true)
21  
22  
23  /*
24 @@ -500,29 +500,12 @@
25   */
26  void ImgGIFVersion(int *major, int *minor, int *release) 
27  {
28 -       const char *ver_str = GIF_LIB_VERSION, *s;
29 -
30 -       s = strstr(ver_str, "Version");
31 -       while((*s != '\0') && (*s != ' '))
32 -           s++;
33 -       while(*s == ' ')
34 -           s++;
35         if(major != NULL)
36 -           *major = ATOI(s);
37 -
38 -       while((*s != '\0') && (*s != '.'))
39 -           s++;
40 -       while(*s == '.')
41 -           s++;
42 +           *major = GIFLIB_MAJOR;
43         if(minor != NULL)
44 -           *minor = ATOI(s);
45 -
46 -       while((*s != '\0') && (*s != '.'))
47 -           s++;
48 -       while(*s == '.')
49 -           s++;
50 +           *minor = GIFLIB_MINOR;
51         if(release != NULL)
52 -           *release = ATOI(s);
53 +           *release = GIFLIB_RELEASE;
54  }
55  
56  
57 @@ -986,7 +969,7 @@
58             );
59             if(gif_status != GIF_OK)
60             {
61 -               ImgOpenSetError(DGIF_STR_ERROR(gif_status));
62 +               ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
63                 status = -1;
64                 break;
65             }
66 @@ -1076,7 +1059,7 @@
67                                 );
68                                 if(gif_status != GIF_OK)
69                                 {
70 -                                   ImgOpenSetError(DGIF_STR_ERROR(gif_status));
71 +                                   ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
72                                     status = -1;
73                                     break;
74                                 }
75 @@ -1107,7 +1090,7 @@
76                             );
77                             if(gif_status != GIF_OK)
78                             {
79 -                               ImgOpenSetError(DGIF_STR_ERROR(gif_status));
80 +                               ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
81                                 status = -1;
82                                 break;
83                             }
84 @@ -1235,7 +1218,7 @@
85                 }
86                 else
87                 {
88 -                   ImgOpenSetError(DGIF_STR_ERROR(gif_status));
89 +                   ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
90                     status = -1;
91                 }
92                 break;
93 @@ -1391,7 +1374,7 @@
94                                         );
95                                         if(gif_status != GIF_OK)
96                                         {
97 -                                           ImgOpenSetError(DGIF_STR_ERROR(gif_status));
98 +                                           ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
99                                             status = -1;
100                                             get_error_need_break = 1;
101                                             break;
102 @@ -1421,7 +1404,7 @@
103                             );
104                             if(gif_status != GIF_OK)
105                             {
106 -                               ImgOpenSetError(DGIF_STR_ERROR(gif_status));
107 +                               ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
108                                 status = -1;
109                                 break;
110                             }
111 @@ -1429,7 +1412,7 @@
112                     }
113                     else
114                     {
115 -                       ImgOpenSetError(DGIF_STR_ERROR(gif_status));
116 +                       ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
117                         status = -1;
118                     }
119                 }
120 @@ -1469,7 +1452,8 @@
121  {
122         const int       bpp = 4;                /* RGBA */
123         int             i,
124 -                       gif_status;
125 +                       gif_status,
126 +                       gif_error;
127         GifFileType *gif_file;
128         GifRowType gif_screen_row;
129         ImgGIFReadContext *ctx = NULL;
130 @@ -1629,11 +1613,12 @@
131          */
132         ctx->gif_file = gif_file = DGifOpen(
133             ctx,
134 -           ImgReadGIFReadCB
135 +           ImgReadGIFReadCB,
136 +           &gif_error
137         );
138         if(gif_file == NULL)
139         {
140 -           ImgOpenSetError(DGIF_STR_ERROR(GifLastError()));
141 +           ImgOpenSetError(DGIF_STR_ERROR(gif_error));
142             CLEANUP_RETURN(-1);
143         }
144  
145 @@ -1778,12 +1763,13 @@
146  
147         /* End the GIF decoding */
148         gif_status = DGifCloseFile(ctx->gif_file);
149 -       ctx->gif_file = NULL;
150         if(gif_status != GIF_OK)
151         {
152 -           ImgOpenSetError(DGIF_STR_ERROR(gif_status));
153 +           ImgOpenSetError(DGIF_STR_ERROR(ctx->gif_file->Error));
154 +           free(ctx->gif_file);
155             ctx->status = -1;
156         }
157 +       ctx->gif_file = NULL;
158  
159         if(*ctx->user_aborted)
160         {
161 @@ -1974,7 +1960,8 @@
162  {
163         const int       bpp = 4;                /* RGBA */
164         int             i,
165 -                       gif_status;
166 +                       gif_status,
167 +                       gif_error;
168         GifFileType *gif_file;
169         GifRowType gif_screen_row;
170         ImgGIFReadContext *ctx = NULL;
171 @@ -2132,11 +2119,12 @@
172          */
173         ctx->gif_file = gif_file = DGifOpen(
174             ctx,
175 -           ImgReadGIFReadCB
176 +           ImgReadGIFReadCB,
177 +           &gif_error
178         );
179         if(gif_file == NULL)
180         {
181 -           ImgOpenSetError(DGIF_STR_ERROR(GifLastError()));
182 +           ImgOpenSetError(GifErrorString(gif_error));
183             CLEANUP_RETURN(-1);
184         }
185  
186 @@ -2294,12 +2282,13 @@
187  
188         /* End the GIF decoding */
189         gif_status = DGifCloseFile(ctx->gif_file);
190 -       ctx->gif_file = NULL;
191         if(gif_status != GIF_OK)
192         {
193 -           ImgOpenSetError(DGIF_STR_ERROR(gif_status));
194 +           ImgOpenSetError(DGIF_STR_ERROR(ctx->gif_file->Error));
195 +           free(ctx->gif_file);
196             ctx->status = -1;
197         }
198 +       ctx->gif_file = NULL;
199  
200         /* Check for user abort */
201         if(*ctx->user_aborted)
202 @@ -2770,7 +2759,7 @@
203         }
204  
205         /* Create the GIF colormap from the colors list */
206 -       colormap = MakeMapObject(
207 +       colormap = GifMakeMapObject(
208             256,                                /* Must be 256 or else fails */
209             NULL
210         );
211 @@ -2831,25 +2820,40 @@
212                 0x00                    /* Hi byte of a u_int16_t loop count */
213             };
214  
215 -       int gif_status = EGifPutExtensionFirst(
216 +       int gif_status = EGifPutExtensionLeader(
217 +           ft,
218 +           APPLICATION_EXT_FUNC_CODE
219 +       );
220 +       if(gif_status != GIF_OK)
221 +       {
222 +           ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
223 +           return(-1);
224 +       }
225 +
226 +       gif_status = EGifPutExtensionBlock(
227             ft,
228 -           APPLICATION_EXT_FUNC_CODE,
229             sizeof(buf), buf
230         );
231         if(gif_status != GIF_OK)
232         {
233 -           ImgSaveSetError(EGIF_STR_ERROR(gif_status));
234 +           ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
235             return(-1);
236         }
237  
238 -       gif_status = EGifPutExtensionLast(
239 +       gif_status = EGifPutExtensionBlock(
240             ft,
241 -           APPLICATION_EXT_FUNC_CODE,
242             sizeof(buf2), buf2
243         );
244         if(gif_status != GIF_OK)
245         {
246 -           ImgSaveSetError(EGIF_STR_ERROR(gif_status));
247 +           ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
248 +           return(-1);
249 +       }
250 +
251 +       gif_status = EGifPutExtensionTrailer(ft);
252 +       if(gif_status != GIF_OK)
253 +       {
254 +           ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
255             return(-1);
256         }
257  
258 @@ -3010,13 +3014,13 @@
259             if((status2 != 0) || (colormap == NULL) || (cidx == NULL))
260             {
261                 if(colormap != NULL)
262 -                   FreeMapObject(colormap);
263 +                   GifFreeMapObject(colormap);
264                 free(cidx);
265                 continue;
266             }
267             if(*ctx->user_aborted)
268             {
269 -               FreeMapObject(colormap);
270 +               GifFreeMapObject(colormap);
271                 free(cidx);
272                 status = -4;
273                 break;
274 @@ -3034,8 +3038,8 @@
275                 );
276                 if(gif_status != GIF_OK)
277                 {
278 -                   ImgSaveSetError(EGIF_STR_ERROR(gif_status));
279 -                   FreeMapObject(colormap);
280 +                   ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
281 +                   GifFreeMapObject(colormap);
282                     free(cidx);
283                     status = -1;
284                     break;
285 @@ -3048,7 +3052,7 @@
286                 {
287                     if(ImgWriteGIFLoopingBlock(ft) != 0)
288                     {
289 -                       FreeMapObject(colormap);
290 +                       GifFreeMapObject(colormap);
291                         free(cidx);
292                         status = -1;
293                         break;
294 @@ -3087,8 +3091,8 @@
295                 );
296                 if(gif_status != GIF_OK)
297                 {
298 -                   ImgSaveSetError(EGIF_STR_ERROR(gif_status));
299 -                   FreeMapObject(colormap);
300 +                   ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
301 +                   GifFreeMapObject(colormap);
302                     free(cidx);
303                     status = -1;
304                     break;
305 @@ -3106,15 +3110,15 @@
306             );
307             if(gif_status != GIF_OK)
308             {
309 -               ImgSaveSetError(EGIF_STR_ERROR(gif_status));
310 -               FreeMapObject(colormap);
311 +               ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
312 +               GifFreeMapObject(colormap);
313                 free(cidx);
314                 status = -1;
315                 break;
316             }
317  
318             /* Delete the GIF colormap */
319 -           FreeMapObject(colormap);
320 +           GifFreeMapObject(colormap);
321  
322             /* Write the image data for this frame */
323             if(ctx->interlaced)
324 @@ -3140,7 +3144,7 @@
325                         );
326                         if(gif_status != GIF_OK)
327                         {
328 -                           ImgSaveSetError(EGIF_STR_ERROR(gif_status));
329 +                           ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
330                             status = -1;
331                             break;
332                         }
333 @@ -3184,7 +3188,7 @@
334                     );
335                     if(gif_status != GIF_OK)
336                     {
337 -                       ImgSaveSetError(EGIF_STR_ERROR(gif_status));
338 +                       ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
339                         status = -1;
340                         break;
341                     }
342 @@ -3326,7 +3330,7 @@
343         if(cidx == NULL)
344         {
345             const int error_code = errno;
346 -           FreeMapObject(colormap);
347 +           GifFreeMapObject(colormap);
348             imgio_last_save_error = "Memory allocation error";
349             errno = error_code;
350             return(-3);
351 @@ -3398,7 +3402,7 @@
352                 );
353                 if(gif_status != GIF_OK)
354                 {
355 -                   ImgSaveSetError(EGIF_STR_ERROR(gif_status));
356 +                   ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
357                     status = -1;
358                     break;
359                 }
360 @@ -3447,7 +3451,7 @@
361                 );
362                 if(gif_status != GIF_OK)
363                 {
364 -                   ImgSaveSetError(EGIF_STR_ERROR(gif_status));
365 +                   ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
366                     status = -1;
367                     break;
368                 }
369 @@ -3463,7 +3467,7 @@
370             );
371             if(gif_status != GIF_OK)
372             {
373 -               ImgSaveSetError(EGIF_STR_ERROR(gif_status));
374 +               ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
375                 status = -1;
376                 break;
377             }
378 @@ -3491,7 +3495,7 @@
379                         );
380                         if(gif_status != GIF_OK)
381                         {
382 -                           ImgSaveSetError(EGIF_STR_ERROR(gif_status));
383 +                           ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
384                             status = -1;
385                             break;
386                         }
387 @@ -3535,7 +3539,7 @@
388                     );
389                     if(gif_status != GIF_OK)
390                     {
391 -                       ImgSaveSetError(EGIF_STR_ERROR(gif_status));
392 +                       ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
393                         status = -1;
394                         break;
395                     }
396 @@ -3566,7 +3570,7 @@
397         }
398  
399         /* Delete the GIF colormap */
400 -       FreeMapObject(colormap);
401 +       GifFreeMapObject(colormap);
402  
403         /* Delete the GIF color index image data */
404         free(cidx);
405 @@ -3698,7 +3702,7 @@
406         if(cidx == NULL)
407         {
408             const int error_code = errno;
409 -           FreeMapObject(colormap);
410 +           GifFreeMapObject(colormap);
411             imgio_last_save_error = "Memory allocation error";
412             errno = error_code;
413             return(-3);
414 @@ -3770,7 +3774,7 @@
415                 );
416                 if(gif_status != GIF_OK)
417                 {
418 -                   ImgSaveSetError(EGIF_STR_ERROR(gif_status));
419 +                   ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
420                     status = -1;
421                     break;
422                 }
423 @@ -3819,7 +3823,7 @@
424                 );
425                 if(gif_status != GIF_OK)
426                 {
427 -                   ImgSaveSetError(EGIF_STR_ERROR(gif_status));
428 +                   ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
429                     status = -1;
430                     break;
431                 }
432 @@ -3835,7 +3839,7 @@
433             );
434             if(gif_status != GIF_OK)
435             {
436 -               ImgSaveSetError(EGIF_STR_ERROR(gif_status));
437 +               ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
438                 status = -1;
439                 break;
440             }
441 @@ -3865,7 +3869,7 @@
442                         );
443                         if(gif_status != GIF_OK)
444                         {
445 -                           ImgSaveSetError(EGIF_STR_ERROR(gif_status));
446 +                           ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
447                             status = -1;
448                             break;
449                         }
450 @@ -3910,7 +3914,7 @@
451                     );
452                     if(gif_status != GIF_OK)
453                     {
454 -                       ImgSaveSetError(EGIF_STR_ERROR(gif_status));
455 +                       ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
456                         status = -1;
457                         break;
458                     }
459 @@ -3941,7 +3945,7 @@
460         }
461  
462         /* Delete the GIF colormap */
463 -       FreeMapObject(colormap);
464 +       GifFreeMapObject(colormap);
465  
466         /* Delete the GIF color index image data */
467         free(cidx);
468 @@ -3979,7 +3983,8 @@
469         const int       bpp = 4,                /* RGBA */
470                         _bpl = (bpl > 0) ? bpl : width * bpp;
471         int             user_aborted = 0,
472 -                       gif_status;
473 +                       gif_status,
474 +                       gif_error;
475         ImgGIFWriteContext *ctx;
476  
477  #define CLEANUP_RETURN(_v_)            {       \
478 @@ -4108,11 +4113,12 @@
479          */
480         ctx->gif_file = EGifOpen(
481             ctx,
482 -           ImgWriteGIFWriteCB
483 +           ImgWriteGIFWriteCB,
484 +           &gif_error
485         );
486         if(ctx->gif_file == NULL)
487         {
488 -           ImgSaveSetError(EGIF_STR_ERROR(GifLastError()));
489 +           ImgSaveSetError(EGIF_STR_ERROR(gif_error));
490             CLEANUP_RETURN(-1);
491         }
492  
493 @@ -4150,7 +4156,7 @@
494             );
495             if(gif_status != GIF_OK)
496             {
497 -               ImgSaveSetError(EGIF_STR_ERROR(gif_status));
498 +               ImgSaveSetError(EGIF_STR_ERROR(ctx->gif_file->Error));
499                 ctx->status = -1;
500             }
501         }
502 @@ -4172,12 +4178,13 @@
503  
504         /* End the GIF encoding */
505         gif_status = EGifCloseFile(ctx->gif_file);
506 -       ctx->gif_file = NULL;
507         if(gif_status != GIF_OK)
508         {
509 -           ImgSaveSetError(EGIF_STR_ERROR(gif_status));
510 +           ImgSaveSetError(EGIF_STR_ERROR(ctx->gif_file->Error));
511 +           free(ctx->gif_file);
512             ctx->status = -1;
513         }
514 +       ctx->gif_file = NULL;
515  
516         if(*ctx->user_aborted)
517         {
This page took 0.142159 seconds and 3 git commands to generate.