summaryrefslogtreecommitdiffstats
path: root/src/gdal-1-fixes.patch
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2012-07-04 08:50:01 (GMT)
committerMark Brand <mabrand@mabrand.nl>2012-07-04 08:50:01 (GMT)
commitcfe7e560efd660419be5d9229f73ef3a4a419f6c (patch)
tree12b33ab12dccee0aa3354a8c6408fc1b0fe3fc0d /src/gdal-1-fixes.patch
parent015ee5634616eb6a60d313cec0d91d21bf92883f (diff)
downloadmxe-cfe7e560efd660419be5d9229f73ef3a4a419f6c.zip
mxe-cfe7e560efd660419be5d9229f73ef3a4a419f6c.tar.gz
mxe-cfe7e560efd660419be5d9229f73ef3a4a419f6c.tar.bz2
package gdal: giflib 5 compatibility
Diffstat (limited to 'src/gdal-1-fixes.patch')
-rw-r--r--src/gdal-1-fixes.patch191
1 files changed, 184 insertions, 7 deletions
diff --git a/src/gdal-1-fixes.patch b/src/gdal-1-fixes.patch
index b0cf98e..8b34503 100644
--- a/src/gdal-1-fixes.patch
+++ b/src/gdal-1-fixes.patch
@@ -1,13 +1,22 @@
This file is part of MXE.
See index.html for further information.
+From a0c0640eb7e98db4a9cbe5104abef8425d975712 Mon Sep 17 00:00:00 2001
+From: Mark Brand <mabrand@mabrand.nl>
+Date: Wed, 4 Jul 2012 10:05:33 +0200
+Subject: [PATCH 1/2] giflib compatibility
+
Taken from http://trac.osgeo.org/gdal/changeset/24491?format=diff&new=24491
+---
+ frmts/gif/gifdataset.cpp | 30 ++++++++++++++++++++++++------
+ 1 file changed, 24 insertions(+), 6 deletions(-)
-Index: gdal/frmts/gif/gifdataset.cpp
-===================================================================
---- gdal/frmts/gif/gifdataset.cpp (revision 23621)
-+++ gdal/frmts/gif/gifdataset.cpp (revision 24491)
-@@ -471,4 +471,26 @@
+diff --git a/frmts/gif/gifdataset.cpp b/frmts/gif/gifdataset.cpp
+index c89f34c..1947edd 100644
+--- a/frmts/gif/gifdataset.cpp
++++ b/frmts/gif/gifdataset.cpp
+@@ -470,6 +470,28 @@ GDALDataset *GIFDataset::Open( GDALOpenInfo * poOpenInfo )
+ }
/************************************************************************/
+/* GDALPrintGifError() */
@@ -34,7 +43,9 @@ Index: gdal/frmts/gif/gifdataset.cpp
+/************************************************************************/
/* CreateCopy() */
/************************************************************************/
-@@ -597,7 +619,5 @@
+
+@@ -596,9 +618,7 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
+ psGifCT->ColorCount, 255, psGifCT) == GIF_ERROR)
{
FreeMapObject(psGifCT);
- PrintGifError();
@@ -43,7 +54,9 @@ Index: gdal/frmts/gif/gifdataset.cpp
+ GDALPrintGifError("Error writing gif file.");
EGifCloseFile(hGifFile);
VSIFCloseL( fp );
-@@ -623,7 +643,5 @@
+ return NULL;
+@@ -622,9 +642,7 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
+
if (EGifPutImageDesc(hGifFile, 0, 0, nXSize, nYSize, bInterlace, NULL) == GIF_ERROR )
{
- PrintGifError();
@@ -52,3 +65,167 @@ Index: gdal/frmts/gif/gifdataset.cpp
+ GDALPrintGifError("Error writing gif file.");
EGifCloseFile(hGifFile);
VSIFCloseL( fp );
+ return NULL;
+--
+1.7.10.4
+
+
+From 7411f59dd769a72a79838e932d1a0988b04dc4d5 Mon Sep 17 00:00:00 2001
+From: Mark Brand <mabrand@mabrand.nl>
+Date: Wed, 4 Jul 2012 10:42:33 +0200
+Subject: [PATCH 2/2] giflib 5 compatibility
+
+taken from
+http://trac.osgeo.org/gdal/changeset/24627
+---
+ frmts/gif/biggifdataset.cpp | 5 +++++
+ frmts/gif/gifdataset.cpp | 43 ++++++++++++++++++++++++++++++++++++-------
+ 2 files changed, 41 insertions(+), 7 deletions(-)
+
+diff --git a/frmts/gif/biggifdataset.cpp b/frmts/gif/biggifdataset.cpp
+index e3029e5..6bed0dc 100644
+--- a/frmts/gif/biggifdataset.cpp
++++ b/frmts/gif/biggifdataset.cpp
+@@ -371,7 +371,12 @@ CPLErr BIGGIFDataset::ReOpen()
+ VSIFSeekL( fp, 0, SEEK_SET );
+
+ nLastLineRead = -1;
++#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
++ int nError;
++ hGifFile = DGifOpen( fp, VSIGIFReadFunc, &nError );
++#else
+ hGifFile = DGifOpen( fp, VSIGIFReadFunc );
++#endif
+ if( hGifFile == NULL )
+ {
+ CPLError( CE_Failure, CPLE_OpenFailed,
+diff --git a/frmts/gif/gifdataset.cpp b/frmts/gif/gifdataset.cpp
+index 1947edd..0b99158 100644
+--- a/frmts/gif/gifdataset.cpp
++++ b/frmts/gif/gifdataset.cpp
+@@ -36,8 +36,17 @@ CPL_CVSID("$Id: gifdataset.cpp 23621 2011-12-20 23:26:56Z rouault $");
+ CPL_C_START
+ void GDALRegister_GIF(void);
+
++#if !(defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5)
++
+ // This prototype seems to have been messed up!
+ GifFileType * EGifOpen(void* userData, OutputFunc writeFunc);
++
++// Define alias compatible with giflib >= 5.0.0
++#define GifMakeMapObject MakeMapObject
++#define GifFreeMapObject FreeMapObject
++
++#endif // defined(GIFLIB_MAJOR) && GIFLIB_MAJOR < 5
++
+ CPL_C_END
+
+ static const int InterlacedOffset[] = { 0, 4, 2, 1 };
+@@ -322,7 +331,12 @@ GDALDataset *GIFDataset::Open( GDALOpenInfo * poOpenInfo )
+ if( fp == NULL )
+ return NULL;
+
++#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
++ int nError;
++ hGifFile = DGifOpen( fp, VSIGIFReadFunc, &nError );
++#else
+ hGifFile = DGifOpen( fp, VSIGIFReadFunc );
++#endif
+ if( hGifFile == NULL )
+ {
+ VSIFCloseL( fp );
+@@ -380,7 +394,12 @@ GDALDataset *GIFDataset::Open( GDALOpenInfo * poOpenInfo )
+ DGifCloseFile( hGifFile );
+
+ VSIFSeekL( fp, 0, SEEK_SET);
++
++#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
++ hGifFile = DGifOpen( fp, VSIGIFReadFunc, &nError );
++#else
+ hGifFile = DGifOpen( fp, VSIGIFReadFunc );
++#endif
+ if( hGifFile == NULL )
+ {
+ VSIFCloseL( fp );
+@@ -473,14 +492,19 @@ GDALDataset *GIFDataset::Open( GDALOpenInfo * poOpenInfo )
+ /* GDALPrintGifError() */
+ /************************************************************************/
+
+-static void GDALPrintGifError(const char* pszMsg)
++static void GDALPrintGifError(GifFileType *hGifFile, const char* pszMsg)
+ {
+ /* GIFLIB_MAJOR is only defined in libgif >= 4.2.0 */
+ /* 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)
+ /* Static string actually, hence the const char* cast */
++
++#if GIFLIB_MAJOR >= 5
++ const char* pszGIFLIBError = (const char*) GifErrorString(hGifFile->Error);
++#else
+ const char* pszGIFLIBError = (const char*) GifErrorString();
++#endif
+ if (pszGIFLIBError == NULL)
+ pszGIFLIBError = "Unknown error";
+ CPLError( CE_Failure, CPLE_AppDefined,
+@@ -557,7 +581,12 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
+ return NULL;
+ }
+
++#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
++ int nError;
++ hGifFile = EGifOpen( fp, VSIGIFWriteFunc, &nError );
++#else
+ hGifFile = EGifOpen( fp, VSIGIFWriteFunc );
++#endif
+ if( hGifFile == NULL )
+ {
+ VSIFCloseL( fp );
+@@ -577,7 +606,7 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
+
+ if( poBand->GetColorTable() == NULL )
+ {
+- psGifCT = MakeMapObject( 256, NULL );
++ psGifCT = GifMakeMapObject( 256, NULL );
+ for( iColor = 0; iColor < 256; iColor++ )
+ {
+ psGifCT->Colors[iColor].Red = (GifByteType) iColor;
+@@ -593,7 +622,7 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
+ while( nFullCount < poCT->GetColorEntryCount() )
+ nFullCount = nFullCount * 2;
+
+- psGifCT = MakeMapObject( nFullCount, NULL );
++ psGifCT = GifMakeMapObject( nFullCount, NULL );
+ for( iColor = 0; iColor < poCT->GetColorEntryCount(); iColor++ )
+ {
+ GDALColorEntry sEntry;
+@@ -617,14 +646,14 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
+ if (EGifPutScreenDesc(hGifFile, nXSize, nYSize,
+ psGifCT->ColorCount, 255, psGifCT) == GIF_ERROR)
+ {
+- FreeMapObject(psGifCT);
+- GDALPrintGifError("Error writing gif file.");
++ GifFreeMapObject(psGifCT);
++ GDALPrintGifError(hGifFile, "Error writing gif file.");
+ EGifCloseFile(hGifFile);
+ VSIFCloseL( fp );
+ return NULL;
+ }
+
+- FreeMapObject(psGifCT);
++ GifFreeMapObject(psGifCT);
+ psGifCT = NULL;
+
+ /* Support for transparency */
+@@ -642,7 +671,7 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
+
+ if (EGifPutImageDesc(hGifFile, 0, 0, nXSize, nYSize, bInterlace, NULL) == GIF_ERROR )
+ {
+- GDALPrintGifError("Error writing gif file.");
++ GDALPrintGifError(hGifFile, "Error writing gif file.");
+ EGifCloseFile(hGifFile);
+ VSIFCloseL( fp );
+ return NULL;
+--
+1.7.10.4
+