Subject: | Prima fails to build against libgif-5.1.0 |
Hi,
With giflib-5.1.0 DGifClose() and EGifClose() require an additional arg.
I'm not sure just when the change to giflib was made, and there's no mention of it in the giflib source ChangeLog. In the gif_lib.h (version 5.0.5) that ships with latest Strawberry Perl the additional arg is *not* specified, so I'm guessing that 5.1.0 might indeed be the first release of giflib that takes the extra argument.
Anyway, attached is the patch to img/codec_ungif.c that I used to build Prima-1.39.
It worked fine for me when used with both giflib-5.1.0 and giflib-4.1.
Cheers,
Rob
Subject: | diff.txt |
--- codec_ungif.c_orig 2014-06-09 14:19:51 +1000
+++ codec_ungif.c 2014-06-09 14:32:01 +1000
@@ -34,6 +34,15 @@
#include "Icon.h"
#include <gif_lib.h>
+#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR)
+#if (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1) || (GIFLIB_MAJOR > 5)
+#define ERRORCODE_ARG ,&ec
+#else define ERRORCODE_ARG
+#endif
+#else
+#define ERRORCODE_ARG
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -356,6 +365,7 @@
static Bool
load( PImgCodec instance, PImgLoadFileInstance fi)
{
+ int ec;
PImage i = ( PImage) fi-> object;
LoadRec * l = ( LoadRec *) fi-> instance;
HV * profile = fi-> frameProperties;
@@ -363,7 +373,7 @@
/* Reopen file if rewind requested */
if ( fi-> frame <= l-> passed) {
- DGifCloseFile( l-> gft);
+ DGifCloseFile( l-> gft ERRORCODE_ARG);
l-> gft = NULL;
if ( req_seek( fi-> req, 0, SEEK_SET)) {
snprintf( fi-> errbuf, 256, "Can't rewind GIF stream, seek() error:%s", strerror(req_error( fi-> req)));
@@ -521,8 +531,9 @@
static void
close_load( PImgCodec instance, PImgLoadFileInstance fi)
{
+ int ec;
LoadRec * l = ( LoadRec *) fi-> instance;
- if ( l-> gft) DGifCloseFile( l-> gft);
+ if ( l-> gft) DGifCloseFile( l-> gft ERRORCODE_ARG);
free( l);
}
@@ -751,7 +762,8 @@
static void
close_save( PImgCodec instance, PImgSaveFileInstance fi)
{
- EGifCloseFile(( GifFileType *) fi-> instance);
+ int ec;
+ EGifCloseFile(( GifFileType *) fi-> instance ERRORCODE_ARG);
}
void