Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygentif_close.c
Go to the documentation of this file.
00001 /* $Id: tif_close.c,v 1.10.2.1 2010-06-08 18:50:41 bfriesen Exp $ */ 00002 00003 /* 00004 * Copyright (c) 1988-1997 Sam Leffler 00005 * Copyright (c) 1991-1997 Silicon Graphics, Inc. 00006 * 00007 * Permission to use, copy, modify, distribute, and sell this software and 00008 * its documentation for any purpose is hereby granted without fee, provided 00009 * that (i) the above copyright notices and this permission notice appear in 00010 * all copies of the software and related documentation, and (ii) the names of 00011 * Sam Leffler and Silicon Graphics may not be used in any advertising or 00012 * publicity relating to the software without the specific, prior written 00013 * permission of Sam Leffler and Silicon Graphics. 00014 * 00015 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 00016 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 00017 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 00018 * 00019 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 00020 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 00021 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 00022 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 00023 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 00024 * OF THIS SOFTWARE. 00025 */ 00026 00027 /* 00028 * TIFF Library. 00029 */ 00030 #include "tiffiop.h" 00031 00032 /************************************************************************/ 00033 /* TIFFCleanup() */ 00034 /************************************************************************/ 00035 00045 void 00046 TIFFCleanup(TIFF* tif) 00047 { 00048 if (tif->tif_mode != O_RDONLY) 00049 /* 00050 * Flush buffered data and directory (if dirty). 00051 */ 00052 TIFFFlush(tif); 00053 (*tif->tif_cleanup)(tif); 00054 TIFFFreeDirectory(tif); 00055 00056 if (tif->tif_dirlist) 00057 _TIFFfree(tif->tif_dirlist); 00058 00059 /* Clean up client info links */ 00060 while( tif->tif_clientinfo ) 00061 { 00062 TIFFClientInfoLink *link = tif->tif_clientinfo; 00063 00064 tif->tif_clientinfo = link->next; 00065 _TIFFfree( link->name ); 00066 _TIFFfree( link ); 00067 } 00068 00069 if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER)) 00070 _TIFFfree(tif->tif_rawdata); 00071 if (isMapped(tif)) 00072 TIFFUnmapFileContents(tif, tif->tif_base, tif->tif_size); 00073 00074 /* Clean up custom fields */ 00075 if (tif->tif_nfields > 0) 00076 { 00077 size_t i; 00078 00079 for (i = 0; i < tif->tif_nfields; i++) 00080 { 00081 TIFFFieldInfo *fld = tif->tif_fieldinfo[i]; 00082 if (fld->field_bit == FIELD_CUSTOM && 00083 strncmp("Tag ", fld->field_name, 4) == 0) 00084 { 00085 _TIFFfree(fld->field_name); 00086 _TIFFfree(fld); 00087 } 00088 } 00089 00090 _TIFFfree(tif->tif_fieldinfo); 00091 } 00092 00093 _TIFFfree(tif); 00094 } 00095 00096 /************************************************************************/ 00097 /* TIFFClose() */ 00098 /************************************************************************/ 00099 00110 void 00111 TIFFClose(TIFF* tif) 00112 { 00113 TIFFCloseProc closeproc = tif->tif_closeproc; 00114 thandle_t fd = tif->tif_clientdata; 00115 00116 TIFFCleanup(tif); 00117 (void) (*closeproc)(fd); 00118 } 00119 00120 /* 00121 * Local Variables: 00122 * mode: c 00123 * c-basic-offset: 8 00124 * fill-column: 78 00125 * End: 00126 */ Generated on Sun May 27 2012 04:19:32 for ReactOS by
1.7.6.1
|