1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
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;
}
|