ReactOS 0.4.15-dev-7842-g558ab78
tif_flush.c File Reference
#include <precomp.h>
Include dependency graph for tif_flush.c:

Go to the source code of this file.

Functions

int TIFFFlush (TIFF *tif)
 
int TIFFForceStrileArrayWriting (TIFF *tif)
 
int TIFFFlushData (TIFF *tif)
 

Function Documentation

◆ TIFFFlush()

int TIFFFlush ( TIFF tif)

Definition at line 32 of file tif_flush.c.

33{
34 if( tif->tif_mode == O_RDONLY )
35 return 1;
36
37 if (!TIFFFlushData(tif))
38 return (0);
39
40 /* In update (r+) mode we try to detect the case where
41 only the strip/tile map has been altered, and we try to
42 rewrite only that portion of the directory without
43 making any other changes */
44
45 if( (tif->tif_flags & TIFF_DIRTYSTRIP)
46 && !(tif->tif_flags & TIFF_DIRTYDIRECT)
47 && tif->tif_mode == O_RDWR )
48 {
50 return 1;
51 }
52
54 && !TIFFRewriteDirectory(tif))
55 return (0);
56
57 return (1);
58}
#define O_RDONLY
Definition: acwin.h:108
#define O_RDWR
Definition: fcntl.h:36
uint32 tif_flags
Definition: tiffiop.h:119
int tif_mode
Definition: tiffiop.h:118
int TIFFRewriteDirectory(TIFF *tif)
Definition: tif_dirwrite.c:261
int TIFFForceStrileArrayWriting(TIFF *tif)
Definition: tif_flush.c:79
int TIFFFlushData(TIFF *tif)
Definition: tif_flush.c:156
#define TIFF_DIRTYSTRIP
Definition: tiffiop.h:140
#define TIFF_DIRTYDIRECT
Definition: tiffiop.h:122

Referenced by TIFFCleanup().

◆ TIFFFlushData()

int TIFFFlushData ( TIFF tif)

Definition at line 156 of file tif_flush.c.

157{
158 if ((tif->tif_flags & TIFF_BEENWRITING) == 0)
159 return (1);
160 if (tif->tif_flags & TIFF_POSTENCODE) {
161 tif->tif_flags &= ~TIFF_POSTENCODE;
162 if (!(*tif->tif_postencode)(tif))
163 return (0);
164 }
165 return (TIFFFlushData1(tif));
166}
TIFFBoolMethod tif_postencode
Definition: tiffiop.h:179
int TIFFFlushData1(TIFF *tif)
Definition: tif_write.c:803
#define TIFF_POSTENCODE
Definition: tiffiop.h:131
#define TIFF_BEENWRITING
Definition: tiffiop.h:125

Referenced by TIFFFlush(), and TIFFWriteScanline().

◆ TIFFForceStrileArrayWriting()

int TIFFForceStrileArrayWriting ( TIFF tif)

Definition at line 79 of file tif_flush.c.

80{
81 static const char module[] = "TIFFForceStrileArrayWriting";
82 const int isTiled = TIFFIsTiled(tif);
83
84 if (tif->tif_mode == O_RDONLY)
85 {
87 "File opened in read-only mode");
88 return 0;
89 }
90 if( tif->tif_diroff == 0 )
91 {
93 "Directory has not yet been written");
94 return 0;
95 }
96 if( (tif->tif_flags & TIFF_DIRTYDIRECT) != 0 )
97 {
99 "Directory has changes other than the strile arrays. "
100 "TIFFRewriteDirectory() should be called instead");
101 return 0;
102 }
103
104 if( !(tif->tif_flags & TIFF_DIRTYSTRIP) )
105 {
106 if( !(tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 &&
114 {
116 "Function not called together with "
117 "TIFFDeferStrileArrayWriting()");
118 return 0;
119 }
120
121 if (tif->tif_dir.td_stripoffset_p == NULL && !TIFFSetupStrips(tif))
122 return 0;
123 }
124
125 if( _TIFFRewriteField( tif,
129 tif->tif_dir.td_nstrips,
131 && _TIFFRewriteField( tif,
135 tif->tif_dir.td_nstrips,
137 {
138 tif->tif_flags &= ~TIFF_DIRTYSTRIP;
139 tif->tif_flags &= ~TIFF_BEENWRITING;
140 return 1;
141 }
142
143 return 0;
144}
#define NULL
Definition: types.h:112
union TIFFDirEntry::@3461 tdir_offset
uint64 toff_long8
Definition: tif_dir.h:59
uint64 tdir_count
Definition: tif_dir.h:55
uint16 tdir_tag
Definition: tif_dir.h:53
uint16 tdir_type
Definition: tif_dir.h:54
uint64 * td_stripbytecount_p
Definition: tif_dir.h:102
TIFFDirEntry td_stripoffset_entry
Definition: tif_dir.h:107
uint32 td_nstrips
Definition: tif_dir.h:100
uint64 * td_stripoffset_p
Definition: tif_dir.h:101
TIFFDirEntry td_stripbytecount_entry
Definition: tif_dir.h:108
thandle_t tif_clientdata
Definition: tiffiop.h:207
char * tif_name
Definition: tiffiop.h:116
TIFFDirectory tif_dir
Definition: tiffiop.h:151
uint64 tif_diroff
Definition: tiffiop.h:146
int _TIFFRewriteField(TIFF *tif, uint16 tag, TIFFDataType in_datatype, tmsize_t count, void *data)
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
int TIFFIsTiled(TIFF *tif)
Definition: tif_open.c:594
int TIFFSetupStrips(TIFF *tif)
Definition: tif_write.c:523
@ TIFF_LONG8
Definition: tiff.h:138
#define TIFFTAG_TILEBYTECOUNTS
Definition: tiff.h:288
#define TIFFTAG_STRIPBYTECOUNTS
Definition: tiff.h:233
#define TIFFTAG_TILEOFFSETS
Definition: tiff.h:287
#define TIFFTAG_STRIPOFFSETS
Definition: tiff.h:221
#define isTiled(tif)
Definition: tiffiop.h:229

Referenced by TIFFFlush(), and TIFFWriteCheck().