Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Update
xplanet
xplanet-giflib5.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xplanet-giflib5.patch of Package xplanet
--- src/libimage/gif.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) Index: xplanet-1.3.0/src/libimage/gif.c =================================================================== --- xplanet-1.3.0.orig/src/libimage/gif.c +++ xplanet-1.3.0/src/libimage/gif.c @@ -23,6 +23,35 @@ #include <gif_lib.h> +#if defined(GIFLIB_MAJOR) +# if GIFLIB_MAOJR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1) +# define DGifCloseFile(x) DGifCloseFile(x, NULL) +# define EGifCloseFile(x) EGifCloseFile(x, NULL) +# endif +# if GIFLIB_MAJOR >= 5 +/* old giflib did define TRUE/FALSE */ +# ifndef TRUE +# define TRUE 1 +# endif /* TRUE */ +# ifndef FALSE +# define FALSE 0 +# endif /* FALSE */ + +static void +gif_error(int err) +{ + const char * Err = GifErrorString(err); + if (Err != NULL) + fprintf(stderr, "\nGIF-LIB error: %s.\n", Err); + else + fprintf(stderr, "\nGIF-LIB undefined error %d.\n", err); +} + +# define QuantizeBuffer GifQuantizeBuffer +# define MakeMapObject GifMakeMapObject +# endif +#endif + /* A lot of this is based on the gif2rgb and rgb2gif codes in the libungif distribution. @@ -42,11 +71,20 @@ read_gif(const char *filename, int *widt int color_index; unsigned char *ptr = NULL; +#if GIFLIB_MAJOR >= 5 + int err; + infile = DGifOpenFileName(filename, &err); +#else infile = DGifOpenFileName(filename); +#endif if (infile == NULL) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(err); +#endif return(0); } @@ -54,7 +92,11 @@ read_gif(const char *filename, int *widt { if (DGifGetRecordType(infile, &record_type) == GIF_ERROR) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(infile->Error); +#endif return(0); } @@ -63,7 +105,11 @@ read_gif(const char *filename, int *widt case IMAGE_DESC_RECORD_TYPE: if (DGifGetImageDesc(infile) == GIF_ERROR) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(infile->Error); +#endif return(0); } @@ -107,14 +153,22 @@ read_gif(const char *filename, int *widt GifByteType *ext; if (DGifGetExtension(infile, &ext_code, &ext) == GIF_ERROR) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(infile->Error); +#endif return(0); } while (ext != NULL) { if (DGifGetExtensionNext(infile, &ext) == GIF_ERROR) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(infile->Error); +#endif return(0); } } @@ -166,6 +220,9 @@ write_gif(const char *filename, int widt GifByteType *red, *green, *blue, *buffer, *ptr; GifFileType *outfile; ColorMapObject *colormap; +#if GIFLIB_MAJOR >= 5 + int err; +#endif red = malloc(width * height * sizeof(GifByteType)); green = malloc(width * height * sizeof(GifByteType)); @@ -190,7 +247,11 @@ write_gif(const char *filename, int widt if (QuantizeBuffer(width, height, &colormap_size, red, green, blue, buffer, colormap->Colors) == GIF_ERROR) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + /* gif utilities don't print anything about the error reason also */ +#endif return(0); } @@ -198,24 +259,40 @@ write_gif(const char *filename, int widt free(green); free(blue); +#if GIFLIB_MAJOR < 5 outfile = EGifOpenFileName((char *) filename, FALSE); +#else + outfile = EGifOpenFileName((char *) filename, FALSE, &err); +#endif if (outfile == NULL) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(err); +#endif return(0); } if (EGifPutScreenDesc(outfile, width, height, colormap_size, 0, colormap) == GIF_ERROR) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(outfile->Error); +#endif return(0); } if (EGifPutImageDesc(outfile, 0, 0, width, height, FALSE, NULL) == GIF_ERROR) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(outfile->Error); +#endif return(0); } @@ -224,7 +301,11 @@ write_gif(const char *filename, int widt { if (EGifPutLine(outfile, ptr, width) == GIF_ERROR) { +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(outfile->Error); +#endif return(0); } ptr += width; @@ -233,7 +314,11 @@ write_gif(const char *filename, int widt EGifSpew(outfile); if (EGifCloseFile(outfile) == GIF_ERROR) +#if GIFLIB_MAJOR < 5 PrintGifError(); +#else + gif_error(outfile->Error); +#endif free(buffer);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor