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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
--- trinity-libksquirrel-3.5.13.2/kernel/kls_gif/fmt_codec_gif.cpp.giflib5 2013-06-07 20:05:31.000000000 +0200
+++ trinity-libksquirrel-3.5.13.2/kernel/kls_gif/fmt_codec_gif.cpp 2013-08-24 17:58:13.978555540 +0200
@@ -43,14 +43,26 @@
/* libgif 4.2.0 has retired PrintGifError() and added GifErrorString() */
#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && \
((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4)
+#if GIFLIB_MAJOR > 4
+static void PrintGifError(int ErrorCode)
+#else
static void PrintGifError(void)
+#endif
{
+#if GIFLIB_MAJOR > 4
+ char *Err = GifErrorString(ErrorCode);
+#else
char *Err = GifErrorString();
+#endif
if (Err != NULL) {
fprintf(stderr, "\nGIF-LIB error: %s.\n", Err);
} else {
+#if GIFLIB_MAJOR > 4
+ fprintf(stderr, "\nGIF-LIB undefined error %d.\n", ErrorCode);
+#else
fprintf(stderr, "\nGIF-LIB undefined error %d.\n", GifError());
+#endif
}
}
#endif
@@ -107,7 +119,12 @@
buf = 0;
saved = 0;
+#if GIFLIB_MAJOR > 4
+ int ErrorCode;
+ gif = DGifOpenFileName(file.c_str(), &ErrorCode);
+#else
gif = DGifOpenFileName(file.c_str());
+#endif
// for safety...
if(!gif)
@@ -198,7 +215,11 @@
{
if (DGifGetRecordType(gif, &record) == GIF_ERROR)
{
+#if GIFLIB_MAJOR > 4
+ PrintGifError(gif->Error);
+#else
PrintGifError();
+#endif
return SQE_R_BADFILE;
}
@@ -207,7 +228,11 @@
case IMAGE_DESC_RECORD_TYPE:
if(DGifGetImageDesc(gif) == GIF_ERROR)
{
+#if GIFLIB_MAJOR > 4
+ PrintGifError(gif->Error);
+#else
PrintGifError();
+#endif
return SQE_R_BADFILE;
}
@@ -243,7 +268,11 @@
case EXTENSION_RECORD_TYPE:
if(DGifGetExtension(gif, &ExtCode, &Extension) == GIF_ERROR)
{
+#if GIFLIB_MAJOR > 4
+ PrintGifError(gif->Error);
+#else
PrintGifError();
+#endif
return SQE_R_BADFILE;
}
@@ -287,7 +316,11 @@
{
if(DGifGetExtensionNext(gif, &Extension) == GIF_ERROR)
{
+#if GIFLIB_MAJOR > 4
+ PrintGifError(gif->Error);
+#else
PrintGifError();
+#endif
return SQE_R_BADFILE;
}
}
@@ -366,7 +399,11 @@
{
if(DGifGetLine(gif, buf, Width) == GIF_ERROR)
{
+#if GIFLIB_MAJOR > 4
+ PrintGifError(gif->Error);
+#else
PrintGifError();
+#endif
memset(scan, 255, im->w * sizeof(RGBA));
return SQE_R_BADFILE;
}
@@ -439,7 +476,11 @@
if(DGifGetLine(gif, buf, Width) == GIF_ERROR)
{
memset(scan, 255, im->w * sizeof(RGBA));
+#if GIFLIB_MAJOR > 4
+ PrintGifError(gif->Error);
+#else
PrintGifError();
+#endif
return SQE_R_BADFILE;
}
else
|