Lines 431-436
Link Here
|
431 |
#endif /* HAVE_LIBTIFF */ |
431 |
#endif /* HAVE_LIBTIFF */ |
432 |
|
432 |
|
433 |
#ifdef HAVE_LIBGIF |
433 |
#ifdef HAVE_LIBGIF |
|
|
434 |
|
435 |
static void |
436 |
PrintGifError(void) |
437 |
{ |
438 |
char *Err = GifErrorString(0); |
439 |
|
440 |
if (Err != NULL) |
441 |
fprintf(stderr, "\nGIF-LIB error: %s.\n", Err); |
442 |
else |
443 |
fprintf(stderr, "\nGIF-LIB undefined error %d.\n", GifError()); |
444 |
} |
434 |
unsigned char * |
445 |
unsigned char * |
435 |
_LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t) |
446 |
_LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t) |
436 |
{ |
447 |
{ |
Lines 444-449
Link Here
|
444 |
int intjump[] = {8, 8, 4, 2}; |
455 |
int intjump[] = {8, 8, 4, 2}; |
445 |
int istransp, transp; |
456 |
int istransp, transp; |
446 |
int fd; |
457 |
int fd; |
|
|
458 |
int Error; |
447 |
|
459 |
|
448 |
done = 0; |
460 |
done = 0; |
449 |
istransp = 0; |
461 |
istransp = 0; |
Lines 454-460
Link Here
|
454 |
fd = fileno(f); |
466 |
fd = fileno(f); |
455 |
/* Apparently rewind(f) isn't sufficient */ |
467 |
/* Apparently rewind(f) isn't sufficient */ |
456 |
lseek(fd, (long) 0, 0); |
468 |
lseek(fd, (long) 0, 0); |
457 |
gif = DGifOpenFileHandle(fd); |
469 |
gif = DGifOpenFileHandle(fd,&Error); |
458 |
|
470 |
|
459 |
if (!gif) |
471 |
if (!gif) |
460 |
return NULL; |
472 |
return NULL; |
Lines 481-493
Link Here
|
481 |
rows = malloc(*h * sizeof(GifRowType *)); |
493 |
rows = malloc(*h * sizeof(GifRowType *)); |
482 |
if (!rows) |
494 |
if (!rows) |
483 |
{ |
495 |
{ |
484 |
DGifCloseFile(gif); |
496 |
DGifCloseFile(gif,&Error); |
485 |
return NULL; |
497 |
return NULL; |
486 |
} |
498 |
} |
487 |
data = _imlib_malloc_image(*w, *h); |
499 |
data = _imlib_malloc_image(*w, *h); |
488 |
if (!data) |
500 |
if (!data) |
489 |
{ |
501 |
{ |
490 |
DGifCloseFile(gif); |
502 |
DGifCloseFile(gif,&Error); |
491 |
free(rows); |
503 |
free(rows); |
492 |
return NULL; |
504 |
return NULL; |
493 |
} |
505 |
} |
Lines 498-504
Link Here
|
498 |
rows[i] = malloc(*w * sizeof(GifPixelType)); |
510 |
rows[i] = malloc(*w * sizeof(GifPixelType)); |
499 |
if (!rows[i]) |
511 |
if (!rows[i]) |
500 |
{ |
512 |
{ |
501 |
DGifCloseFile(gif); |
513 |
DGifCloseFile(gif,&Error); |
502 |
for (i = 0; i < *h; i++) |
514 |
for (i = 0; i < *h; i++) |
503 |
if (rows[i]) |
515 |
if (rows[i]) |
504 |
free(rows[i]); |
516 |
free(rows[i]); |
Lines 587-593
Link Here
|
587 |
} |
599 |
} |
588 |
} |
600 |
} |
589 |
} |
601 |
} |
590 |
DGifCloseFile(gif); |
602 |
DGifCloseFile(gif,&Error); |
591 |
for (i = 0; i < *h; i++) |
603 |
for (i = 0; i < *h; i++) |
592 |
free(rows[i]); |
604 |
free(rows[i]); |
593 |
free(rows); |
605 |
free(rows); |