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
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
14 static int ImgReadGIFReadCB(
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)
26 void ImgGIFVersion(int *major, int *minor, int *release)
28 - const char *ver_str = GIF_LIB_VERSION, *s;
30 - s = strstr(ver_str, "Version");
31 - while((*s != '\0') && (*s != ' '))
38 - while((*s != '\0') && (*s != '.'))
42 + *major = GIFLIB_MAJOR;
46 - while((*s != '\0') && (*s != '.'))
50 + *minor = GIFLIB_MINOR;
53 + *release = GIFLIB_RELEASE;
59 if(gif_status != GIF_OK)
61 - ImgOpenSetError(DGIF_STR_ERROR(gif_status));
62 + ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
68 if(gif_status != GIF_OK)
70 - ImgOpenSetError(DGIF_STR_ERROR(gif_status));
71 + ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
77 if(gif_status != GIF_OK)
79 - ImgOpenSetError(DGIF_STR_ERROR(gif_status));
80 + ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
88 - ImgOpenSetError(DGIF_STR_ERROR(gif_status));
89 + ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
95 if(gif_status != GIF_OK)
97 - ImgOpenSetError(DGIF_STR_ERROR(gif_status));
98 + ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
100 get_error_need_break = 1;
102 @@ -1421,7 +1404,7 @@
104 if(gif_status != GIF_OK)
106 - ImgOpenSetError(DGIF_STR_ERROR(gif_status));
107 + ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
111 @@ -1429,7 +1412,7 @@
115 - ImgOpenSetError(DGIF_STR_ERROR(gif_status));
116 + ImgOpenSetError(DGIF_STR_ERROR(gif_file->Error));
120 @@ -1469,7 +1452,8 @@
122 const int bpp = 4; /* RGBA */
127 GifFileType *gif_file;
128 GifRowType gif_screen_row;
129 ImgGIFReadContext *ctx = NULL;
130 @@ -1629,11 +1613,12 @@
132 ctx->gif_file = gif_file = DGifOpen(
140 - ImgOpenSetError(DGIF_STR_ERROR(GifLastError()));
141 + ImgOpenSetError(DGIF_STR_ERROR(gif_error));
145 @@ -1778,12 +1763,13 @@
147 /* End the GIF decoding */
148 gif_status = DGifCloseFile(ctx->gif_file);
149 - ctx->gif_file = NULL;
150 if(gif_status != GIF_OK)
152 - ImgOpenSetError(DGIF_STR_ERROR(gif_status));
153 + ImgOpenSetError(DGIF_STR_ERROR(ctx->gif_file->Error));
154 + free(ctx->gif_file);
157 + ctx->gif_file = NULL;
159 if(*ctx->user_aborted)
161 @@ -1974,7 +1960,8 @@
163 const int bpp = 4; /* RGBA */
168 GifFileType *gif_file;
169 GifRowType gif_screen_row;
170 ImgGIFReadContext *ctx = NULL;
171 @@ -2132,11 +2119,12 @@
173 ctx->gif_file = gif_file = DGifOpen(
181 - ImgOpenSetError(DGIF_STR_ERROR(GifLastError()));
182 + ImgOpenSetError(GifErrorString(gif_error));
186 @@ -2294,12 +2282,13 @@
188 /* End the GIF decoding */
189 gif_status = DGifCloseFile(ctx->gif_file);
190 - ctx->gif_file = NULL;
191 if(gif_status != GIF_OK)
193 - ImgOpenSetError(DGIF_STR_ERROR(gif_status));
194 + ImgOpenSetError(DGIF_STR_ERROR(ctx->gif_file->Error));
195 + free(ctx->gif_file);
198 + ctx->gif_file = NULL;
200 /* Check for user abort */
201 if(*ctx->user_aborted)
202 @@ -2770,7 +2759,7 @@
205 /* Create the GIF colormap from the colors list */
206 - colormap = MakeMapObject(
207 + colormap = GifMakeMapObject(
208 256, /* Must be 256 or else fails */
211 @@ -2831,25 +2820,40 @@
212 0x00 /* Hi byte of a u_int16_t loop count */
215 - int gif_status = EGifPutExtensionFirst(
216 + int gif_status = EGifPutExtensionLeader(
218 + APPLICATION_EXT_FUNC_CODE
220 + if(gif_status != GIF_OK)
222 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
226 + gif_status = EGifPutExtensionBlock(
228 - APPLICATION_EXT_FUNC_CODE,
231 if(gif_status != GIF_OK)
233 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
234 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
238 - gif_status = EGifPutExtensionLast(
239 + gif_status = EGifPutExtensionBlock(
241 - APPLICATION_EXT_FUNC_CODE,
244 if(gif_status != GIF_OK)
246 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
247 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
251 + gif_status = EGifPutExtensionTrailer(ft);
252 + if(gif_status != GIF_OK)
254 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
258 @@ -3010,13 +3014,13 @@
259 if((status2 != 0) || (colormap == NULL) || (cidx == NULL))
262 - FreeMapObject(colormap);
263 + GifFreeMapObject(colormap);
267 if(*ctx->user_aborted)
269 - FreeMapObject(colormap);
270 + GifFreeMapObject(colormap);
274 @@ -3034,8 +3038,8 @@
276 if(gif_status != GIF_OK)
278 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
279 - FreeMapObject(colormap);
280 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
281 + GifFreeMapObject(colormap);
285 @@ -3048,7 +3052,7 @@
287 if(ImgWriteGIFLoopingBlock(ft) != 0)
289 - FreeMapObject(colormap);
290 + GifFreeMapObject(colormap);
294 @@ -3087,8 +3091,8 @@
296 if(gif_status != GIF_OK)
298 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
299 - FreeMapObject(colormap);
300 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
301 + GifFreeMapObject(colormap);
305 @@ -3106,15 +3110,15 @@
307 if(gif_status != GIF_OK)
309 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
310 - FreeMapObject(colormap);
311 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
312 + GifFreeMapObject(colormap);
318 /* Delete the GIF colormap */
319 - FreeMapObject(colormap);
320 + GifFreeMapObject(colormap);
322 /* Write the image data for this frame */
324 @@ -3140,7 +3144,7 @@
326 if(gif_status != GIF_OK)
328 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
329 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
333 @@ -3184,7 +3188,7 @@
335 if(gif_status != GIF_OK)
337 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
338 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
342 @@ -3326,7 +3330,7 @@
345 const int error_code = errno;
346 - FreeMapObject(colormap);
347 + GifFreeMapObject(colormap);
348 imgio_last_save_error = "Memory allocation error";
351 @@ -3398,7 +3402,7 @@
353 if(gif_status != GIF_OK)
355 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
356 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
360 @@ -3447,7 +3451,7 @@
362 if(gif_status != GIF_OK)
364 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
365 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
369 @@ -3463,7 +3467,7 @@
371 if(gif_status != GIF_OK)
373 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
374 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
378 @@ -3491,7 +3495,7 @@
380 if(gif_status != GIF_OK)
382 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
383 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
387 @@ -3535,7 +3539,7 @@
389 if(gif_status != GIF_OK)
391 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
392 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
396 @@ -3566,7 +3570,7 @@
399 /* Delete the GIF colormap */
400 - FreeMapObject(colormap);
401 + GifFreeMapObject(colormap);
403 /* Delete the GIF color index image data */
405 @@ -3698,7 +3702,7 @@
408 const int error_code = errno;
409 - FreeMapObject(colormap);
410 + GifFreeMapObject(colormap);
411 imgio_last_save_error = "Memory allocation error";
414 @@ -3770,7 +3774,7 @@
416 if(gif_status != GIF_OK)
418 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
419 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
423 @@ -3819,7 +3823,7 @@
425 if(gif_status != GIF_OK)
427 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
428 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
432 @@ -3835,7 +3839,7 @@
434 if(gif_status != GIF_OK)
436 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
437 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
441 @@ -3865,7 +3869,7 @@
443 if(gif_status != GIF_OK)
445 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
446 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
450 @@ -3910,7 +3914,7 @@
452 if(gif_status != GIF_OK)
454 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
455 + ImgSaveSetError(EGIF_STR_ERROR(ft->Error));
459 @@ -3941,7 +3945,7 @@
462 /* Delete the GIF colormap */
463 - FreeMapObject(colormap);
464 + GifFreeMapObject(colormap);
466 /* Delete the GIF color index image data */
468 @@ -3979,7 +3983,8 @@
469 const int bpp = 4, /* RGBA */
470 _bpl = (bpl > 0) ? bpl : width * bpp;
471 int user_aborted = 0,
475 ImgGIFWriteContext *ctx;
477 #define CLEANUP_RETURN(_v_) { \
478 @@ -4108,11 +4113,12 @@
480 ctx->gif_file = EGifOpen(
483 + ImgWriteGIFWriteCB,
486 if(ctx->gif_file == NULL)
488 - ImgSaveSetError(EGIF_STR_ERROR(GifLastError()));
489 + ImgSaveSetError(EGIF_STR_ERROR(gif_error));
493 @@ -4150,7 +4156,7 @@
495 if(gif_status != GIF_OK)
497 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
498 + ImgSaveSetError(EGIF_STR_ERROR(ctx->gif_file->Error));
502 @@ -4172,12 +4178,13 @@
504 /* End the GIF encoding */
505 gif_status = EGifCloseFile(ctx->gif_file);
506 - ctx->gif_file = NULL;
507 if(gif_status != GIF_OK)
509 - ImgSaveSetError(EGIF_STR_ERROR(gif_status));
510 + ImgSaveSetError(EGIF_STR_ERROR(ctx->gif_file->Error));
511 + free(ctx->gif_file);
514 + ctx->gif_file = NULL;
516 if(*ctx->user_aborted)