ReactOS 0.4.15-dev-8417-gb6b82fe
tif_close.c File Reference
#include <precomp.h>
Include dependency graph for tif_close.c:

Go to the source code of this file.

Functions

void TIFFCleanup (TIFF *tif)
 
void TIFFClose (TIFF *tif)
 

Function Documentation

◆ TIFFCleanup()

void TIFFCleanup ( TIFF tif)

Auxiliary function to free the TIFF structure. Given structure will be completely freed, so you should save opened file handle and pointer to the close procedure in external variables before calling _TIFFCleanup(), if you will need these ones to close the file.

Parameters
tifA TIFF pointer.

Definition at line 46 of file tif_close.c.

47{
48 /*
49 * Flush buffered data and directory (if dirty).
50 */
51 if (tif->tif_mode != O_RDONLY)
52 TIFFFlush(tif);
53 (*tif->tif_cleanup)(tif);
55
56 if (tif->tif_dirlist)
58
59 /*
60 * Clean up client info links.
61 */
62 while( tif->tif_clientinfo )
63 {
65
66 tif->tif_clientinfo = psLink->next;
67 _TIFFfree( psLink->name );
68 _TIFFfree( psLink );
69 }
70
71 if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))
73 if (isMapped(tif))
75
76 /*
77 * Clean up custom fields.
78 */
79 if (tif->tif_fields && tif->tif_nfields > 0) {
80 uint32 i;
81
82 for (i = 0; i < tif->tif_nfields; i++) {
83 TIFFField *fld = tif->tif_fields[i];
84 if (fld->field_bit == FIELD_CUSTOM &&
85 strncmp("Tag ", fld->field_name, 4) == 0) {
87 _TIFFfree(fld);
88 }
89 }
90
92 }
93
94 if (tif->tif_nfieldscompat > 0) {
95 uint32 i;
96
97 for (i = 0; i < tif->tif_nfieldscompat; i++) {
100 }
102 }
103
104 _TIFFfree(tif);
105}
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define O_RDONLY
Definition: acwin.h:108
unsigned int uint32
Definition: types.h:32
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
TIFFField * fields
Definition: tif_dir.h:279
uint32 allocated_size
Definition: tif_dir.h:277
char * field_name
Definition: tif_dir.h:293
unsigned short field_bit
Definition: tif_dir.h:290
struct client_info * next
Definition: tiffiop.h:94
char * name
Definition: tiffiop.h:96
uint64 * tif_dirlist
Definition: tiffiop.h:148
size_t tif_nfields
Definition: tiffiop.h:217
TIFFClientInfoLink * tif_clientinfo
Definition: tiffiop.h:220
TIFFField ** tif_fields
Definition: tiffiop.h:216
uint8 * tif_base
Definition: tiffiop.h:202
uint32 tif_flags
Definition: tiffiop.h:119
tmsize_t tif_size
Definition: tiffiop.h:203
TIFFVoidMethod tif_cleanup
Definition: tiffiop.h:188
size_t tif_nfieldscompat
Definition: tiffiop.h:224
int tif_mode
Definition: tiffiop.h:118
TIFFFieldArray * tif_fieldscompat
Definition: tiffiop.h:223
uint8 * tif_rawdata
Definition: tiffiop.h:195
void TIFFFreeDirectory(TIFF *tif)
Definition: tif_dir.c:1268
int TIFFFlush(TIFF *tif)
Definition: tif_flush.c:32
void _TIFFfree(void *p)
Definition: tif_unix.c:326
uint64 toff_t
Definition: tiffio.h:66
#define FIELD_CUSTOM
Definition: tiffio.h:312
#define TIFF_MYBUFFER
Definition: tiffiop.h:128
#define TIFFUnmapFileContents(tif, addr, size)
Definition: tiffiop.h:245
#define isMapped(tif)
Definition: tiffiop.h:230

Referenced by TIFFClientOpen(), and TIFFClose().

◆ TIFFClose()

void TIFFClose ( TIFF tif)

Close a previously opened TIFF file.

TIFFClose closes a file that was previously opened with TIFFOpen(). Any buffered data are flushed to the file, including the contents of the current directory (if modified); and all resources are reclaimed.

Parameters
tifA TIFF pointer.

Definition at line 122 of file tif_close.c.

123{
124 TIFFCloseProc closeproc = tif->tif_closeproc;
126
127 TIFFCleanup(tif);
128 (void) (*closeproc)(fd);
129}
static int fd
Definition: io.c:51
TIFFCloseProc tif_closeproc
Definition: tiffiop.h:211
thandle_t tif_clientdata
Definition: tiffiop.h:207
void TIFFCleanup(TIFF *tif)
Definition: tif_close.c:46
int(* TIFFCloseProc)(thandle_t)
Definition: tiffio.h:275