diff options
author | Andrey Kiselev <dron@ak4719.spb.edu> | 2007-07-12 13:59:34 +0000 |
---|---|---|
committer | Andrey Kiselev <dron@ak4719.spb.edu> | 2007-07-12 13:59:34 +0000 |
commit | 2d54748c154e7d66f4584eda7093f4aef263c391 (patch) | |
tree | a0f4f89dd244a0324f6e5305c5179b47d70b9c14 /libtiff/tif_close.c | |
parent | 6969957dd5caa5f56caa1ccfc8b3eaeade374209 (diff) | |
download | libtiff-git-2d54748c154e7d66f4584eda7093f4aef263c391.tar.gz |
Transition to the new-style tag extending scheme completed.
Diffstat (limited to 'libtiff/tif_close.c')
-rw-r--r-- | libtiff/tif_close.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/libtiff/tif_close.c b/libtiff/tif_close.c index 324423b0..729794dd 100644 --- a/libtiff/tif_close.c +++ b/libtiff/tif_close.c @@ -1,4 +1,4 @@ -/* $Id: tif_close.c,v 1.15 2007-07-11 15:52:48 joris Exp $ */ +/* $Id: tif_close.c,v 1.16 2007-07-12 13:59:34 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -45,10 +45,10 @@ void TIFFCleanup(TIFF* tif) { + /* + * Flush buffered data and directory (if dirty). + */ if (tif->tif_mode != O_RDONLY) - /* - * Flush buffered data and directory (if dirty). - */ TIFFFlush(tif); (*tif->tif_cleanup)(tif); TIFFFreeDirectory(tif); @@ -56,7 +56,9 @@ TIFFCleanup(TIFF* tif) if (tif->tif_dirlist) _TIFFfree(tif->tif_dirlist); - /* Clean up client info links */ + /* + * Clean up client info links. + */ while( tif->tif_clientinfo ) { TIFFClientInfoLink *link = tif->tif_clientinfo; @@ -71,17 +73,16 @@ TIFFCleanup(TIFF* tif) if (isMapped(tif)) TIFFUnmapFileContents(tif, tif->tif_base, (toff_t)tif->tif_size); - /* Clean up custom fields */ - if (tif->tif_nfields > 0) - { + /* + * Clean up custom fields. + */ + if (tif->tif_nfields > 0) { uint32 i; - for (i = 0; i < tif->tif_nfields; i++) - { + for (i = 0; i < tif->tif_nfields; i++) { TIFFField *fld = tif->tif_fields[i]; if (fld->field_bit == FIELD_CUSTOM && - strncmp("Tag ", fld->field_name, 4) == 0) - { + strncmp("Tag ", fld->field_name, 4) == 0) { _TIFFfree(fld->field_name); _TIFFfree(fld); } @@ -90,6 +91,16 @@ TIFFCleanup(TIFF* tif) _TIFFfree(tif->tif_fields); } + if (tif->tif_nfieldscompat > 0) { + uint32 i; + + for (i = 0; i < tif->tif_nfieldscompat; i++) { + if (tif->tif_fieldscompat[i].allocated_size) + _TIFFfree(tif->tif_fieldscompat[i].fields); + } + _TIFFfree(tif->tif_fieldscompat); + } + _TIFFfree(tif); } @@ -117,3 +128,5 @@ TIFFClose(TIFF* tif) (void) (*closeproc)(fd); } +/* vim: set ts=8 sts=8 sw=8 noet: */ + |