2008.12.17 20:54 "[Tiff] Deleting tags from a directory", by Frank Warmerdam

2009.02.06 14:56 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Frank Warmerdam

Joris Van Damme (AWare Systems) wrote:

Frank, folks,

This is about http://bugzilla.maptools.org/show_bug.cgi?id=1994. I've currently no bugzilla log-in, and/or I forgot about it, so I'll go ahead and abuse the mailing list.

Joris,

I would appreciate it if you could get a bugzilla account, and be prepared to interact with bugs there. In the meantime I've appended your email to the ticket.

In TIFFFetchNormalTag() we have lots of logic like:

        case TIFF_SETGET_UINT16:
                {
                        uint16 data;
                        assert(fip->field_readcount==1);
                        assert(fip->field_passcount==0);
                        err=TIFFReadDirEntryShort(tif,dp,&data);
                        if (err==TIFFReadDirEntryErrOk)
                        {
                                if (!TIFFSetField(tif,dp->tdir_tag,data))
                                        return(0);
                        }
                }
                break;

Would it be better to change these assertions to a runtime error indicating that this tag is not suitable for processing in TIFFFetchNormalTag(), possibly indicating a corrupt file or a logic error in libtiff?

This is quite a dirty file so I'm pleased to settle with reasonable error reports and recovery.

I presume the "fip" description of the tag cannot be made compatible with TIFFFetchNormalTag for some reason? It does not *seem* like a particularly complicated tag to handle generically. It is currently:

        { TIFFTAG_COMPRESSION, -1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16,

TIFF_SETGET_UNDEFINED, FIELD_COMPRESSION, 0, 0, "Compression", NULL },

I a bit lost in aspects of this - particularly the stuff about set_field_type and get_field_type in the TIFFField structure.

Actually, can't we just set the field_readcount to 1 and then this definition would work?

Best regards,
--
---------------------------------------+--------------------------------------

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam

and watch the world go round - Rush    | Geospatial Programmer for Rent