
Thread
2005.01.21 22:47 "[Tiff] removing tiff header tags", by Antoine
Hi,
In spite of really not knowing what on earth I am doing, I have managed to do what I think will be enough for our needs. It is *horrible*! Even though I know nothing about c style, I can tell you even a monkey would bork at it...
I worked on the assumption that in tiffcp, in the function tiffcp, everything that wasn't in the loop:
for (p = tags; p < &tags[NTAGS]; p++)
CopyTag(p->tag, p->count, p->type);
would be sorely missed, so not to bother with it. From what I can remember there was nothing not in the spec we need to follow anyway. So I put a commandline option (-d tagToDelete), and if it is passed then just before getting to the tiffcp function I take control to my function, which I pass the value (number?) of the tag to (as well as in and out). I then do everything else that tiffcp does except change the loop to:
for (p = tags; p < &tags[NTAGS]; p++){
if (tagToDelete != p->tag)
CopyTag(p->tag, p->count, p->type);
else
printf("HUUUUUUUUUURRRRRAAAAAAAHHHHHHH\n");
}
And what do ya know? It works! I won't bother posting it anywhere, cos it would be far less work for a competent c programmer to write from scratch than to clean up what I did.
I do have one question though - is my assumption correct that I shouldn't be messing with the tags that come before the loop (see how well I know the format ;-)?)? If not, which ones could I reasonably test and omit?
Cheers
Antoine