1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-21 00:25:50 +00:00

Allow building with giflib 5.1

PR:		204492
This commit is contained in:
Antoine Brodin 2015-11-12 18:35:53 +00:00
parent f44de4a8d4
commit c905c203db
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=401387
14 changed files with 269 additions and 30 deletions

View File

@ -115,7 +115,19 @@
return false;
}
}
@@ -166,7 +212,11 @@ bool GIFCodec::writeImage (std::ostream*
@@ -155,7 +201,11 @@ int GIFCodec::readImage (std::istream* s
// convert colormap to our 16bit "TIFF"format
colorspace_de_palette (image, ColorMap->ColorCount, rmap, gmap, bmap);
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ EGifCloseFile(GifFile, NULL);
+#else
EGifCloseFile(GifFile);
+#endif
return true;
}
@@ -166,7 +216,11 @@ bool GIFCodec::writeImage (std::ostream*
GifFileType* GifFile;
GifByteType* Ptr;
@ -127,7 +139,7 @@
{
std::cerr << "Error preparing GIF file for writing." << std::endl;
return false;
@@ -175,7 +225,11 @@ bool GIFCodec::writeImage (std::ostream*
@@ -175,7 +229,11 @@ bool GIFCodec::writeImage (std::ostream*
int ColorMapSize = 256;
// later use our own colormap generation
@ -139,7 +151,7 @@
if (!OutputColorMap)
return false;
@@ -203,7 +257,11 @@ bool GIFCodec::writeImage (std::ostream*
@@ -203,7 +261,11 @@ bool GIFCodec::writeImage (std::ostream*
}
@ -151,7 +163,7 @@
RedBuffer, GreenBuffer, BlueBuffer,
OutputBuffer, OutputColorMap->Colors) == GIF_ERROR) {
return false;
@@ -215,7 +273,7 @@ bool GIFCodec::writeImage (std::ostream*
@@ -215,7 +277,7 @@ bool GIFCodec::writeImage (std::ostream*
if (EGifPutScreenDesc(GifFile, image.w, image.h,
ColorMapSize, 0, OutputColorMap) == GIF_ERROR ||
EGifPutImageDesc(GifFile, 0, 0, image.w, image.h,
@ -160,12 +172,18 @@
{
std::cerr << "Error writing GIF header." << std::endl;
return false;
@@ -232,7 +290,7 @@ bool GIFCodec::writeImage (std::ostream*
@@ -232,9 +294,13 @@ bool GIFCodec::writeImage (std::ostream*
}
free (OutputBuffer);
- delete (RedBuffer); delete (GreenBuffer); delete (BlueBuffer);
+ delete[] RedBuffer; delete[] GreenBuffer; delete[] BlueBuffer;
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ EGifCloseFile(GifFile, NULL);
+#else
EGifCloseFile(GifFile);
+#endif
return true;
}

View File

@ -0,0 +1,14 @@
--- mapimageio.c.orig 2015-07-24 07:59:36 UTC
+++ mapimageio.c
@@ -1058,7 +1058,11 @@ int readGIF(char *path, rasterBufferObj
} while (recordType != TERMINATE_RECORD_TYPE);
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ if (DGifCloseFile(image, NULL) == GIF_ERROR) {
+#else
if (DGifCloseFile(image) == GIF_ERROR) {
+#endif
#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

@ -12,7 +12,19 @@
failwith("DGifOpenFileName");
}
@@ -200,7 +204,6 @@ value dGifGetLine( value hdl )
@@ -161,7 +165,11 @@ value dGifCloseFile( value hdl )
segmentation faults */
((GifFileType *)hdl)->Image.ColorMap = NULL;
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile( (GifFileType *) hdl, NULL );
+#else
DGifCloseFile( (GifFileType *) hdl );
+#endif
CAMLreturn(Val_unit);
}
@@ -200,7 +208,6 @@ value dGifGetLine( value hdl )
if( DGifGetLine(GifFile, String_val(buf), GifFile->Image.Width )
== GIF_ERROR ){

View File

@ -33,7 +33,19 @@
failwith("EGifOpenFileName");
}
/* gcc -fwritable-strings is required to compile libungif */
@@ -133,7 +141,6 @@ value eGifPutLine( value oc, value buf )
@@ -88,7 +96,11 @@ value eGifCloseFile( value hdl )
segmentation faults */
((GifFileType *)hdl)->Image.ColorMap = NULL;
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ EGifCloseFile( (GifFileType *) hdl, NULL );
+#else
EGifCloseFile( (GifFileType *) hdl );
+#endif
CAMLreturn(Val_unit);
}
@@ -133,7 +145,6 @@ value eGifPutLine( value oc, value buf )
if ( EGifPutLine(GifFileOut, String_val(buf), GifFileOut->Image.Width)
== GIF_ERROR ){

View File

@ -0,0 +1,14 @@
--- src/osgPlugins/gif/ReaderWriterGIF.cpp.orig 2013-06-03 14:04:02 UTC
+++ src/osgPlugins/gif/ReaderWriterGIF.cpp
@@ -561,7 +561,11 @@ GifImageStream** obj)
*width_ret = giffile->SWidth;
*height_ret = giffile->SHeight;
*numComponents_ret = 4;
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(giffile, NULL);
+#else
DGifCloseFile(giffile);
+#endif
return buffer;
}

View File

@ -1,6 +1,6 @@
--- swf_gif.c.orig 2014-02-10 02:32:16 UTC
+++ swf_gif.c
@@ -132,7 +132,11 @@ gifconv_gif2lossless(unsigned char *gif_
@@ -132,14 +132,22 @@ gifconv_gif2lossless(unsigned char *gif_
gif_buff.data = gif_data;
gif_buff.data_len = gif_data_len;
gif_buff.data_offset = 0;
@ -12,7 +12,42 @@
if (GifFile == NULL) {
fprintf(stderr, "gifconv_gif2lossless: can't open GIFFile\n");
return NULL;
@@ -252,7 +256,11 @@ gifconv_lossless2gif(void *image_data,
}
if (DGifSlurp(GifFile) == GIF_ERROR) {
fprintf(stderr, "gifconv_gif2lossless: DGifSlurp failed\n");
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(GifFile, NULL);
+#else
DGifCloseFile(GifFile);
+#endif
return NULL;
}
Image = GifFile->SavedImages[0];
@@ -152,7 +160,11 @@ gifconv_gif2lossless(unsigned char *gif_
bpp = ColorMap->BitsPerPixel;
if (bpp > 8) {
fprintf(stderr, "gifconv_gif2lossless: bpp=%d not implemented. accept only bpp <= 8\n", bpp);
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(GifFile, NULL);
+#else
DGifCloseFile(GifFile);
+#endif
return NULL;
}
palette_num = ColorMap->ColorCount;
@@ -216,7 +228,11 @@ gifconv_gif2lossless(unsigned char *gif_
* destruct
*/
if (GifFile) {
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(GifFile, NULL);
+#else
DGifCloseFile(GifFile);
+#endif
}
return image_data;
}
@@ -252,7 +268,11 @@ gifconv_lossless2gif(void *image_data,
gif_buff.data = NULL;
gif_buff.data_len = 0;
gif_buff.data_offset = 0;
@ -24,7 +59,7 @@
if (GifFile == NULL) {
fprintf(stderr, "gifconv_lossless2gif: can't open GIFFile\n");
return NULL;
@@ -292,7 +300,11 @@ gifconv_lossless2gif(void *image_data,
@@ -292,13 +312,21 @@ gifconv_lossless2gif(void *image_data,
}
GifFile->SavedImages[0].RasterBits = gif_image_data;
@ -36,3 +71,13 @@
EGifSpew(GifFile); // XXX
free(gif_image_data);
if (GifFile) {
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ EGifCloseFile(GifFile, NULL);
+#else
EGifCloseFile(GifFile);
+#endif
}
*length = gif_buff.data_offset;
return gif_buff.data;

View File

@ -12,3 +12,27 @@
if(file == 0) {
std::cout << "Error Opening GIF image" << std::endl;
return false;
@@ -31,7 +35,11 @@ bool CFormatGif::Load(const char* filena
int res = DGifSlurp(file);
if(res != GIF_OK || file->ImageCount < 1) {
std::cout << "Error Opening GIF image" << std::endl;
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(file, NULL);
+#else
DGifCloseFile(file);
+#endif
return false;
}
@@ -130,7 +138,11 @@ bool CFormatGif::Load(const char* filena
//
// std::cout << "Record Type" << (int)recordType << std::endl;
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(file, NULL);
+#else
DGifCloseFile(file);
+#endif
return true;
}

View File

@ -1,5 +1,5 @@
--- ../util/gif2dbl.c.orig 2002-06-24 12:21:54.000000000 +0000
+++ ../util/gif2dbl.c 2014-12-26 17:29:52.000000000 +0000
--- ../util/gif2dbl.c.orig 2002-06-24 12:21:54 UTC
+++ ../util/gif2dbl.c
@@ -16,7 +16,6 @@
void error(char *msg)
{
@ -20,3 +20,15 @@
error("Error opening file");
if(DGifSlurp(file) != GIF_OK)
@@ -181,7 +184,11 @@ unsigned char *readGif(char *fileName, i
}
/* Done! */
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(file, NULL);
+#else
DGifCloseFile(file);
+#endif
*length = size;
return data;

View File

@ -1,6 +1,18 @@
--- src/parser/GifParser.cc.orig 2006-11-17 07:24:49 UTC
+++ src/parser/GifParser.cc
@@ -99,7 +99,11 @@ bool GifParser::parseImage()
@@ -81,7 +81,11 @@ GifParser::GifParser(Message *message,
GifParser::~GifParser()
{
if (m_gif) {
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(m_gif, NULL);
+#else
DGifCloseFile(m_gif);
+#endif
}
}
@@ -99,7 +103,11 @@ bool GifParser::parseImage()
void GifParser::openImage()
{
m_nextByteIndex = 0;

View File

@ -3,14 +3,15 @@
PORTNAME= kmess
PORTVERSION= 2.0.6.2
PORTREVISION= 9
PORTREVISION= 10
CATEGORIES= net-im kde
MASTER_SITES= SF/${PORTNAME}/Latest%20versions/${PORTVERSION}/
MAINTAINER= syncer@gmail.com
COMMENT= MSN Messenger client for KDE
LIB_DEPENDS= libqca.so:${PORTSDIR}/devel/qca
LIB_DEPENDS= libqca.so:${PORTSDIR}/devel/qca \
libgif.so:${PORTSDIR}/graphics/giflib
USE_GNOME= libxml2 libxslt
USE_KDE4= kdeprefix kdelibs libkonq automoc4

View File

@ -72,10 +72,15 @@
{
qWarning() << "EGifPutExtensionLast (0) failed!";
goto writeError;
@@ -624,12 +648,16 @@ QByteArray Stream::writerGif( const Draw
@@ -623,13 +647,21 @@ QByteArray Stream::writerGif( const Draw
writeError:
// Clean up the GIF converter etc
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ EGifCloseFile( gifImage, NULL );
+#else
EGifCloseFile( gifImage );
+#endif
+#if GIFLIB_MAJOR >= 5
+ GifFreeMapObject( cmap );
+#else

View File

@ -12,3 +12,27 @@
if (!I->us) {
I->err = IE_HDRFORMAT;
return 0;
@@ -36,7 +40,11 @@ int gif_load_hdr(img I) {
* Abort loading a GIF file after the header is done.
*/
int gif_abort_load(img I) {
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile((GifFileType*)I->us, NULL);
+#else
DGifCloseFile((GifFileType*)I->us);
+#endif
return 1;
}
@@ -114,7 +122,11 @@ int gif_load_img(img I) {
ret = 1;
fail:
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile(g, NULL);
+#else
DGifCloseFile(g);
+#endif
return ret;
}

View File

@ -50,7 +50,19 @@
/* EGifSetGifVersion("89a"); this causes segfault (but is really required for transparency, I think) */
EGifPutScreenDesc(fp, width, height, 256, 255, color_map);
@@ -715,7 +727,7 @@ int to_ps(char *basename, int verbose) {
@@ -649,7 +661,11 @@ int gif_write(png_bytepp image, char *im
return -1;
}
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ EGifCloseFile(fp, NULL);
+#else
EGifCloseFile(fp);
+#endif
return 0;
}
@@ -715,7 +731,7 @@ int to_ps(char *basename, int verbose) {
fprintf(stderr, " -> ps");
cmd = NEW(char, 2*strlen(basename) + 46);

View File

@ -1,6 +1,6 @@
--- src/gifcodec.c.orig
--- src/gifcodec.c.orig 2015-01-05 10:27:06 UTC
+++ src/gifcodec.c
@@ -40,9 +40,13 @@
@@ -40,9 +40,13 @@ GUID gdip_gif_image_format_guid = {0xb96
#include "gifcodec.h"
#ifdef EgifOpen
@ -15,7 +15,7 @@
/* Data structure used for callback */
typedef struct
@@ -131,7 +135,11 @@
@@ -131,7 +135,11 @@ AddExtensionBlockMono(SavedImage *New, i
if (ExtData) {
memcpy(ep->Bytes, ExtData, Len);
@ -27,7 +27,7 @@
}
return (GIF_OK);
@@ -234,7 +242,11 @@
@@ -234,7 +242,11 @@ DGifSlurpMono(GifFileType * GifFile, Sav
}
case EXTENSION_RECORD_TYPE: {
@ -39,7 +39,7 @@
return (GIF_ERROR);
}
@@ -247,7 +259,9 @@
@@ -247,7 +259,9 @@ DGifSlurpMono(GifFileType * GifFile, Sav
if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) {
return (GIF_ERROR);
}
@ -49,7 +49,7 @@
}
break;
}
@@ -306,9 +320,17 @@
@@ -306,9 +320,17 @@ gdip_load_gif_image (void *stream, GpIma
loop_counter = FALSE;
if (from_file) {
@ -67,7 +67,31 @@
}
if (gif == NULL) {
@@ -663,9 +685,17 @@
@@ -583,7 +605,11 @@ gdip_load_gif_image (void *stream, GpIma
}
FreeExtensionMono(&global_extensions);
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile (gif, NULL);
+#else
DGifCloseFile (gif);
+#endif
*image = result;
return Ok;
@@ -599,7 +625,11 @@ error:
if (gif != NULL) {
FreeExtensionMono (&global_extensions);
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ DGifCloseFile (gif, NULL);
+#else
DGifCloseFile (gif);
+#endif
}
*image = NULL;
@@ -663,9 +693,17 @@ gdip_save_gif_image (void *stream, GpIma
}
if (from_file) {
@ -85,7 +109,7 @@
}
if (!fp) {
@@ -704,7 +734,11 @@
@@ -704,7 +742,11 @@ gdip_save_gif_image (void *stream, GpIma
goto error;
}
@ -97,7 +121,7 @@
pixbuf = GdipAlloc(pixbuf_size);
if (pixbuf == NULL) {
@@ -795,7 +829,11 @@
@@ -795,7 +837,11 @@ gdip_save_gif_image (void *stream, GpIma
pixbuf = pixbuf_org;
} else {
cmap_size = 256;
@ -109,7 +133,7 @@
red = GdipAlloc(pixbuf_size);
green = GdipAlloc(pixbuf_size);
@@ -826,13 +864,21 @@
@@ -826,13 +872,21 @@ gdip_save_gif_image (void *stream, GpIma
v += 4;
}
}
@ -131,7 +155,7 @@
cmap->ColorCount = 1 << cmap->BitsPerPixel;
if ((frame == 0) && (k == 0)) {
@@ -850,8 +896,15 @@
@@ -850,8 +904,15 @@ gdip_save_gif_image (void *stream, GpIma
Buffer[0] = 1;
Buffer[1] = ptr[0];
Buffer[2] = ptr[1];
@ -147,7 +171,7 @@
}
}
@@ -903,7 +956,11 @@
@@ -903,7 +964,11 @@ gdip_save_gif_image (void *stream, GpIma
pixbuf += bitmap_data->width;
}
@ -159,7 +183,17 @@
if (red != NULL) {
GdipFree (red);
}
@@ -931,7 +988,11 @@
@@ -925,13 +990,21 @@ gdip_save_gif_image (void *stream, GpIma
}
}
+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5
+ EGifCloseFile (fp, NULL);
+#else
EGifCloseFile (fp);
+#endif
return Ok;
error:
if (cmap != NULL) {