summaryrefslogtreecommitdiff
path: root/thirdparty/libtiff/tif_close.c
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2012-03-12 11:35:35 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2012-03-12 11:35:35 +0000
commitecd5c523dcd8a416771cb89b1cdef69c94d0aca4 (patch)
treed1c75280e1c3777f46b2e55ecbfd6487809532d8 /thirdparty/libtiff/tif_close.c
parent3de14fc63ecddf490637117ea650e0f559e7f9fe (diff)
[trunk] Update libtiff to 4.0.1 to support BigTIFF. openjpeg/tiff 4.0.1 currently builds on linux/x86_64 and linux/mingw32.
Diffstat (limited to 'thirdparty/libtiff/tif_close.c')
-rw-r--r--thirdparty/libtiff/tif_close.c62
1 files changed, 38 insertions, 24 deletions
diff --git a/thirdparty/libtiff/tif_close.c b/thirdparty/libtiff/tif_close.c
index 02591ba9..13d2bab5 100644
--- a/thirdparty/libtiff/tif_close.c
+++ b/thirdparty/libtiff/tif_close.c
@@ -1,4 +1,4 @@
-/* $Id: tif_close.c,v 1.10.2.1 2010-06-08 18:50:41 bfriesen Exp $ */
+/* $Id: tif_close.c,v 1.19 2010-03-10 18:56:48 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -28,6 +28,7 @@
* TIFF Library.
*/
#include "tiffiop.h"
+#include <string.h>
/************************************************************************/
/* TIFFCleanup() */
@@ -45,18 +46,20 @@
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);
+ TIFFFlush(tif);
(*tif->tif_cleanup)(tif);
TIFFFreeDirectory(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;
@@ -69,27 +72,36 @@ TIFFCleanup(TIFF* tif)
if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))
_TIFFfree(tif->tif_rawdata);
if (isMapped(tif))
- TIFFUnmapFileContents(tif, tif->tif_base, tif->tif_size);
-
- /* Clean up custom fields */
- if (tif->tif_nfields > 0)
- {
- size_t i;
-
- for (i = 0; i < tif->tif_nfields; i++)
- {
- TIFFFieldInfo *fld = tif->tif_fieldinfo[i];
- if (fld->field_bit == FIELD_CUSTOM &&
- strncmp("Tag ", fld->field_name, 4) == 0)
- {
- _TIFFfree(fld->field_name);
- _TIFFfree(fld);
+ TIFFUnmapFileContents(tif, tif->tif_base, (toff_t)tif->tif_size);
+
+ /*
+ * Clean up custom fields.
+ */
+ if (tif->tif_fields && tif->tif_nfields > 0) {
+ uint32 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) {
+ _TIFFfree(fld->field_name);
+ _TIFFfree(fld);
+ }
}
- }
-
- _TIFFfree(tif->tif_fieldinfo);
+
+ _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,6 +129,8 @@ TIFFClose(TIFF* tif)
(void) (*closeproc)(fd);
}
+/* vim: set ts=8 sts=8 sw=8 noet: */
+
/*
* Local Variables:
* mode: c