|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Write, checkpoint, relocate, and patch directory metadata. More...
Functions | |
| int | TIFFWriteDirectory (TIFF *tif) |
| Finish the current image directory and prepare a fresh one. | |
| int | TIFFWriteCustomDirectory (TIFF *tif, uint64_t *pdiroff) |
| Write current custom values and return their IFD offset. | |
| int | TIFFCheckpointDirectory (TIFF *tif) |
| Write the current image directory while retaining its values. | |
| int | TIFFRewriteDirectory (TIFF *tif) |
| Relocate the current image IFD and repair its main-chain link. | |
| int | TIFFDeferStrileArrayWriting (TIFF *tif) |
| Reserve strile-array entries for deferred payload writing. | |
| int | TIFFForceStrileArrayWriting (TIFF *tif) |
| Patch on-file strile offset and byte-count payloads. | |
Write, checkpoint, relocate, and patch directory metadata.
|
extern |
Write the current image directory while retaining its values.
Serialises current values, allocates temporary entry/conversion buffers, may load strile arrays, and invokes client I/O and tag/codec/diagnostic callbacks. May overwrite a fitting IFD or relocate it when its recorded reusable span is too small. Tag data or links can be written before final IFD completion. Failure can leave partially changed file bytes, offsets/maps/flags, buffers, and values; there is no rollback or durability/fsync guarantee. Some array emitters swap borrowed directory storage in place and do not restore it, including on failure. Internal strile-fill, map-check, and fresh-default errors are not uniformly propagated; success does not mean every nested operation was error-free. See Reading and writing IFDs. Does not perform the final postencode/encoder-close/raw-buffer teardown of TIFFWriteDirectory(). Retains directory arrays/codec context for continued writing, although in-place swapping can change array contents. Attempts strip setup without checking its result first. Always seeks to EOF and resets the image write offset afterwards, even when the IFD write failed; that seek result is not checked. A checkpoint is not a guarantee that buffered pixel data is complete or decoder-ready. Read-only handling in the shared writer is a success no-op, but surrounding setup/seek can still run.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
Definition at line 349 of file tif_dirwrite.c.
References FALSE, TIFFDirectory::td_stripoffset_p, tiff::tif_dir, TIFFSeekFile, TIFFSetupStrips(), TIFFSetWriteOffset(), TIFFWriteDirectorySec(), and TRUE.
|
extern |
Reserve strile-array entries for deferred payload writing.
Requires a writable current directory whose current IFD offset is zero, before its first directory write. Sets a directory-local flag so offset/byte-count entries are emitted as zero type/count/offset placeholders. Does not allocate, flush, emit arrays, or transfer ownership. Use the reviewed sequence in Reading and writing IFDs with TIFFWriteCheck(), directory writing, reselecting that IFD, and TIFFForceStrileArrayWriting(). The flag is reset with directory state. Read-only/already-written rejection dispatches an error and leaves the flag unchanged.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
Definition at line 325 of file tif_dirwrite.c.
References TIFFDirectory::td_deferstrilearraywriting, tiff::tif_dir, tiff::tif_diroff, tiff::tif_mode, tiff::tif_name, TIFFErrorExtR(), and TRUE.
|
extern |
Patch on-file strile offset and byte-count payloads.
Requires a writable, already-written, non-mapped IFD with no dirty changes beyond strile arrays. Accepts dirty striles or both recognised deferred placeholders. May allocate strip storage and conversion buffers, seek/read entries, and write/append payloads. Calls _TIFFRewriteField() for offsets then byte counts; failure can leave only the first patched, and no rollback is attempted. Does not finish codec/raw data or rewrite arbitrary metadata. On both successful patches clears dirty-strile and been-writing flags. Input arrays remain handle-owned and are copied for conversion by the patch helper; no ownership transfers. Errors dispatch diagnostics; use TIFFRewriteDirectory() for other dirty metadata.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
Definition at line 81 of file tif_flush.c.
References _TIFFRewriteField(), isTiled, TIFFDirectory::td_nstrips, TIFFDirectory::td_stripbytecount_entry, TIFFDirectory::td_stripbytecount_p, TIFFDirectory::td_stripoffset_entry, TIFFDirectory::td_stripoffset_p, TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_offset, TIFFDirEntry::tdir_tag, TIFFDirEntry::tdir_type, tiff::tif_dir, tiff::tif_diroff, tiff::tif_flags, tiff::tif_mode, tiff::tif_name, TIFF_DIRTYDIRECT, TIFF_DIRTYSTRIP, TIFF_LONG8, TIFFErrorExtR(), TIFFIsTiled(), TIFFSetupStrips(), TIFFTAG_STRIPBYTECOUNTS, TIFFTAG_STRIPOFFSETS, TIFFTAG_TILEBYTECOUNTS, TIFFTAG_TILEOFFSETS, and TIFFDirEntry::toff_long8.
Referenced by TIFFFlush(), and TIFFWriteCheck().
|
extern |
Relocate the current image IFD and repair its main-chain link.
Serialises current values, allocates temporary entry/conversion buffers, may load strile arrays, and invokes client I/O and tag/codec/diagnostic callbacks. May overwrite a fitting IFD or relocate it when its recorded reusable span is too small. Tag data or links can be written before final IFD completion. Failure can leave partially changed file bytes, offsets/maps/flags, buffers, and values; there is no rollback or durability/fsync guarantee. Some array emitters swap borrowed directory storage in place and do not restore it, including on failure. Internal strile-fill, map-check, and fresh-default errors are not uniformly propagated; success does not mean every nested operation was error-free. See Reading and writing IFDs. If no on-file offset exists, delegates to TIFFWriteDirectory(). Otherwise detaches the existing IFD from its preceding main-chain/header link before writing the replacement at EOF; old bytes are not reclaimed. Requires an IFD reachable through that chain; this is not a general SubIFD relocation operation. A failure after detachment can leave the chain broken. Successful completion resets values like TIFFWriteDirectory(). The relocation wrapper has no initial read-only guard: do not call it on a read-only handle with an existing offset.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
Definition at line 582 of file tif_dirwrite.c.
References TIFFRewriteDirectorySec(), and TRUE.
Referenced by TIFFFlush().
|
extern |
Write current custom values and return their IFD offset.
Serialises current values, allocates temporary entry/conversion buffers, may load strile arrays, and invokes client I/O and tag/codec/diagnostic callbacks. May overwrite a fitting IFD or relocate it when its recorded reusable span is too small. Tag data or links can be written before final IFD completion. Failure can leave partially changed file bytes, offsets/maps/flags, buffers, and values; there is no rollback or durability/fsync guarantee. Some array emitters swap borrowed directory storage in place and do not restore it, including on failure. Internal strile-fill, map-check, and fresh-default errors are not uniformly propagated; success does not mean every nested operation was error-free. See Reading and writing IFDs. Uses the custom-value list rather than core image field bits. Retains in-memory values and does not link the IFD into an image/metadata parent; the caller must store the offset in the appropriate parent tag. Can reuse a recorded fitting custom span or append at EOF. Does not finalise encoder/raw-buffer state. Read-only mode returns one before assigning the output.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [out] | pdiroff | Non-NULL offset slot. May be assigned before a later failure; unchanged by the read-only no-op. Use only after an actual successful write. |
Definition at line 360 of file tif_dirwrite.c.
References FALSE, and TIFFWriteDirectorySec().
|
extern |
Finish the current image directory and prepare a fresh one.
Serialises current values, allocates temporary entry/conversion buffers, may load strile arrays, and invokes client I/O and tag/codec/diagnostic callbacks. May overwrite a fitting IFD or relocate it when its recorded reusable span is too small. Tag data or links can be written before final IFD completion. Failure can leave partially changed file bytes, offsets/maps/flags, buffers, and values; there is no rollback or durability/fsync guarantee. Some array emitters swap borrowed directory storage in place and do not restore it, including on failure. Internal strile-fill, map-check, and fresh-default errors are not uniformly propagated; success does not mean every nested operation was error-free. See Reading and writing IFDs. Finalises postencoding and encoder close, flushes applicable raw data, releases owned raw buffers, and on success frees old directory/codec values and installs fresh defaults. Borrowed values/descriptors can be invalidated; the TIFF handle and client resource remain owned by the caller. New IFDs are linked into the main chain or pending SubIFD slots. Read-only mode returns one without doing this work.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
Definition at line 295 of file tif_dirwrite.c.
References TIFFWriteDirectorySec(), and TRUE.
Referenced by TIFFRewriteDirectorySec().