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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
diff -ruN frmts/gif.orig/biggifdataset.cpp frmts/gif/biggifdataset.cpp
--- frmts/gif.orig/biggifdataset.cpp 2014-04-16 20:04:33.000000000 +0000
+++ frmts/gif/biggifdataset.cpp 2014-06-11 12:39:28.420405033 +0000
@@ -339,7 +339,11 @@
/* If the file is already open, close it so we can restart. */
/* -------------------------------------------------------------------- */
if( hGifFile != NULL )
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ DGifCloseFile( hGifFile, NULL );
+#else
DGifCloseFile( hGifFile );
+#endif
/* -------------------------------------------------------------------- */
/* If we are actually reopening, then we assume that access to */
@@ -413,7 +417,11 @@
if( RecordType != IMAGE_DESC_RECORD_TYPE )
{
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ DGifCloseFile( hGifFile, NULL );
+#else
DGifCloseFile( hGifFile );
+#endif
hGifFile = NULL;
CPLError( CE_Failure, CPLE_OpenFailed,
@@ -423,7 +431,11 @@
if (DGifGetImageDesc(hGifFile) == GIF_ERROR)
{
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ DGifCloseFile( hGifFile, NULL );
+#else
DGifCloseFile( hGifFile );
+#endif
hGifFile = NULL;
CPLError( CE_Failure, CPLE_OpenFailed,
diff -ruN frmts/gif.orig/gifabstractdataset.cpp frmts/gif/gifabstractdataset.cpp
--- frmts/gif.orig/gifabstractdataset.cpp 2014-04-16 20:04:33.000000000 +0000
+++ frmts/gif/gifabstractdataset.cpp 2014-06-11 12:54:25.609072106 +0000
@@ -82,7 +82,11 @@
}
if( hGifFile )
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ DGifCloseFile( hGifFile, NULL );
+#else
DGifCloseFile( hGifFile );
+#endif
if( fp != NULL )
VSIFCloseL( fp );
diff -ruN frmts/gif.orig/gifdataset.cpp frmts/gif/gifdataset.cpp
--- frmts/gif.orig/gifdataset.cpp 2014-04-16 20:04:33.000000000 +0000
+++ frmts/gif/gifdataset.cpp 2014-06-11 12:45:37.318469917 +0000
@@ -386,13 +386,21 @@
CPLDebug( "GIF",
"Due to limitations of the GDAL GIF driver we deliberately avoid\n"
"opening large GIF files (larger than 100 megapixels).");
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ DGifCloseFile( hGifFile, NULL );
+#else
DGifCloseFile( hGifFile );
+#endif
VSIFCloseL( fp );
return NULL;
}
}
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ DGifCloseFile( hGifFile, NULL );
+#else
DGifCloseFile( hGifFile );
+#endif
VSIFSeekL( fp, 0, SEEK_SET);
@@ -417,7 +425,11 @@
if( nGifErr != GIF_OK || hGifFile->SavedImages == NULL )
{
VSIFCloseL( fp );
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ DGifCloseFile(hGifFile, NULL);
+#else
DGifCloseFile(hGifFile);
+#endif
if( nGifErr == D_GIF_ERR_DATA_TOO_BIG )
{
@@ -649,7 +661,11 @@
{
GifFreeMapObject(psGifCT);
GDALPrintGifError(hGifFile, "Error writing gif file.");
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ EGifCloseFile(hGifFile, NULL);
+#else
EGifCloseFile(hGifFile);
+#endif
VSIFCloseL( fp );
return NULL;
}
@@ -673,7 +689,11 @@
if (EGifPutImageDesc(hGifFile, 0, 0, nXSize, nYSize, bInterlace, NULL) == GIF_ERROR )
{
GDALPrintGifError(hGifFile, "Error writing gif file.");
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ EGifCloseFile(hGifFile, NULL);
+#else
EGifCloseFile(hGifFile);
+#endif
VSIFCloseL( fp );
return NULL;
}
@@ -756,7 +776,11 @@
/* -------------------------------------------------------------------- */
/* cleanup */
/* -------------------------------------------------------------------- */
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ if (EGifCloseFile(hGifFile, NULL) == GIF_ERROR)
+#else
if (EGifCloseFile(hGifFile) == GIF_ERROR)
+#endif
{
CPLError( CE_Failure, CPLE_AppDefined,
"EGifCloseFile() failed.\n" );
@@ -807,7 +831,11 @@
error:
if (hGifFile)
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
+ EGifCloseFile(hGifFile, NULL);
+#else
EGifCloseFile(hGifFile);
+#endif
if (fp)
VSIFCloseL( fp );
if (pabyScanline)
|