ReactOS 0.4.16-dev-2574-g474348f
tif_flush.c File Reference
#include "tiffiop.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 30 of file tif_flush.c.

31{
32 if (tif->tif_mode == O_RDONLY)
33 return 1;
34
35 if (!TIFFFlushData(tif))
36 return (0);
37
38 /* In update (r+) mode we try to detect the case where
39 only the strip/tile map has been altered, and we try to
40 rewrite only that portion of the directory without
41 making any other changes */
42
43 if ((tif->tif_flags & TIFF_DIRTYSTRIP) &&
44 !(tif->tif_flags & TIFF_DIRTYDIRECT) && tif->tif_mode == O_RDWR)
45 {
47 return 1;
48 }
49
52 return (0);
53
54 return (1);
55}
#define O_RDONLY
Definition: fcntl.h:34
#define O_RDWR
Definition: fcntl.h:36
uint32_t tif_flags
Definition: tiffiop.h:117
int tif_mode
Definition: tiffiop.h:116
int TIFFRewriteDirectory(TIFF *tif)
Definition: tif_dirwrite.c:483
int TIFFForceStrileArrayWriting(TIFF *tif)
Definition: tif_flush.c:76
int TIFFFlushData(TIFF *tif)
Definition: tif_flush.c:146
#define TIFF_DIRTYSTRIP
Definition: tiffiop.h:140
#define TIFF_DIRTYDIRECT
Definition: tiffiop.h:120

Referenced by TIFFCleanup().

◆ TIFFFlushData()

int TIFFFlushData ( TIFF tif)

Definition at line 146 of file tif_flush.c.

147{
148 if ((tif->tif_flags & TIFF_BEENWRITING) == 0)
149 return (1);
150 if (tif->tif_flags & TIFF_POSTENCODE)
151 {
152 tif->tif_flags &= ~TIFF_POSTENCODE;
153 if (!(*tif->tif_postencode)(tif))
154 return (0);
155 }
156 return (TIFFFlushData1(tif));
157}
TIFFBoolMethod tif_postencode
Definition: tiffiop.h:204
int TIFFFlushData1(TIFF *tif)
Definition: tif_write.c:931
#define TIFF_POSTENCODE
Definition: tiffiop.h:129
#define TIFF_BEENWRITING
Definition: tiffiop.h:123

Referenced by TIFFFlush(), and TIFFWriteScanline().

◆ TIFFForceStrileArrayWriting()

int TIFFForceStrileArrayWriting ( TIFF tif)

Definition at line 76 of file tif_flush.c.

77{
78 static const char module[] = "TIFFForceStrileArrayWriting";
79 const int isTiled = TIFFIsTiled(tif);
80
81 if (tif->tif_mode == O_RDONLY)
82 {
83 TIFFErrorExtR(tif, tif->tif_name, "File opened in read-only mode");
84 return 0;
85 }
86 if (tif->tif_diroff == 0)
87 {
88 TIFFErrorExtR(tif, module, "Directory has not yet been written");
89 return 0;
90 }
91 if ((tif->tif_flags & TIFF_DIRTYDIRECT) != 0)
92 {
94 "Directory has changes other than the strile arrays. "
95 "TIFFRewriteDirectory() should be called instead");
96 return 0;
97 }
98
99 if (!(tif->tif_flags & TIFF_DIRTYSTRIP))
100 {
101 if (!(tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 &&
109 {
111 "Function not called together with "
112 "TIFFDeferStrileArrayWriting()");
113 return 0;
114 }
115
116 if (tif->tif_dir.td_stripoffset_p == NULL && !TIFFSetupStrips(tif))
117 return 0;
118 }
119
120 if (_TIFFRewriteField(tif,
128 {
129 tif->tif_flags &= ~TIFF_DIRTYSTRIP;
130 tif->tif_flags &= ~TIFF_BEENWRITING;
131 return 1;
132 }
133
134 return 0;
135}
#define NULL
Definition: types.h:112
uint64_t tdir_count
Definition: tif_dir.h:57
uint16_t tdir_type
Definition: tif_dir.h:56
union TIFFDirEntry::@3701 tdir_offset
uint64_t toff_long8
Definition: tif_dir.h:62
uint16_t tdir_tag
Definition: tif_dir.h:55
TIFFDirEntry td_stripoffset_entry
Definition: tif_dir.h:127
uint64_t * td_stripbytecount_p
Definition: tif_dir.h:114
uint64_t * td_stripoffset_p
Definition: tif_dir.h:113
uint32_t td_nstrips
Definition: tif_dir.h:111
TIFFDirEntry td_stripbytecount_entry
Definition: tif_dir.h:128
uint64_t tif_diroff
Definition: tiffiop.h:150
char * tif_name
Definition: tiffiop.h:114
TIFFDirectory tif_dir
Definition: tiffiop.h:157
int _TIFFRewriteField(TIFF *tif, uint16_t tag, TIFFDataType in_datatype, tmsize_t count, void *data)
void TIFFErrorExtR(TIFF *tif, const char *module, const char *fmt,...)
Definition: tif_error.c:107
int TIFFIsTiled(TIFF *tif)
Definition: tif_open.c:859
int TIFFSetupStrips(TIFF *tif)
Definition: tif_write.c:553
@ TIFF_LONG8
Definition: tiff.h:161
#define TIFFTAG_TILEBYTECOUNTS
Definition: tiff.h:314
#define TIFFTAG_STRIPBYTECOUNTS
Definition: tiff.h:259
#define TIFFTAG_TILEOFFSETS
Definition: tiff.h:313
#define TIFFTAG_STRIPOFFSETS
Definition: tiff.h:247
#define isTiled(tif)
Definition: tiffiop.h:274

Referenced by TIFFFlush(), and TIFFWriteCheck().