Lines 465-470
_LoadGIF(ImlibData * id, FILE *f, int *w
Link Here
|
465 |
int intjump[] = {8, 8, 4, 2}; |
465 |
int intjump[] = {8, 8, 4, 2}; |
466 |
int istransp, transp; |
466 |
int istransp, transp; |
467 |
int fd; |
467 |
int fd; |
|
|
468 |
#if GIFLIB_MAJOR >= 5 |
469 |
int err; |
470 |
#endif |
468 |
|
471 |
|
469 |
done = 0; |
472 |
done = 0; |
470 |
istransp = 0; |
473 |
istransp = 0; |
Lines 475-481
_LoadGIF(ImlibData * id, FILE *f, int *w
Link Here
|
475 |
fd = fileno(f); |
478 |
fd = fileno(f); |
476 |
/* Apparently rewind(f) isn't sufficient */ |
479 |
/* Apparently rewind(f) isn't sufficient */ |
477 |
lseek(fd, (long) 0, 0); |
480 |
lseek(fd, (long) 0, 0); |
|
|
481 |
#if GIFLIB_MAJOR >= 5 |
482 |
gif = DGifOpenFileHandle(fd, &err); |
483 |
#else |
478 |
gif = DGifOpenFileHandle(fd); |
484 |
gif = DGifOpenFileHandle(fd); |
|
|
485 |
#endif |
479 |
|
486 |
|
480 |
if (!gif) |
487 |
if (!gif) |
481 |
return NULL; |
488 |
return NULL; |
Lines 502-514
_LoadGIF(ImlibData * id, FILE *f, int *w
Link Here
|
502 |
rows = malloc(*h * sizeof(GifRowType *)); |
509 |
rows = malloc(*h * sizeof(GifRowType *)); |
503 |
if (!rows) |
510 |
if (!rows) |
504 |
{ |
511 |
{ |
|
|
512 |
#if GIFLIB_MAJOR >= 5 |
513 |
DGifCloseFile(gif, &err); |
514 |
#else |
505 |
DGifCloseFile(gif); |
515 |
DGifCloseFile(gif); |
|
|
516 |
#endif |
506 |
return NULL; |
517 |
return NULL; |
507 |
} |
518 |
} |
508 |
data = _imlib_malloc_image(*w, *h); |
519 |
data = _imlib_malloc_image(*w, *h); |
509 |
if (!data) |
520 |
if (!data) |
510 |
{ |
521 |
{ |
|
|
522 |
#if GIFLIB_MAJOR >= 5 |
523 |
DGifCloseFile(gif, &err); |
524 |
#else |
511 |
DGifCloseFile(gif); |
525 |
DGifCloseFile(gif); |
|
|
526 |
#endif |
512 |
free(rows); |
527 |
free(rows); |
513 |
return NULL; |
528 |
return NULL; |
514 |
} |
529 |
} |
Lines 519-525
_LoadGIF(ImlibData * id, FILE *f, int *w
Link Here
|
519 |
rows[i] = malloc(*w * sizeof(GifPixelType)); |
534 |
rows[i] = malloc(*w * sizeof(GifPixelType)); |
520 |
if (!rows[i]) |
535 |
if (!rows[i]) |
521 |
{ |
536 |
{ |
|
|
537 |
#if GIFLIB_MAJOR >= 5 |
538 |
DGifCloseFile(gif, &err); |
539 |
#else |
522 |
DGifCloseFile(gif); |
540 |
DGifCloseFile(gif); |
|
|
541 |
#endif |
523 |
for (i = 0; i < *h; i++) |
542 |
for (i = 0; i < *h; i++) |
524 |
if (rows[i]) |
543 |
if (rows[i]) |
525 |
free(rows[i]); |
544 |
free(rows[i]); |
Lines 608-614
_LoadGIF(ImlibData * id, FILE *f, int *w
Link Here
|
608 |
} |
627 |
} |
609 |
} |
628 |
} |
610 |
} |
629 |
} |
|
|
630 |
#if GIFLIB_MAJOR >= 5 |
631 |
DGifCloseFile(gif, &err); |
632 |
#else |
611 |
DGifCloseFile(gif); |
633 |
DGifCloseFile(gif); |
|
|
634 |
#endif |
612 |
for (i = 0; i < *h; i++) |
635 |
for (i = 0; i < *h; i++) |
613 |
free(rows[i]); |
636 |
free(rows[i]); |
614 |
free(rows); |
637 |
free(rows); |