1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-28 17:32:29 +01:00

wrlib: Add support for v5 of the gif_lib API

As reported by Nicolas (nhs), compilation of wrlib is broken when
switching to gif_lib v5.

The API of gif_lib has known little change to provide thread-safe usage,
so we now detect this in configure and and use the functions as appropriate
in gif.c

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This commit is contained in:
Christophe CURIS
2013-11-03 13:08:11 +01:00
committed by Carlos R. Mafra
parent 7831acebe3
commit a7663fbbcf
2 changed files with 27 additions and 4 deletions

View File

@@ -48,6 +48,7 @@ RImage *RLoadGIF(const char *file, int index)
GifRecordType recType;
ColorMapObject *colormap;
unsigned char rmap[256], gmap[256], bmap[256];
int gif_error;
if (index < 0)
index = 0;
@@ -55,10 +56,17 @@ RImage *RLoadGIF(const char *file, int index)
/* default error message */
RErrorCode = RERR_BADINDEX;
#if USE_GIF == 4
gif = DGifOpenFileName(file);
#else /* USE_GIF == 5 */
gif = DGifOpenFileName(file, &gif_error);
#endif
if (!gif) {
switch (GifLastError()) {
#if USE_GIF == 4
gif_error = GifLastError();
#endif
switch (gif_error) {
case D_GIF_ERR_OPEN_FAILED:
RErrorCode = RERR_OPEN;
break;
@@ -182,6 +190,7 @@ RImage *RLoadGIF(const char *file, int index)
/* yuck! */
goto did_not_get_any_errors;
giferr:
#if USE_GIF == 4
switch (GifLastError()) {
case D_GIF_ERR_OPEN_FAILED:
RErrorCode = RERR_OPEN;
@@ -193,6 +202,10 @@ RImage *RLoadGIF(const char *file, int index)
RErrorCode = RERR_BADIMAGEFILE;
break;
}
#else
/* With gif_lib v5 there's no way to know what went wrong */
RErrorCode = RERR_BADIMAGEFILE;
#endif
bye:
if (image)
RReleaseImage(image);