diff --git a/Modules/ThirdParty/TIFF/src/itktiff/tif_dirread.c b/Modules/ThirdParty/TIFF/src/itktiff/tif_dirread.c index 58c9e0feae3..402b4ca7d9c 100644 --- a/Modules/ThirdParty/TIFF/src/itktiff/tif_dirread.c +++ b/Modules/ThirdParty/TIFF/src/itktiff/tif_dirread.c @@ -3538,9 +3538,12 @@ TIFFReadDirectory(TIFF* tif) TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii); if (fii == FAILED_FII) { - TIFFWarningExt(tif->tif_clientdata, module, - "Unknown field with tag %d (0x%x) encountered", - dp->tdir_tag,dp->tdir_tag); + if (tif->tif_flags&TIFF_WARNABOUTUNKNOWNTAGS) + { + TIFFWarningExt(tif->tif_clientdata, module, + "Unknown field with tag %d (0x%x) encountered", + dp->tdir_tag,dp->tdir_tag); + } /* the following knowingly leaks the anonymous field structure */ if (!_TIFFMergeFields(tif, @@ -4181,16 +4184,22 @@ TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii); if (fii == FAILED_FII) { - TIFFWarningExt(tif->tif_clientdata, module, - "Unknown field with tag %d (0x%x) encountered", - dp->tdir_tag, dp->tdir_tag); + if (tif->tif_flags&TIFF_WARNABOUTUNKNOWNTAGS) + { + TIFFWarningExt(tif->tif_clientdata, module, + "Unknown field with tag %d (0x%x) encountered", + dp->tdir_tag, dp->tdir_tag); + } if (!_TIFFMergeFields(tif, _TIFFCreateAnonField(tif, dp->tdir_tag, (TIFFDataType) dp->tdir_type), 1)) { - TIFFWarningExt(tif->tif_clientdata, module, - "Registering anonymous field with tag %d (0x%x) failed", - dp->tdir_tag, dp->tdir_tag); + if (tif->tif_flags&TIFF_WARNABOUTUNKNOWNTAGS) + { + TIFFWarningExt(tif->tif_clientdata, module, + "Registering anonymous field with tag %d (0x%x) failed", + dp->tdir_tag, dp->tdir_tag); + } dp->tdir_tag=IGNORE; } else { TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii); diff --git a/Modules/ThirdParty/TIFF/src/itktiff/tif_open.c b/Modules/ThirdParty/TIFF/src/itktiff/tif_open.c index 1ab41a3a5a5..ac1a48c0ab5 100644 --- a/Modules/ThirdParty/TIFF/src/itktiff/tif_open.c +++ b/Modules/ThirdParty/TIFF/src/itktiff/tif_open.c @@ -264,6 +264,9 @@ TIFFClientOpen( if (m&O_CREAT) tif->tif_flags |= TIFF_BIGTIFF; break; + case 'W': + tif->tif_flags |= TIFF_WARNABOUTUNKNOWNTAGS; + break; } /* * Read in TIFF header. diff --git a/Modules/ThirdParty/TIFF/src/itktiff/tiffiop.h b/Modules/ThirdParty/TIFF/src/itktiff/tiffiop.h index 5aa1c9bc6ba..7df57a65d27 100644 --- a/Modules/ThirdParty/TIFF/src/itktiff/tiffiop.h +++ b/Modules/ThirdParty/TIFF/src/itktiff/tiffiop.h @@ -122,6 +122,7 @@ struct tiff { #define TIFF_DIRTYSTRIP 0x200000 /* stripoffsets/stripbytecount dirty*/ #define TIFF_PERSAMPLE 0x400000 /* get/set per sample tags as arrays */ #define TIFF_BUFFERMMAP 0x800000 /* read buffer (tif_rawdata) points into mmap() memory */ + #define TIFF_WARNABOUTUNKNOWNTAGS 0x1000000 /* emit a warning when encountering a unknown tag */ uint64 tif_diroff; /* file offset of current directory */ uint64 tif_nextdiroff; /* file offset of following directory */ uint64* tif_dirlist; /* list of offsets to already seen directories to prevent IFD looping */