Write the tif_nextdiroff value instead of a fixed zero when writing

directory contents to preserve the ability to rewrite directories in place,
even in the middle of a directory chain.
This commit is contained in:
Frank Warmerdam 2007-08-24 20:49:38 +00:00
parent a6bea11162
commit 8b2b03ae11
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,10 @@
2007-08-24 Frank Warmerdam <warmerdam@pobox.com> 2007-08-24 Frank Warmerdam <warmerdam@pobox.com>
* tif_dirwrite.c: Write the tif_nextdiroff value instead of a fixed
zero when writing directory contents to preserve the ability to
rewrite directories in place, even in the middle of a directory
chain.
* tif_dirinfo.c: _TIFFMergeFields() now only merges in field * tif_dirinfo.c: _TIFFMergeFields() now only merges in field
definitions that are missing. Existing definitions are silently definitions that are missing. Existing definitions are silently
ignored. ignored.

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirwrite.c,v 1.56 2007-07-10 11:52:02 dron Exp $ */ /* $Id: tif_dirwrite.c,v 1.57 2007-08-24 20:49:38 fwarmerdam Exp $ */
/* /*
* Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1988-1997 Sam Leffler
@ -781,7 +781,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
n+=4; n+=4;
o++; o++;
} }
*(uint32*)n=0; *(uint32*)n = tif->tif_nextdiroff;
} }
else else
{ {
@ -811,7 +811,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
n+=8; n+=8;
o++; o++;
} }
*(uint64*)n=0; *(uint64*)n = tif->tif_nextdiroff;
} }
_TIFFfree(dir); _TIFFfree(dir);
dir=NULL; dir=NULL;