-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexact-image-0.9.1-ungif.patch
121 lines (107 loc) · 3.65 KB
/
exact-image-0.9.1-ungif.patch
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
115
116
117
118
119
120
121
--- exact-image-0.9.1/codecs/gif.cc.orig
+++ exact-image-0.9.1/codecs/gif.cc
@@ -59,10 +59,11 @@
GifByteType* Extension;
ColorMapObject *ColorMap = NULL;
int ExtCode;
+ int GifError;
- if ((GifFile = DGifOpen (stream, &GIFInputFunc)) == NULL)
+ if ((GifFile = DGifOpen (stream, &GIFInputFunc, &GifError)) == NULL)
{
- PrintGifError();
+ std::cerr << "GIF Error: " << GifErrorString(GifError) << std::endl;
return false;
}
@@ -74,7 +75,7 @@
/* Scan the content of the GIF file and load the image(s) in: */
do {
if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "GIF Error: " << GifErrorString(GifError) << std::endl;
return false;
}
@@ -83,7 +84,7 @@
switch (RecordType) {
case IMAGE_DESC_RECORD_TYPE:
if (DGifGetImageDesc(GifFile) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "GIF Error: " << GifErrorString(GifError) << std::endl;
return false;
}
@@ -104,7 +105,7 @@
j += InterlacedJumps[i]) {
if (DGifGetLine(GifFile, &image.getRawData()[j*image.stride()+Col],
Width) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "GIF Error: " << GifErrorString(GifError) << std::endl;
return false;
}
}
@@ -113,7 +114,7 @@
for (int i = 0; i < Height; ++i) {
if (DGifGetLine(GifFile, &image.getRawData()[Row++ * image.stride()+Col],
Width) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "GIF Error: " << GifErrorString(GifError) << std::endl;
return false;
}
}
@@ -122,12 +123,12 @@
case EXTENSION_RECORD_TYPE:
/* Skip any extension blocks in file: */
if (DGifGetExtension(GifFile, &ExtCode, &Extension) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "GIF Error: " << GifErrorString(GifError) << std::endl;
return false;
}
while (Extension != NULL) {
if (DGifGetExtensionNext(GifFile, &Extension) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "GIF Error: " << GifErrorString(GifError) << std::endl;
return false;
}
}
@@ -155,7 +156,7 @@
// convert colormap to our 16bit "TIFF"format
colorspace_de_palette (image, ColorMap->ColorCount, rmap, gmap, bmap);
- EGifCloseFile(GifFile);
+ EGifCloseFile(GifFile, NULL);
return true;
}
@@ -166,7 +167,7 @@
GifFileType* GifFile;
GifByteType* Ptr;
- if ((GifFile = EGifOpen (stream, &GIFOutputFunc)) == NULL)
+ if ((GifFile = EGifOpen (stream, &GIFOutputFunc, &GifError)) == NULL)
{
std::cerr << "Error preparing GIF file for writing." << std::endl;
return false;
@@ -175,7 +176,7 @@
int ColorMapSize = 256;
// later use our own colormap generation
- ColorMapObject* OutputColorMap = MakeMapObject(ColorMapSize, NULL);
+ ColorMapObject* OutputColorMap = GifMakeMapObject(ColorMapSize, NULL);
if (!OutputColorMap)
return false;
@@ -203,7 +204,7 @@
}
- if (QuantizeBuffer(image.w, image.h, &ColorMapSize,
+ if (GifQuantizeBuffer(image.w, image.h, &ColorMapSize,
RedBuffer, GreenBuffer, BlueBuffer,
OutputBuffer, OutputColorMap->Colors) == GIF_ERROR) {
return false;
@@ -215,7 +216,7 @@
if (EGifPutScreenDesc(GifFile, image.w, image.h,
ColorMapSize, 0, OutputColorMap) == GIF_ERROR ||
EGifPutImageDesc(GifFile, 0, 0, image.w, image.h,
- FALSE, NULL) == GIF_ERROR)
+ false, NULL) == GIF_ERROR)
{
std::cerr << "Error writing GIF header." << std::endl;
return false;
@@ -234,7 +235,7 @@
delete (RedBuffer); delete (GreenBuffer); delete (BlueBuffer);
- EGifCloseFile(GifFile);
+ EGifCloseFile(GifFile, NULL);
return true;
}