handle giflib api change

This commit is contained in:
sthen 2015-03-28 17:23:23 +00:00
parent 4d511f30a3
commit e0da2dd381
5 changed files with 147 additions and 37 deletions

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-mapimageio_c,v 1.3 2015/03/28 17:23:23 sthen Exp $
giflib 5.1+
--- mapimageio.c.orig Sat Mar 28 17:07:24 2015
+++ mapimageio.c Sat Mar 28 17:07:38 2015
@@ -1303,7 +1303,7 @@ int readGIF(char *path, rasterBufferObj *rb)
} while (recordType != TERMINATE_RECORD_TYPE);
- if (DGifCloseFile(image) == GIF_ERROR) {
+ if (DGifCloseFile(image, NULL) == GIF_ERROR) {
#if defined GIFLIB_MAJOR && GIFLIB_MAJOR >= 5
msSetError(MS_MISCERR,"failed to close gif after loading: %s","readGIF()", gif_error_msg(image->Error));
#else

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_gif_imageio_gifinput_cpp,v 1.1 2015/03/28 17:23:23 sthen Exp $
--- src/gif.imageio/gifinput.cpp.orig Sat Mar 28 17:08:05 2015
+++ src/gif.imageio/gifinput.cpp Sat Mar 28 17:08:14 2015
@@ -497,7 +497,7 @@ inline bool
GIFInput::close (void)
{
if (m_gif_file) {
- if (DGifCloseFile (m_gif_file) == GIF_ERROR) {
+ if (DGifCloseFile (m_gif_file, NULL) == GIF_ERROR) {
error ("Error trying to close the file.");
return false;
}

View File

@ -0,0 +1,84 @@
$OpenBSD: patch-src_modules_loaders_gif_evas_image_load_gif_c,v 1.3 2015/03/28 17:23:23 sthen Exp $
--- src/modules/loaders/gif/evas_image_load_gif.c.orig Sat Mar 28 17:21:04 2015
+++ src/modules/loaders/gif/evas_image_load_gif.c Sat Mar 28 17:21:31 2015
@@ -338,7 +338,7 @@ _evas_image_load_frame_image_data(Image_Entry *ie, Gif
if (!cmap)
{
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
for (i = 0; i < scale_h; i++)
{
free(rows[i]);
@@ -725,7 +725,7 @@ evas_image_load_file_head_gif(Image_Entry *ie, const c
if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
IMG_TOO_BIG(w, h))
{
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
if (IMG_TOO_BIG(w, h))
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
else
@@ -740,7 +740,7 @@ evas_image_load_file_head_gif(Image_Entry *ie, const c
if (DGifGetRecordType(gif, &rec) == GIF_ERROR)
{
/* PrintGifError(); */
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
return EINA_FALSE;
}
@@ -754,7 +754,7 @@ evas_image_load_file_head_gif(Image_Entry *ie, const c
if (DGifGetImageDesc(gif) == GIF_ERROR)
{
/* PrintGifError(); */
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
return EINA_FALSE;
}
@@ -762,7 +762,7 @@ evas_image_load_file_head_gif(Image_Entry *ie, const c
if (DGifGetCode(gif, &img_code, &img) == GIF_ERROR)
{
/* PrintGifError(); */
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
return EINA_FALSE;
}
@@ -818,7 +818,7 @@ evas_image_load_file_head_gif(Image_Entry *ie, const c
ie->frames = NULL;
}
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
*error = EVAS_LOAD_ERROR_NONE;
return EINA_TRUE;
}
@@ -885,7 +885,7 @@ evas_image_load_specific_frame(Image_Entry *ie, const
}
ie->frames = eina_list_append(ie->frames, frame);
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
return EINA_TRUE;
}
@@ -959,7 +959,7 @@ evas_image_load_file_data_gif(Image_Entry *ie, const c
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
return EINA_FALSE;
}
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
*error = EVAS_LOAD_ERROR_NONE;
return EINA_TRUE;
}
@@ -1080,7 +1080,7 @@ evas_image_load_frame_duration_gif(Image_Entry *ie, co
}
} while (rec != TERMINATE_RECORD_TYPE);
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
return duration;
}

View File

@ -1,36 +1,24 @@
$OpenBSD: patch-wrlib_gif_c,v 1.1 2013/09/25 07:58:51 sthen Exp $
$OpenBSD: patch-wrlib_gif_c,v 1.2 2015/03/28 17:23:23 sthen Exp $
handle giflib 5.0+
handle giflib 5.1+
--- wrlib/gif.c.orig Tue Oct 12 12:21:01 2004
+++ wrlib/gif.c Thu Sep 19 14:59:11 2013
@@ -49,6 +49,7 @@ RLoadGIF(RContext *context, char *file, int index)
GifPixelType *buffer = NULL;
int i, j, k;
int width, height;
+ int giferr = 0;
GifRecordType recType;
ColorMapObject *colormap;
unsigned char rmap[256];
@@ -61,10 +62,10 @@ RLoadGIF(RContext *context, char *file, int index)
/* default error message */
RErrorCode = RERR_BADINDEX;
--- wrlib/gif.c.orig Sat Mar 28 17:16:05 2015
+++ wrlib/gif.c Sat Mar 28 17:16:14 2015
@@ -80,7 +80,7 @@ RLoadGIF(RContext *context, char *file, int index)
}
- gif = DGifOpenFileName(file);
+ gif = DGifOpenFileName(file, &giferr);
if (gif->SWidth<1 || gif->SHeight<1) {
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
RErrorCode = RERR_BADIMAGEFILE;
return NULL;
}
@@ -224,7 +224,7 @@ did_not_get_any_errors:
free(buffer);
if (!gif) {
- switch (GifLastError()) {
+ switch (giferr) {
case D_GIF_ERR_OPEN_FAILED:
RErrorCode = RERR_OPEN;
break;
@@ -202,7 +203,7 @@ RLoadGIF(RContext *context, char *file, int index)
/* yuck! */
goto did_not_get_any_errors;
giferr:
- switch (GifLastError()) {
+ switch (gif->Error) {
case D_GIF_ERR_OPEN_FAILED:
RErrorCode = RERR_OPEN;
break;
if (gif)
- DGifCloseFile(gif);
+ DGifCloseFile(gif, NULL);
return image;
}

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_libimage_gif_c,v 1.1 2013/09/25 07:58:52 sthen Exp $
--- src/libimage/gif.c.orig Sat Mar 25 15:50:51 2006
+++ src/libimage/gif.c Thu Sep 19 15:52:28 2013
$OpenBSD: patch-src_libimage_gif_c,v 1.2 2015/03/28 17:23:23 sthen Exp $
--- src/libimage/gif.c.orig Sat Mar 25 22:50:51 2006
+++ src/libimage/gif.c Sat Mar 28 17:18:01 2015
@@ -33,6 +33,7 @@ read_gif(const char *filename, int *width, int *height
{
int interlace_offset[] = { 0, 4, 2, 1 };
@ -58,6 +58,15 @@ $OpenBSD: patch-src_libimage_gif_c,v 1.1 2013/09/25 07:58:52 sthen Exp $
return(0);
}
}
@@ -154,7 +155,7 @@ read_gif(const char *filename, int *width, int *height
free(buffer);
- DGifCloseFile(infile);
+ DGifCloseFile(infile, NULL);
return(1);
}
@@ -178,7 +179,7 @@ write_gif(const char *filename, int width, int height,
return(0);
}
@ -119,11 +128,13 @@ $OpenBSD: patch-src_libimage_gif_c,v 1.1 2013/09/25 07:58:52 sthen Exp $
return(0);
}
ptr += width;
@@ -233,7 +234,7 @@ write_gif(const char *filename, int width, int height,
@@ -232,8 +233,8 @@ write_gif(const char *filename, int width, int height,
EGifSpew(outfile);
if (EGifCloseFile(outfile) == GIF_ERROR)
- if (EGifCloseFile(outfile) == GIF_ERROR)
- PrintGifError();
+ if (EGifCloseFile(outfile, NULL) == GIF_ERROR)
+ fprintf(stderr, "giflib error: %s\n", GifErrorString(outfile->Error));
free(buffer);