1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-19 19:59:43 +00:00

Allow building with either giflib 4.2 or 5.0

This commit is contained in:
Antoine Brodin 2014-12-27 07:37:59 +00:00
parent fb1102537c
commit 2fde215147
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=375672
3 changed files with 151 additions and 6 deletions

View File

@ -1,37 +1,76 @@
--- src/gif2swf.c.orig 2011-01-02 04:30:29.000000000 +0100
+++ src/gif2swf.c 2012-06-03 06:43:44.000000000 +0200
@@ -65,6 +65,16 @@
--- src/gif2swf.c.orig 2011-01-02 03:30:29 UTC
+++ src/gif2swf.c
@@ -65,6 +65,25 @@ enum disposal_method {
RESTORE_TO_PREVIOUS
};
+static void
+#if GIFLIB_MAJOR >= 5
+localPrintGifError(int ErrorCode)
+#else
+localPrintGifError(void)
+#endif
+{
+#if GIFLIB_MAJOR >= 5
+ char *Err = GifErrorString(ErrorCode);
+#else
+ char *Err = GifErrorString();
+ int ErrorCode = GifError();
+#endif
+
+ if (Err != NULL)
+ fprintf(stderr, "\nGIF-LIB error: %s.\n", Err);
+ else
+ fprintf(stderr, "\nGIF-LIB undefined error %d.\n", GifError());
+ fprintf(stderr, "\nGIF-LIB undefined error %d.\n", ErrorCode);
+}
void SetFrameAction(TAG ** t, const char *src, int ver)
{
@@ -236,7 +246,7 @@
@@ -230,13 +249,21 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, c
}
fclose(fi);
+#if GIFLIB_MAJOR >= 5
+ if ((gft = DGifOpenFileName(sname, NULL)) == NULL) {
+#else
if ((gft = DGifOpenFileName(sname)) == NULL) {
+#endif
fprintf(stderr, "%s is not a GIF file!\n", sname);
return t;
}
if (DGifSlurp(gft) != GIF_OK) {
- PrintGifError();
+#if GIFLIB_MAJOR >= 5
+ localPrintGifError(gft->Error);
+#else
+ localPrintGifError();
+#endif
return t;
}
@@ -499,7 +509,7 @@
@@ -488,7 +515,11 @@ int CheckInputFile(char *fname, char **r
}
fclose(fi);
+#if GIFLIB_MAJOR >= 5
+ if ((gft = DGifOpenFileName(s, NULL)) == NULL) {
+#else
if ((gft = DGifOpenFileName(s)) == NULL) {
+#endif
fprintf(stderr, "%s is not a GIF file!\n", fname);
return -1;
}
@@ -499,7 +530,11 @@ int CheckInputFile(char *fname, char **r
global.max_image_height = gft->SHeight;
if (DGifSlurp(gft) != GIF_OK) {
- PrintGifError();
+#if GIFLIB_MAJOR >= 5
+ localPrintGifError(gft->Error);
+#else
+ localPrintGifError();
+#endif
return -1;
}
// After DGifSlurp() call, gft->ImageCount become available

View File

@ -0,0 +1,14 @@
--- jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c.orig 2014-03-04 02:59:38 UTC
+++ jdk/src/share/native/sun/awt/splashscreen/splashscreen_gif.c
@@ -318,7 +318,11 @@ SplashDecodeGif(Splash * splash, GifFile
int
SplashDecodeGifStream(Splash * splash, SplashStream * stream)
{
+#if GIFLIB_MAJOR >= 5
+ GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, NULL);
+#else
GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc);
+#endif
if (!gif)
return 0;

View File

@ -0,0 +1,92 @@
--- contrib/isf-qt/src/isfqt.cpp.orig 2012-02-18 16:28:01 UTC
+++ contrib/isf-qt/src/isfqt.cpp
@@ -489,7 +489,11 @@ QByteArray Stream::writerGif( const Draw
// Open the gif file
gifData.open( QIODevice::WriteOnly );
+#if GIFLIB_MAJOR >= 5
+ gifImage = EGifOpen( (void*)&gifData, GifWriteToByteArray, NULL );
+#else
gifImage = EGifOpen( (void*)&gifData, GifWriteToByteArray );
+#endif
if( gifImage == 0 )
{
qWarning() << "Couldn't initialize gif library!";
@@ -503,7 +507,11 @@ QByteArray Stream::writerGif( const Draw
numColors = 256;
}
+#if GIFLIB_MAJOR >= 5
+ cmap = GifMakeMapObject( numColors, NULL );
+#else
cmap = MakeMapObject( numColors, NULL );
+#endif
if( cmap == 0 && isfImage.numColors() > 1 )
{
qWarning() << "Couldn't create map object for gif conversion (colors:" << isfImage.numColors() << ")!";
@@ -576,7 +584,11 @@ QByteArray Stream::writerGif( const Draw
else
{
// Write the extension
+#if GIFLIB_MAJOR >= 5
+ if( EGifPutExtensionLeader( gifImage, COMMENT_EXT_FUNC_CODE ) == GIF_ERROR )
+#else
if( EGifPutExtensionFirst( gifImage, COMMENT_EXT_FUNC_CODE, MAX_GIF_BYTE, isfData.left( MAX_GIF_BYTE ).data() ) == GIF_ERROR )
+#endif
{
qWarning() << "EGifPutExtensionFirst failed!";
goto writeError;
@@ -590,7 +602,11 @@ QByteArray Stream::writerGif( const Draw
// Write all the full data blocks
while( length >= MAX_GIF_BYTE )
{
+#if GIFLIB_MAJOR >= 5
+ if( EGifPutExtensionBlock( gifImage, MAX_GIF_BYTE, isfData.mid( pos, MAX_GIF_BYTE ).data() ) == GIF_ERROR )
+#else
if( EGifPutExtensionNext( gifImage, 0, MAX_GIF_BYTE, isfData.mid( pos, MAX_GIF_BYTE ).data() ) == GIF_ERROR )
+#endif
{
qWarning() << "EGifPutExtensionNext failed!";
goto writeError;
@@ -603,7 +619,11 @@ QByteArray Stream::writerGif( const Draw
// Write the last block
if( length > 0 )
{
+#if GIFLIB_MAJOR >= 5
+ if( EGifPutExtensionTrailer( gifImage ) == GIF_ERROR )
+#else
if( EGifPutExtensionLast( gifImage, 0, length, isfData.mid( pos, MAX_GIF_BYTE ).data() ) == GIF_ERROR )
+#endif
{
qWarning() << "EGifPutExtensionLast (n) failed!";
goto writeError;
@@ -611,7 +631,11 @@ QByteArray Stream::writerGif( const Draw
}
else
{
+#if GIFLIB_MAJOR >= 5
+ if( EGifPutExtensionTrailer( gifImage ) == GIF_ERROR )
+#else
if( EGifPutExtensionLast( gifImage, 0, 0, 0 ) == GIF_ERROR )
+#endif
{
qWarning() << "EGifPutExtensionLast (0) failed!";
goto writeError;
@@ -624,12 +648,16 @@ QByteArray Stream::writerGif( const Draw
writeError:
// Clean up the GIF converter etc
EGifCloseFile( gifImage );
+#if GIFLIB_MAJOR >= 5
+ GifFreeMapObject( cmap );
+#else
FreeMapObject( cmap );
+#endif
gifData.close();
if( gifError )
{
- qWarning() << "GIF error code:" << GifLastError();
+ qWarning() << "GIF error";
}
else
{