- Fix build: PrintGifError was removed from core library of giflib 4.2.0 [1]
Obtained from: http://trac.osgeo.org/gdal/ticket/4675 Reference: http://giflib.git.sourceforge.net/git/gitweb.cgi?p=giflib/giflib;a=blob;f=NEWS [1]
This commit is contained in:
parent
af08430878
commit
bf46bc1877
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=298471
1 changed files with 55 additions and 0 deletions
55
graphics/gdal/files/patch-frmts-gif-gifdatasetp.cpp
Normal file
55
graphics/gdal/files/patch-frmts-gif-gifdatasetp.cpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
Ref: http://trac.osgeo.org/gdal/ticket/4675
|
||||
|
||||
--- frmts/gif/gifdataset.cpp.orig 2012-05-17 11:30:54.000000000 +0800
|
||||
+++ frmts/gif/gifdataset.cpp 2012-06-05 00:23:12.988213306 +0800
|
||||
@@ -469,6 +469,28 @@
|
||||
return poDS;
|
||||
}
|
||||
|
||||
+ /************************************************************************/
|
||||
+/* GDALPrintGifError() */
|
||||
+/************************************************************************/
|
||||
+
|
||||
+static void GDALPrintGifError(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 */
|
||||
+ const char* pszGIFLIBError = (const char*) GifErrorString();
|
||||
+ if (pszGIFLIBError == NULL)
|
||||
+ pszGIFLIBError = "Unknown error";
|
||||
+ CPLError( CE_Failure, CPLE_AppDefined,
|
||||
+ "%s. GIFLib Error : %s", pszMsg, pszGIFLIBError );
|
||||
+#else
|
||||
+ PrintGifError();
|
||||
+ CPLError( CE_Failure, CPLE_AppDefined, "%s", pszMsg );
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
/************************************************************************/
|
||||
/* CreateCopy() */
|
||||
/************************************************************************/
|
||||
@@ -596,9 +618,7 @@
|
||||
psGifCT->ColorCount, 255, psGifCT) == GIF_ERROR)
|
||||
{
|
||||
FreeMapObject(psGifCT);
|
||||
- PrintGifError();
|
||||
- CPLError( CE_Failure, CPLE_AppDefined,
|
||||
- "Error writing gif file." );
|
||||
+ GDALPrintGifError("Error writing gif file.");
|
||||
EGifCloseFile(hGifFile);
|
||||
VSIFCloseL( fp );
|
||||
return NULL;
|
||||
@@ -622,9 +642,7 @@
|
||||
|
||||
if (EGifPutImageDesc(hGifFile, 0, 0, nXSize, nYSize, bInterlace, NULL) == GIF_ERROR )
|
||||
{
|
||||
- PrintGifError();
|
||||
- CPLError( CE_Failure, CPLE_AppDefined,
|
||||
- "Error writing gif file." );
|
||||
+ GDALPrintGifError("Error writing gif file.");
|
||||
EGifCloseFile(hGifFile);
|
||||
VSIFCloseL( fp );
|
||||
return NULL;
|
Loading…
Reference in a new issue