Skip to content

Instantly share code, notes, and snippets.

@scottjg
Last active August 29, 2015 14:14
Show Gist options
  • Save scottjg/bfa68b03ead796ce4559 to your computer and use it in GitHub Desktop.
Save scottjg/bfa68b03ead796ce4559 to your computer and use it in GitHub Desktop.
patch for vice 2.4 with giflib5
diff -ru vice-2.4.orig/src/gfxoutputdrv/gifdrv.c vice-2.4/src/gfxoutputdrv/gifdrv.c
--- vice-2.4.orig/src/gfxoutputdrv/gifdrv.c 2015-01-30 18:55:20.000000000 -0800
+++ vice-2.4/src/gfxoutputdrv/gifdrv.c 2015-01-30 19:29:56.000000000 -0800
@@ -42,10 +42,16 @@
#if GIFLIB_MAJOR >= 5
#define VICE_EGifOpenFileName(x, y, z) EGifOpenFileName(x, y, z)
+#if GIFLIB_MINOR >= 1
+#define VICE_EGifCloseFile(x) EGifCloseFile(x, NULL)
+#else
+#define VICE_EGifCloseFile(x) EGifCloseFile(x)
+#endif
#define VICE_MakeMapObject GifMakeMapObject
#define VICE_FreeMapObject GifFreeMapObject
#else
#define VICE_EGifOpenFileName(x, y, z) EGifOpenFileName(x, y)
+#define VICE_EGifCloseFile(x, y) EGifCloseFile(x)
#define VICE_MakeMapObject MakeMapObject
#define VICE_FreeMapObject FreeMapObject
#endif
@@ -114,7 +116,7 @@
if (EGifPutScreenDesc(sdata->fd, screenshot->width, screenshot->height, 8, 0, gif_colors) == GIF_ERROR ||
EGifPutImageDesc(sdata->fd, 0, 0, screenshot->width, screenshot->height, 0, NULL) == GIF_ERROR)
{
- EGifCloseFile(sdata->fd);
+ VICE_EGifCloseFile(sdata->fd);
VICE_FreeMapObject(gif_colors);
lib_free(sdata->data);
lib_free(sdata->ext_filename);
@@ -145,7 +147,7 @@
sdata = screenshot->gfxoutputdrv_data;
- EGifCloseFile(sdata->fd);
+ VICE_EGifCloseFile(sdata->fd);
VICE_FreeMapObject(gif_colors);
/* for some reason giflib will create a file with unexpected
@@ -184,7 +186,7 @@
static int gifdrv_close_memmap(void)
{
- EGifCloseFile(gifdrv_memmap_fd);
+ VICE_EGifCloseFile(gifdrv_memmap_fd);
VICE_FreeMapObject(gif_colors);
lib_free(gifdrv_memmap_ext_filename);
@@ -231,7 +233,7 @@
if (EGifPutScreenDesc(gifdrv_memmap_fd, x_size, y_size, 8, 0, gif_colors) == GIF_ERROR ||
EGifPutImageDesc(gifdrv_memmap_fd, 0, 0, x_size, y_size, 0, NULL) == GIF_ERROR)
{
- EGifCloseFile(gifdrv_memmap_fd);
+ VICE_EGifCloseFile(gifdrv_memmap_fd);
VICE_FreeMapObject(gif_colors);
lib_free(gifdrv_memmap_ext_filename);
return -1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment