From 6b787d8d3186c7cde67a42fa875cea4268f2b053 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 6 Feb 2015 21:58:48 +0100 Subject: [PATCH] pictureviewer/gif: fix build with giflib-5.1+ --- src/driver/pictureviewer/gif.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/driver/pictureviewer/gif.cpp b/src/driver/pictureviewer/gif.cpp index 4b0a3b23e..0e082b902 100644 --- a/src/driver/pictureviewer/gif.cpp +++ b/src/driver/pictureviewer/gif.cpp @@ -14,14 +14,20 @@ extern "C" { #include } +#if GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1 +#define DGIFCLOSEFILE(x) { int _error; DGifCloseFile(x, &_error); } +#else +#define DGIFCLOSEFILE(x) DGifCloseFile(x) +#endif #include #define min(a,b) ((a) < (b) ? (a) : (b)) #define gflush return(FH_ERROR_FILE); - #define grflush { DGifCloseFile(gft); return(FH_ERROR_FORMAT); } - #define mgrflush { free(lb); free(slb); DGifCloseFile(gft); return(FH_ERROR_FORMAT); } + #define grflush { DGIFCLOSEFILE(gft); return(FH_ERROR_FORMAT); } + #define mgrflush { free(lb); free(slb); DGIFCLOSEFILE(gft); return(FH_ERROR_FORMAT); } +#if 0 #define agflush return(FH_ERROR_FORMAT); #define agrflush { DGifCloseFile(gft); return(FH_ERROR_FORMAT); } - +#endif int fh_gif_id(const char *name) { @@ -123,7 +129,7 @@ int fh_gif_load(const char *name,unsigned char **buffer,int* /*xp*/,int* /*yp*/) } } while( rt!= TERMINATE_RECORD_TYPE ); - DGifCloseFile(gft); + DGIFCLOSEFILE(gft); return(FH_ERROR_OK); } int fh_gif_getsize(const char *name,int *x,int *y, int /*wanted_width*/, int /*wanted_height*/) @@ -152,7 +158,7 @@ int fh_gif_getsize(const char *name,int *x,int *y, int /*wanted_width*/, int /*w px=gft->Image.Width; py=gft->Image.Height; *x=px; *y=py; - DGifCloseFile(gft); + DGIFCLOSEFILE(gft); return(FH_ERROR_OK); break; case EXTENSION_RECORD_TYPE: @@ -165,7 +171,7 @@ int fh_gif_getsize(const char *name,int *x,int *y, int /*wanted_width*/, int /*w } } while( rt!= TERMINATE_RECORD_TYPE ); - DGifCloseFile(gft); + DGIFCLOSEFILE(gft); return(FH_ERROR_FORMAT); } #endif