--- gdk_imlib/io-gif.c +++ gdk_imlib/io-gif.c @@ -30,7 +30,11 @@ loader_gif(FILE *f, int *w, int *h, int fd = fileno(f); /* Apparently rewind(f) isn't sufficient */ lseek(fd, (long) 0, 0); +#ifdef GIFLIB_MAJOR + gif = DGifOpenFileHandle(fd, NULL); +#else gif = DGifOpenFileHandle(fd); +#endif transp = -1; data = NULL; @@ -43,14 +47,22 @@ loader_gif(FILE *f, int *w, int *h, int { if (DGifGetRecordType(gif, &rec) == GIF_ERROR) { +#ifdef GIFLIB_MAJOR + fprintf(stderr, "giflib error: %s\n", GifErrorString(gif->Error)); +#else PrintGifError(); +#endif rec = TERMINATE_RECORD_TYPE; } if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done)) { if (DGifGetImageDesc(gif) == GIF_ERROR) { +#ifdef GIFLIB_MAJOR + fprintf(stderr, "giflib error: %s\n", GifErrorString(gif->Error)); +#else PrintGifError(); +#endif rec = TERMINATE_RECORD_TYPE; } *w = gif->Image.Width; @@ -62,13 +74,21 @@ loader_gif(FILE *f, int *w, int *h, int rows = malloc(*h * sizeof(GifRowType *)); if (!rows) { +#ifdef GIFLIB_MAJOR + DGifCloseFile(gif, NULL); +#else DGifCloseFile(gif); +#endif return NULL; } data = _gdk_malloc_image(*w, *h); if (!data) { +#ifdef GIFLIB_MAJOR + DGifCloseFile(gif, NULL); +#else DGifCloseFile(gif); +#endif free(rows); return NULL; } @@ -79,7 +99,11 @@ loader_gif(FILE *f, int *w, int *h, int rows[i] = malloc(*w * sizeof(GifPixelType)); if (!rows[i]) { +#ifdef GIFLIB_MAJOR + DGifCloseFile(gif, NULL); +#else DGifCloseFile(gif); +#endif for (i = 0; i < *h; i++) if (rows[i]) free(rows[i]); @@ -168,7 +192,11 @@ loader_gif(FILE *f, int *w, int *h, int } } } +#ifdef GIFLIB_MAJOR + DGifCloseFile(gif, NULL); +#else DGifCloseFile(gif); +#endif for (i = 0; i < *h; i++) free(rows[i]); free(rows); --- Imlib/load.c +++ Imlib/load.c @@ -454,7 +454,11 @@ _LoadGIF(ImlibData * id, FILE *f, int *w fd = fileno(f); /* Apparently rewind(f) isn't sufficient */ lseek(fd, (long) 0, 0); +#ifdef GIFLIB_MAJOR + gif = DGifOpenFileHandle(fd, NULL); +#else gif = DGifOpenFileHandle(fd); +#endif if (!gif) return NULL; @@ -462,14 +466,22 @@ _LoadGIF(ImlibData * id, FILE *f, int *w { if (DGifGetRecordType(gif, &rec) == GIF_ERROR) { +#ifdef GIFLIB_MAJOR + fprintf(stderr, "giflib error: %s\n", GifErrorString(gif->Error)); +#else PrintGifError(); +#endif rec = TERMINATE_RECORD_TYPE; } if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done)) { if (DGifGetImageDesc(gif) == GIF_ERROR) { +#ifdef GIFLIB_MAJOR + fprintf(stderr, "giflib error: %s\n", GifErrorString(gif->Error)); +#else PrintGifError(); +#endif rec = TERMINATE_RECORD_TYPE; } *w = gif->Image.Width; @@ -481,13 +493,21 @@ _LoadGIF(ImlibData * id, FILE *f, int *w rows = malloc(*h * sizeof(GifRowType *)); if (!rows) { +#ifdef GIFLIB_MAJOR + DGifCloseFile(gif, NULL); +#else DGifCloseFile(gif); +#endif return NULL; } data = _imlib_malloc_image(*w, *h); if (!data) { +#ifdef GIFLIB_MAJOR + DGifCloseFile(gif, NULL); +#else DGifCloseFile(gif); +#endif free(rows); return NULL; } @@ -498,7 +518,11 @@ _LoadGIF(ImlibData * id, FILE *f, int *w rows[i] = malloc(*w * sizeof(GifPixelType)); if (!rows[i]) { +#ifdef GIFLIB_MAJOR + DGifCloseFile(gif, NULL); +#else DGifCloseFile(gif); +#endif for (i = 0; i < *h; i++) if (rows[i]) free(rows[i]); @@ -587,7 +611,11 @@ _LoadGIF(ImlibData * id, FILE *f, int *w } } } +#ifdef GIFLIB_MAJOR + DGifCloseFile(gif, NULL); +#else DGifCloseFile(gif); +#endif for (i = 0; i < *h; i++) free(rows[i]); free(rows);