diff --git a/ChangeLog b/ChangeLog index 42382e7e..f8127807 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-02-05 Frank Warmerdam + + * libtiff/tif_dirread.c: Fixed testing for failed result from + TIFFReadDirectoryFindFieldInfo(). + http://bugzilla.maptools.org/show_bug.cgi?id=1992 + 2009-01-23 Frank Warmerdam * libtiff/tif_predict.c: Add support for 32bit integer horz. predictors. diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c index 230321d0..13bf0fe2 100644 --- a/libtiff/tif_dirread.c +++ b/libtiff/tif_dirread.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirread.c,v 1.148 2009-01-22 19:06:49 fwarmerdam Exp $ */ +/* $Id: tif_dirread.c,v 1.149 2009-02-05 16:07:59 fwarmerdam Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -42,6 +42,7 @@ #include "tiffiop.h" #define IGNORE 0 /* tag placeholder used below */ +#define FAILED_FII ((uint32) -1) #ifdef HAVE_IEEEFP # define TIFFCvtIEEEFloatToNative(tif, n, fp) @@ -3483,7 +3484,7 @@ TIFFReadDirectory(TIFF* tif) if (dp->tdir_tag!=IGNORE) { TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii); - if (fii==(uint32)(-1)) + if (fii == FAILED_FII) { TIFFWarningExt(tif->tif_clientdata, module, "Unknown field with tag %d (0x%x) encountered", @@ -3503,7 +3504,7 @@ TIFFReadDirectory(TIFF* tif) dp->tdir_tag=IGNORE; } else { TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii); - assert(fii!=(uint32)(-1)); + assert(fii != FAILED_FII); } } } @@ -4021,7 +4022,7 @@ TIFFReadDirectoryFindFieldInfo(TIFF* tif, uint16 tagid, uint32* fii) { if (ma+1==mc) { - *fii=(uint32)(-1); + *fii = FAILED_FII; return; } mb=(ma+mc)/2; @@ -4072,7 +4073,7 @@ TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, for (di=0, dp=dir; ditdir_tag,&fii); - if (fii==0xFFFF) + if (fii == FAILED_FII) { TIFFWarningExt(tif->tif_clientdata, module, "Unknown field with tag %d (0x%x) encountered", @@ -4087,7 +4088,7 @@ TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, dp->tdir_tag=IGNORE; } else { TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii); - assert(fii!=0xFFFF); + assert( fii != FAILED_FII ); } } if (dp->tdir_tag!=IGNORE) @@ -4580,8 +4581,8 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover) uint32 fii; const TIFFField* fip; TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii); - assert(fii!=0xFFFFFFFF); - if( fii == 0xFFFFFFFF ) + assert(fii != FAILED_FII); + if( fii == FAILED_FII ) { TIFFErrorExt(tif->tif_clientdata, "TIFFFetchNormalTag", "No definition found for tag %d",