From da97c5e0a46cd4a55516c80620deedf55c008441 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Thu, 14 Sep 2000 20:22:58 +0000 Subject: [PATCH] Don't return an error from TIFFWriteData() if BEENWRITING not set --- ChangeLog | 6 ++++++ libtiff/tif_flush.c | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ad6d7b4..af080f65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-09-14 Frank Warmerdam + + * tif_flush.c: Changed so that TIFFFlushData() doesn't return an + error when TIFF_BEENWRITING is not set. This ensures that the + directory contents can still be flushed by TIFFFlush(). + 2000-08-14 Frank Warmerdam * tif_open.c: Don't set MMAP for O_RDWR files. diff --git a/libtiff/tif_flush.c b/libtiff/tif_flush.c index e93196d1..df1d1389 100644 --- a/libtiff/tif_flush.c +++ b/libtiff/tif_flush.c @@ -1,4 +1,4 @@ -/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_flush.c,v 1.1 1999-07-27 21:50:27 mike Exp $ */ +/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_flush.c,v 1.2 2000-09-14 20:22:58 warmerda Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -45,12 +45,18 @@ TIFFFlush(TIFF* tif) /* * Flush buffered data to the file. + * + * Frank Warmerdam'2000: I modified this to return 1 if TIFF_BEENWRITING + * is not set, so that TIFFFlush() will proceed to write out the directory. + * The documentation says returning 1 is an error indicator, but not having + * been writing isn't exactly a an error. Hopefully this doesn't cause + * problems for other people. */ int TIFFFlushData(TIFF* tif) { if ((tif->tif_flags & TIFF_BEENWRITING) == 0) - return (0); + return (1); if (tif->tif_flags & TIFF_POSTENCODE) { tif->tif_flags &= ~TIFF_POSTENCODE; if (!(*tif->tif_postencode)(tif)) @@ -58,3 +64,4 @@ TIFFFlushData(TIFF* tif) } return (TIFFFlushData1(tif)); } +