Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Commit

Permalink
avoid extra tile info write in TIFFWriteDirectory()
Browse files Browse the repository at this point in the history
  • Loading branch information
fwarmerdam committed Nov 2, 2007
1 parent 865f7b2 commit 371336d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
2007-11-02 Frank Warmerdam <warmerdam@pobox.com>

* tif_dirwrite.c: Try to avoid writing out a full readbuffer of tile
data when writing the directory just because we have BEENWRITING at
some point in the past. This was causing odd junk to be written out
in a tile of data when a single tile had an interleaving of reading
and writing with reading last. (highlighted by gdal
autotest/gcore/tif_write.py test 7.

* tif_predict.c: use working buffer in PredictorEncodeTile to avoid
modifying callers buffer.
http://trac.osgeo.org/gdal/ticket/1965
Expand Down
9 changes: 7 additions & 2 deletions libtiff/tif_dirwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
*/
if (imagedone)
{
tmsize_t orig_rawcc = tif->tif_rawcc;

if (tif->tif_flags & TIFF_POSTENCODE)
{
tif->tif_flags &= ~TIFF_POSTENCODE;
Expand All @@ -336,9 +338,12 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
(*tif->tif_close)(tif); /* shutdown encoder */
/*
* Flush any data that might have been written
* by the compression close+cleanup routines.
* by the compression close+cleanup routines. But
* be careful not to write stuff if we didn't add data
* in the previous steps as the "rawcc" data may well be
* a previously read tile/strip in mixed read/write mode.
*/
if (tif->tif_rawcc > 0
if (tif->tif_rawcc > 0 && tif->tif_rawcc != orig_rawcc
&& (tif->tif_flags & TIFF_BEENWRITING) != 0
&& !TIFFFlushData1(tif))
{
Expand Down

0 comments on commit 371336d

Please sign in to comment.