Changeset 24608 for trunk/gdal/frmts/gif
- Timestamp:
- Jun 24, 2012, 2:55:29 PM (12 years ago)
- Location:
- trunk/gdal/frmts/gif
- Files:
-
- 2 edited
-
biggifdataset.cpp (modified) (1 diff)
-
gifdataset.cpp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gdal/frmts/gif/biggifdataset.cpp
r22684 r24608 372 372 373 373 nLastLineRead = -1; 374 #if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 375 int nError; 376 hGifFile = DGifOpen( fp, VSIGIFReadFunc, &nError ); 377 #else 374 378 hGifFile = DGifOpen( fp, VSIGIFReadFunc ); 379 #endif 375 380 if( hGifFile == NULL ) 376 381 { -
trunk/gdal/frmts/gif/gifdataset.cpp
r24490 r24608 37 37 void GDALRegister_GIF(void); 38 38 39 #if !(defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5) 40 39 41 // This prototype seems to have been messed up! 40 42 GifFileType * EGifOpen(void* userData, OutputFunc writeFunc); 43 44 // Define alias compatible with giflib >= 5.0.0 45 #define GifMakeMapObject MakeMapObject 46 #define GifFreeMapObject FreeMapObject 47 48 #endif // defined(GIFLIB_MAJOR) && GIFLIB_MAJOR < 5 49 41 50 CPL_C_END 42 51 … … 323 332 return NULL; 324 333 334 #if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 335 int nError; 336 hGifFile = DGifOpen( fp, VSIGIFReadFunc, &nError ); 337 #else 325 338 hGifFile = DGifOpen( fp, VSIGIFReadFunc ); 339 #endif 326 340 if( hGifFile == NULL ) 327 341 { … … 381 395 382 396 VSIFSeekL( fp, 0, SEEK_SET); 397 398 #if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 399 hGifFile = DGifOpen( fp, VSIGIFReadFunc, &nError ); 400 #else 383 401 hGifFile = DGifOpen( fp, VSIGIFReadFunc ); 402 #endif 384 403 if( hGifFile == NULL ) 385 404 { … … 474 493 /************************************************************************/ 475 494 476 static void GDALPrintGifError( const char* pszMsg)495 static void GDALPrintGifError(GifFileType *hGifFile, const char* pszMsg) 477 496 { 478 497 /* GIFLIB_MAJOR is only defined in libgif >= 4.2.0 */ … … 481 500 ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4) 482 501 /* Static string actually, hence the const char* cast */ 502 503 #if GIFLIB_MAJOR >= 5 504 const char* pszGIFLIBError = (const char*) GifErrorString(hGifFile->Error); 505 #else 483 506 const char* pszGIFLIBError = (const char*) GifErrorString(); 507 #endif 484 508 if (pszGIFLIBError == NULL) 485 509 pszGIFLIBError = "Unknown error"; … … 558 582 } 559 583 584 #if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 585 int nError; 586 hGifFile = EGifOpen( fp, VSIGIFWriteFunc, &nError ); 587 #else 560 588 hGifFile = EGifOpen( fp, VSIGIFWriteFunc ); 589 #endif 561 590 if( hGifFile == NULL ) 562 591 { … … 578 607 if( poBand->GetColorTable() == NULL ) 579 608 { 580 psGifCT = MakeMapObject( 256, NULL );609 psGifCT = GifMakeMapObject( 256, NULL ); 581 610 for( iColor = 0; iColor < 256; iColor++ ) 582 611 { … … 594 623 nFullCount = nFullCount * 2; 595 624 596 psGifCT = MakeMapObject( nFullCount, NULL );625 psGifCT = GifMakeMapObject( nFullCount, NULL ); 597 626 for( iColor = 0; iColor < poCT->GetColorEntryCount(); iColor++ ) 598 627 { … … 618 647 psGifCT->ColorCount, 255, psGifCT) == GIF_ERROR) 619 648 { 620 FreeMapObject(psGifCT);621 GDALPrintGifError( "Error writing gif file.");649 GifFreeMapObject(psGifCT); 650 GDALPrintGifError(hGifFile, "Error writing gif file."); 622 651 EGifCloseFile(hGifFile); 623 652 VSIFCloseL( fp ); … … 625 654 } 626 655 627 FreeMapObject(psGifCT);656 GifFreeMapObject(psGifCT); 628 657 psGifCT = NULL; 629 658 … … 643 672 if (EGifPutImageDesc(hGifFile, 0, 0, nXSize, nYSize, bInterlace, NULL) == GIF_ERROR ) 644 673 { 645 GDALPrintGifError( "Error writing gif file.");674 GDALPrintGifError(hGifFile, "Error writing gif file."); 646 675 EGifCloseFile(hGifFile); 647 676 VSIFCloseL( fp );
Note:
See TracChangeset
for help on using the changeset viewer.
