Lines 3-8
Link Here
|
3 |
#include "Imlib.h" |
3 |
#include "Imlib.h" |
4 |
#include "Imlib_private.h" |
4 |
#include "Imlib_private.h" |
5 |
#include <setjmp.h> |
5 |
#include <setjmp.h> |
|
|
6 |
#include <gifutil.h> |
6 |
|
7 |
|
7 |
#define G_MAXINT ((int) 0x7fffffff) |
8 |
#define G_MAXINT ((int) 0x7fffffff) |
8 |
|
9 |
|
Lines 431-436
Link Here
|
431 |
#endif /* HAVE_LIBTIFF */ |
432 |
#endif /* HAVE_LIBTIFF */ |
432 |
|
433 |
|
433 |
#ifdef HAVE_LIBGIF |
434 |
#ifdef HAVE_LIBGIF |
|
|
435 |
/*------------------------*/ |
436 |
/*------------------------*/ |
434 |
unsigned char * |
437 |
unsigned char * |
435 |
_LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t) |
438 |
_LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t) |
436 |
{ |
439 |
{ |
Lines 454-475
Link Here
|
454 |
fd = fileno(f); |
457 |
fd = fileno(f); |
455 |
/* Apparently rewind(f) isn't sufficient */ |
458 |
/* Apparently rewind(f) isn't sufficient */ |
456 |
lseek(fd, (long) 0, 0); |
459 |
lseek(fd, (long) 0, 0); |
|
|
460 |
|
461 |
#if GIFLIB_MAJOR >= 5 |
462 |
int errCode = 0; |
463 |
|
464 |
gif = DGifOpenFileHandle(fd, &errCode); |
465 |
if (!gif) |
466 |
{ |
467 |
const char* gifliberr = (const char*) GifErrorString(errCode); |
468 |
if (gifliberr == NULL) |
469 |
gifliberr = "Unknown error"; |
470 |
fprintf(stderr, "%s\n", gifliberr); |
471 |
return NULL; |
472 |
} |
473 |
#else |
457 |
gif = DGifOpenFileHandle(fd); |
474 |
gif = DGifOpenFileHandle(fd); |
458 |
|
475 |
|
459 |
if (!gif) |
476 |
if (!gif) |
460 |
return NULL; |
477 |
return NULL; |
|
|
478 |
#endif |
479 |
|
461 |
do |
480 |
do |
462 |
{ |
481 |
{ |
463 |
if (DGifGetRecordType(gif, &rec) == GIF_ERROR) |
482 |
if (DGifGetRecordType(gif, &rec) == GIF_ERROR) |
464 |
{ |
483 |
{ |
465 |
PrintGifError(); |
484 |
_PrintGifError(gif); |
466 |
rec = TERMINATE_RECORD_TYPE; |
485 |
rec = TERMINATE_RECORD_TYPE; |
467 |
} |
486 |
} |
468 |
if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done)) |
487 |
if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done)) |
469 |
{ |
488 |
{ |
470 |
if (DGifGetImageDesc(gif) == GIF_ERROR) |
489 |
if (DGifGetImageDesc(gif) == GIF_ERROR) |
471 |
{ |
490 |
{ |
472 |
PrintGifError(); |
491 |
_PrintGifError(gif); |
473 |
rec = TERMINATE_RECORD_TYPE; |
492 |
rec = TERMINATE_RECORD_TYPE; |
474 |
} |
493 |
} |
475 |
*w = gif->Image.Width; |
494 |
*w = gif->Image.Width; |