network/kmess: Fixed build with giflib-5.1.

Signed-off-by: David Spencer <baildon.research@googlemail.com>
This commit is contained in:
David Spencer 2015-09-18 00:30:57 +01:00 committed by Willy Sudiarto Raharjo
parent ef1439e9aa
commit 3b95e6bb7a
2 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,95 @@
--- contrib/isf-qt/src/isfqt.cpp.orig 2014-06-11 13:10:43.137321400 +0000
+++ contrib/isf-qt/src/isfqt.cpp 2014-06-11 13:12:23.123474616 +0000
@@ -249,7 +249,7 @@
qWarning() << "Couldn't initialize GIF library!";
}
- DGifCloseFile( gifImage );
+ DGifCloseFile( gifImage, NULL );
gifData.close();
*/
@@ -484,12 +484,13 @@
int width = isfImage.width();
int numColors = 0;
bool gifError = true;
+ int gifErrCode;
// Convert the image to GIF using libgif
// Open the gif file
gifData.open( QIODevice::WriteOnly );
- gifImage = EGifOpen( (void*)&gifData, GifWriteToByteArray );
+ gifImage = EGifOpen( (void*)&gifData, GifWriteToByteArray, &gifErrCode );
if( gifImage == 0 )
{
qWarning() << "Couldn't initialize gif library!";
@@ -503,7 +504,7 @@
numColors = 256;
}
- cmap = MakeMapObject( numColors, NULL );
+ cmap = GifMakeMapObject( numColors, NULL );
if( cmap == 0 && isfImage.numColors() > 1 )
{
qWarning() << "Couldn't create map object for gif conversion (colors:" << isfImage.numColors() << ")!";
@@ -576,7 +577,7 @@
else
{
// Write the extension
- if( EGifPutExtensionFirst( gifImage, COMMENT_EXT_FUNC_CODE, MAX_GIF_BYTE, isfData.left( MAX_GIF_BYTE ).data() ) == GIF_ERROR )
+ if( EGifPutExtensionLeader( gifImage, COMMENT_EXT_FUNC_CODE) == GIF_ERROR )
{
qWarning() << "EGifPutExtensionFirst failed!";
goto writeError;
@@ -590,9 +591,9 @@
// Write all the full data blocks
while( length >= MAX_GIF_BYTE )
{
- if( EGifPutExtensionNext( gifImage, 0, MAX_GIF_BYTE, isfData.mid( pos, MAX_GIF_BYTE ).data() ) == GIF_ERROR )
+ if( EGifPutExtensionBlock( gifImage, MAX_GIF_BYTE, isfData.mid( pos, MAX_GIF_BYTE ).data() ) == GIF_ERROR )
{
- qWarning() << "EGifPutExtensionNext failed!";
+ qWarning() << "EGifPutExtensionBlock failed!";
goto writeError;
}
@@ -603,17 +604,17 @@
// Write the last block
if( length > 0 )
{
- if( EGifPutExtensionLast( gifImage, 0, length, isfData.mid( pos, MAX_GIF_BYTE ).data() ) == GIF_ERROR )
+ if( EGifPutExtensionTrailer( gifImage ) == GIF_ERROR )
{
- qWarning() << "EGifPutExtensionLast (n) failed!";
+ qWarning() << "EGifPutExtensionTrailer (n) failed!";
goto writeError;
}
}
else
{
- if( EGifPutExtensionLast( gifImage, 0, 0, 0 ) == GIF_ERROR )
+ if( EGifPutExtensionTrailer( gifImage ) == GIF_ERROR )
{
- qWarning() << "EGifPutExtensionLast (0) failed!";
+ qWarning() << "EGifPutExtensionTrailer (0) failed!";
goto writeError;
}
}
@@ -623,13 +624,13 @@
writeError:
// Clean up the GIF converter etc
- EGifCloseFile( gifImage );
- FreeMapObject( cmap );
+ EGifCloseFile( gifImage, NULL );
+ GifFreeMapObject( cmap );
gifData.close();
if( gifError )
{
- qWarning() << "GIF error code:" << GifLastError();
+ qWarning() << "GIF error code:" << GifErrorString(gifErrCode);
}
else
{

View file

@ -68,6 +68,9 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Fix for building with new giflib (thanks to Arch)
patch -p1 contrib/isf-qt/src/isfqt.cpp < $CWD/giflib-5.0.patch
mkdir -p build
cd build
cmake \