From 8b2b03ae112629d3aed9603f6dd7fe27746c2224 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Fri, 24 Aug 2007 20:49:38 +0000 Subject: [PATCH] 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. --- ChangeLog | 7 ++++++- libtiff/tif_dirwrite.c | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ccc87336..32945c93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ 2007-08-24 Frank Warmerdam - * tif_dirinfo.c: _TIFFMergeFields() now only merges in field + * 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 definitions that are missing. Existing definitions are silently ignored. diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c index 89aeb964..2eb9f74c 100644 --- a/libtiff/tif_dirwrite.c +++ b/libtiff/tif_dirwrite.c @@ -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 @@ -781,7 +781,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff) n+=4; o++; } - *(uint32*)n=0; + *(uint32*)n = tif->tif_nextdiroff; } else { @@ -811,7 +811,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff) n+=8; o++; } - *(uint64*)n=0; + *(uint64*)n = tif->tif_nextdiroff; } _TIFFfree(dir); dir=NULL;