mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 19:33:03 +00:00
71 lines
2.3 KiB
Diff
71 lines
2.3 KiB
Diff
Index: b/kopete/protocols/wlm/wlmchatsession.cpp
|
|
===================================================================
|
|
--- a/kopete/protocols/wlm/wlmchatsession.cpp
|
|
+++ b/kopete/protocols/wlm/wlmchatsession.cpp
|
|
@@ -63,10 +63,14 @@
|
|
#include "wlmprotocol.h"
|
|
#include "wlmaccount.h"
|
|
#include "wlmchatsessioninkaction.h"
|
|
#ifdef HAVE_GIFLIB
|
|
#include <gif_lib.h>
|
|
+/* old giflib has no GIFLIB_MAJOR, define to avoid cpp warnings */
|
|
+#ifndef GIFLIB_MAJOR
|
|
+#define GIFLIB_MAJOR 4
|
|
+#endif
|
|
#endif
|
|
|
|
WlmChatSession::WlmChatSession (Kopete::Protocol * protocol,
|
|
const Kopete::Contact * user,
|
|
Kopete::ContactPtrList others,
|
|
@@ -465,15 +469,19 @@ WlmChatSession::slotInviteContact (Kopet
|
|
static void
|
|
printGifErrorMessage()
|
|
{
|
|
#ifdef HAVE_GIFLIB
|
|
#ifdef HAVE_GIF_ERROR_STRING // giflib 4.2.0+
|
|
+#if GIFLIB_MAJOR >= 5
|
|
+ fprintf(stderr, "GIF-LIB error (exact reporting not implemented)\n");
|
|
+#else
|
|
const char * errorString = GifErrorString();
|
|
if (errorString)
|
|
fprintf(stderr, "GIF-LIB error: %s\n", errorString);
|
|
else
|
|
fprintf(stderr, "GIF-LIB undefined error: %d\n", GifError());
|
|
+#endif
|
|
#else // older giflib versions, libungif
|
|
PrintGifError();
|
|
#endif // HAVE_GIF_ERROR_STRING
|
|
#endif // HAVE_GIFLIB
|
|
}
|
|
@@ -481,10 +489,14 @@ printGifErrorMessage()
|
|
/* stolen from kpaint write_to_gif() */
|
|
void
|
|
WlmChatSession::convertToGif( const QPixmap & ink, QString filename)
|
|
{
|
|
#ifdef HAVE_GIFLIB
|
|
+#if GIFLIB_MAJOR >= 5
|
|
+#define FreeMapObject GifFreeMapObject
|
|
+#define MakeMapObject GifMakeMapObject
|
|
+#endif
|
|
int i, status;
|
|
GifFileType *GifFile;
|
|
ColorMapObject *screenColourmap;
|
|
ColorMapObject *imageColourmap;
|
|
QImage img = ink.toImage().convertToFormat(QImage::Format_Indexed8);
|
|
@@ -523,11 +535,15 @@ WlmChatSession::convertToGif( const QPix
|
|
screenColourmap->Colors[i].Green= 0;
|
|
screenColourmap->Colors[i].Blue= 0;
|
|
}
|
|
}
|
|
|
|
+#if GIFLIB_MAJOR >= 5
|
|
+ GifFile= EGifOpenFileName(QFile::encodeName(filename).constData(), 0, NULL);
|
|
+#else
|
|
GifFile= EGifOpenFileName(QFile::encodeName(filename).constData(), 0);
|
|
+#endif
|
|
if (!GifFile) {
|
|
FreeMapObject(imageColourmap);
|
|
FreeMapObject(screenColourmap);
|
|
return;
|
|
}
|