--- a/wrlib/gif.c 2023-04-25 04:54:18.000000000 -0500 +++ b/wrlib/gif.c 2023-04-25 04:54:23.000000000 -0500 @@ -52,6 +52,7 @@ unsigned char rmap[256]; unsigned char gmap[256]; unsigned char bmap[256]; + int gif_error; if (index < 0) index = 0; @@ -59,10 +60,10 @@ /* default error message */ RErrorCode = RERR_BADINDEX; - gif = DGifOpenFileName(file); + gif = DGifOpenFileName(file, &gif_error); if (!gif) { - switch (GifLastError()) { + switch (gif_error) { case D_GIF_ERR_OPEN_FAILED: RErrorCode = RERR_OPEN; break; @@ -77,7 +78,7 @@ } if (gif->SWidth < 1 || gif->SHeight < 1) { - DGifCloseFile(gif); + DGifCloseFile(gif, NULL); RErrorCode = RERR_BADIMAGEFILE; return NULL; } @@ -199,17 +200,8 @@ /* yuck! */ goto did_not_get_any_errors; giferr: - switch (GifLastError()) { - case D_GIF_ERR_OPEN_FAILED: - RErrorCode = RERR_OPEN; - break; - case D_GIF_ERR_READ_FAILED: - RErrorCode = RERR_READ; - break; - default: - RErrorCode = RERR_BADIMAGEFILE; - break; - } + /* With gif_lib v5 there's no way to know what went wrong */ + RErrorCode = RERR_BADIMAGEFILE; bye: if (image) RReleaseImage(image); @@ -220,7 +212,7 @@ free(buffer); if (gif) - DGifCloseFile(gif); + DGifCloseFile(gif, NULL); return image; }