Changeset 24490 for trunk/gdal/frmts/gif


Ignore:
Timestamp:
May 21, 2012, 2:14:28 PM (12 years ago)
Author:
Even Rouault
Message:

GIF driver: add support for libgif 4.2.0 (#4675)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gdal/frmts/gif/gifdataset.cpp

    r23621 r24490  
    471471
    472472/************************************************************************/
     473/*                        GDALPrintGifError()                           */
     474/************************************************************************/
     475
     476static void GDALPrintGifError(const char* pszMsg)
     477{
     478/* GIFLIB_MAJOR is only defined in libgif >= 4.2.0 */
     479/* libgif 4.2.0 has retired PrintGifError() and added GifErrorString() */
     480#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && \
     481        ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4)
     482    /* Static string actually, hence the const char* cast */
     483    const char* pszGIFLIBError = (const char*) GifErrorString();
     484    if (pszGIFLIBError == NULL)
     485        pszGIFLIBError = "Unknown error";
     486    CPLError( CE_Failure, CPLE_AppDefined,
     487              "%s. GIFLib Error : %s", pszMsg, pszGIFLIBError );
     488#else
     489    PrintGifError();
     490    CPLError( CE_Failure, CPLE_AppDefined, "%s", pszMsg );
     491#endif
     492}
     493
     494/************************************************************************/
    473495/*                             CreateCopy()                             */
    474496/************************************************************************/
     
    597619    {
    598620        FreeMapObject(psGifCT);
    599         PrintGifError();
    600         CPLError( CE_Failure, CPLE_AppDefined,
    601                   "Error writing gif file." );
     621        GDALPrintGifError("Error writing gif file.");
    602622        EGifCloseFile(hGifFile);
    603623        VSIFCloseL( fp );
     
    623643    if (EGifPutImageDesc(hGifFile, 0, 0, nXSize, nYSize, bInterlace, NULL) == GIF_ERROR )
    624644    {
    625         PrintGifError();
    626         CPLError( CE_Failure, CPLE_AppDefined,
    627                   "Error writing gif file." );
     645        GDALPrintGifError("Error writing gif file.");
    628646        EGifCloseFile(hGifFile);
    629647        VSIFCloseL( fp );
Note: See TracChangeset for help on using the changeset viewer.