]> git.pld-linux.org Git - packages/exact-image.git/blame - exact-image-giflib.patch
- added giflib patch (giflib 5+ support, covers both 5.0 and 5.1+)
[packages/exact-image.git] / exact-image-giflib.patch
CommitLineData
e293edfc
JB
1--- exact-image-0.8.9/codecs/gif.cc.orig 2010-03-03 22:04:44.000000000 +0100
2+++ exact-image-0.8.9/codecs/gif.cc 2014-10-20 16:45:48.021255431 +0200
3@@ -17,6 +17,12 @@
4
5 #include <gif_lib.h>
6
7+#if (GIFLIB_MAJOR > 5) || (GIFLIB_MINOR >= 1)
8+#define Internal_EGifCloseFile(f) EGifCloseFile(f, NULL)
9+#else
10+#define Internal_EGifCloseFile(f) EGifCloseFile(f)
11+#endif
12+
13 #include "gif.hh"
14 #include "Colorspace.hh"
15
16@@ -58,11 +64,11 @@
17 GifRecordType RecordType;
18 GifByteType* Extension;
19 ColorMapObject *ColorMap = NULL;
20- int ExtCode;
21+ int ExtCode, GifError;
22
23- if ((GifFile = DGifOpen (stream, &GIFInputFunc)) == NULL)
24+ if ((GifFile = DGifOpen (stream, &GIFInputFunc, &GifError)) == NULL)
25 {
26- PrintGifError();
27+ std::cerr << "Error: " << GifErrorString(GifError) << std::endl;
28 return false;
29 }
30
31@@ -74,7 +80,7 @@
32 /* Scan the content of the GIF file and load the image(s) in: */
33 do {
34 if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) {
35- PrintGifError();
36+ std::cerr << "DGifGetRecordType error: " << GifErrorString(GifFile->Error) << std::endl;
37 return false;
38 }
39
40@@ -83,7 +89,7 @@
41 switch (RecordType) {
42 case IMAGE_DESC_RECORD_TYPE:
43 if (DGifGetImageDesc(GifFile) == GIF_ERROR) {
44- PrintGifError();
45+ std::cerr << "DGifGetImageDesc error: " << GifErrorString(GifFile->Error) << std::endl;
46 return false;
47 }
48
49@@ -104,7 +110,7 @@
50 j += InterlacedJumps[i]) {
51 if (DGifGetLine(GifFile, &image.getRawData()[j*image.stride()+Col],
52 Width) == GIF_ERROR) {
53- PrintGifError();
54+ std::cerr << "DGifGetLine error: " << GifErrorString(GifFile->Error) << std::endl;
55 return false;
56 }
57 }
58@@ -113,7 +119,7 @@
59 for (int i = 0; i < Height; ++i) {
60 if (DGifGetLine(GifFile, &image.getRawData()[Row++ * image.stride()+Col],
61 Width) == GIF_ERROR) {
62- PrintGifError();
63+ std::cerr << "DGifGetLine error: " << GifErrorString(GifFile->Error) << std::endl;
64 return false;
65 }
66 }
67@@ -122,12 +128,12 @@
68 case EXTENSION_RECORD_TYPE:
69 /* Skip any extension blocks in file: */
70 if (DGifGetExtension(GifFile, &ExtCode, &Extension) == GIF_ERROR) {
71- PrintGifError();
72+ std::cerr << "DGifGetExtension error: " << GifErrorString(GifFile->Error) << std::endl;
73 return false;
74 }
75 while (Extension != NULL) {
76 if (DGifGetExtensionNext(GifFile, &Extension) == GIF_ERROR) {
77- PrintGifError();
78+ std::cerr << "DGifGetExtensionNext error: " << GifErrorString(GifFile->Error) << std::endl;
79 return false;
80 }
81 }
82@@ -155,7 +161,7 @@
83 // convert colormap to our 16bit "TIFF"format
84 colorspace_de_palette (image, ColorMap->ColorCount, rmap, gmap, bmap);
85
86- EGifCloseFile(GifFile);
87+ Internal_EGifCloseFile(GifFile);
88
89 return true;
90 }
91@@ -165,17 +171,18 @@
92 {
93 GifFileType* GifFile;
94 GifByteType* Ptr;
95+ int GifError;
96
97- if ((GifFile = EGifOpen (stream, &GIFOutputFunc)) == NULL)
98+ if ((GifFile = EGifOpen (stream, &GIFOutputFunc, &GifError)) == NULL)
99 {
100- std::cerr << "Error preparing GIF file for writing." << std::endl;
101+ std::cerr << "Error preparing GIF file for writing: " << GifErrorString(GifError) << std::endl;
102 return false;
103 }
104
105 int ColorMapSize = 256;
106
107 // later use our own colormap generation
108- ColorMapObject* OutputColorMap = MakeMapObject(ColorMapSize, NULL);
109+ ColorMapObject* OutputColorMap = GifMakeMapObject(ColorMapSize, NULL);
110 if (!OutputColorMap)
111 return false;
112
113@@ -203,7 +210,7 @@
114 }
115
116
117- if (QuantizeBuffer(image.w, image.h, &ColorMapSize,
118+ if (GifQuantizeBuffer(image.w, image.h, &ColorMapSize,
119 RedBuffer, GreenBuffer, BlueBuffer,
120 OutputBuffer, OutputColorMap->Colors) == GIF_ERROR) {
121 return false;
122@@ -215,7 +222,7 @@
123 if (EGifPutScreenDesc(GifFile, image.w, image.h,
124 ColorMapSize, 0, OutputColorMap) == GIF_ERROR ||
125 EGifPutImageDesc(GifFile, 0, 0, image.w, image.h,
126- FALSE, NULL) == GIF_ERROR)
127+ false, NULL) == GIF_ERROR)
128 {
129 std::cerr << "Error writing GIF header." << std::endl;
130 return false;
131@@ -234,7 +241,7 @@
132
133 delete (RedBuffer); delete (GreenBuffer); delete (BlueBuffer);
134
135- EGifCloseFile(GifFile);
136+ Internal_EGifCloseFile(GifFile);
137 return true;
138 }
139
This page took 0.06086 seconds and 4 git commands to generate.